From 618ebd292a5b0acf221ef2d4ccf1a19596bc6c86 Mon Sep 17 00:00:00 2001 From: Matt Ettus Date: Thu, 24 Sep 2009 12:33:22 -0700 Subject: Synchronize the internal phase of the halfband filters to the start of the "run" signal. This is important for MIMO. Bug reported by Christoph Hein and Hanwen . --- sdr_lib/small_hb_dec.v | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'sdr_lib/small_hb_dec.v') diff --git a/sdr_lib/small_hb_dec.v b/sdr_lib/small_hb_dec.v index 9957de15a..8519b628a 100644 --- a/sdr_lib/small_hb_dec.v +++ b/sdr_lib/small_hb_dec.v @@ -8,6 +8,7 @@ module small_hb_dec (input clk, input rst, input bypass, + input run, input stb_in, input [WIDTH-1:0] data_in, output reg stb_out, @@ -21,15 +22,26 @@ module small_hb_dec wire go; reg phase, go_d1, go_d2, go_d3, go_d4; always @(posedge clk) - if(rst) + if(rst | ~run) phase <= 0; else if(stb_in_d1) phase <= ~phase; assign go = stb_in_d1 & phase; - always @(posedge clk) go_d1 <= go; - always @(posedge clk) go_d2 <= go_d1; - always @(posedge clk) go_d3 <= go_d2; - always @(posedge clk) go_d4 <= go_d3; + always @(posedge clk) + if(rst | ~run) + begin + go_d1 <= 0; + go_d2 <= 0; + go_d3 <= 0; + go_d4 <= 0; + end + else + begin + go_d1 <= go; + go_d2 <= go_d1; + go_d3 <= go_d2; + go_d4 <= go_d3; + end wire [17:0] coeff_a = -10690; wire [17:0] coeff_b = 75809; -- cgit v1.2.3