diff options
author | Josh Blum <josh@joshknows.com> | 2012-04-24 20:02:02 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-04-24 20:02:02 -0700 |
commit | 8a00096f9897fc6bb62e8fb7a5ce2fe336f91a8c (patch) | |
tree | 4eb447bdeba673f145886d12ce052c3fc74bfcf4 /usrp2 | |
parent | 600258c2ab0ad6284e9f6287ac340c1692984be6 (diff) | |
download | uhd-8a00096f9897fc6bb62e8fb7a5ce2fe336f91a8c.tar.gz uhd-8a00096f9897fc6bb62e8fb7a5ce2fe336f91a8c.tar.bz2 uhd-8a00096f9897fc6bb62e8fb7a5ce2fe336f91a8c.zip |
b100: implement packet-end/flush cycle timeout
Diffstat (limited to 'usrp2')
-rwxr-xr-x | usrp2/gpif/lint | 2 | ||||
-rw-r--r-- | usrp2/gpif/slave_fifo.v | 34 | ||||
-rw-r--r-- | usrp2/top/B100/u1plus_core.v | 2 |
3 files changed, 26 insertions, 12 deletions
diff --git a/usrp2/gpif/lint b/usrp2/gpif/lint deleted file mode 100755 index 4316c89a9..000000000 --- a/usrp2/gpif/lint +++ /dev/null @@ -1,2 +0,0 @@ -iverilog -Wall -y . -y ../fifo/ -y ../control_lib/ -y ../models/ -y ../coregen/ -y ../simple_gemac/ -y ../sdr_lib/ -y ../vrt/ gpif.v 2>&1 | grep -v coregen | grep -v models - diff --git a/usrp2/gpif/slave_fifo.v b/usrp2/gpif/slave_fifo.v index e75f28913..090b7b747 100644 --- a/usrp2/gpif/slave_fifo.v +++ b/usrp2/gpif/slave_fifo.v @@ -84,7 +84,7 @@ module slave_fifo reg tx_data_enough_space; reg [9:0] transfer_count; //number of lines (a line is 16 bits) in active transfer - + reg pktend_latch; reg [3:0] state; //state machine current state @@ -106,12 +106,29 @@ module slave_fifo localparam BUS_HOG_RX = 0; localparam BUS_HOG_TX = 1; + //count the number of cycles since RX data so we can force a flush + reg [17:0] non_rx_cycles; + localparam rx_idle_flush_cycles = 65536; //about 1ms at 64MHz clock + always @(posedge gpif_clk) begin + if(gpif_rst || state == STATE_DATA_RX || state == STATE_PKTEND) + non_rx_cycles <= 0; + else if (non_rx_cycles != rx_idle_flush_cycles) + non_rx_cycles <= non_rx_cycles + 1; + end + + //when should we flush aka pktend? + //pktend_latch tells us that its ok to flush -> we just had an RX xfer with EOF + //the RX DSP not running or a cycle counter gives us the flushing response dynamic + wire rx_data_flush = (~dsp_rx_run || non_rx_cycles == rx_idle_flush_cycles) && pktend_latch; + // ////////////////////////////////////////////////////////////// // FX2 slave FIFO bus master state machine // always @(posedge gpif_clk) - if(gpif_rst) + if(gpif_rst) begin state <= STATE_IDLE; + pktend_latch <= 0; + end else begin case (state) @@ -131,11 +148,8 @@ module slave_fifo state <= STATE_DATA_TX_SLOE; else if(data_rx_src_rdy & ~FX2_DF) state <= STATE_DATA_RX_ADR; - else if(~data_rx_src_rdy & ~dsp_rx_run & pktend_latch & ~FX2_DF) + else if(rx_data_flush & ~FX2_DF) state <= STATE_PKTEND_ADR; - - if(data_rx_src_rdy) - pktend_latch <= 1; end STATE_DATA_TX_SLOE: //just to assert SLOE one cycle before SLRD @@ -150,8 +164,10 @@ module slave_fifo STATE_DATA_RX: begin - if(data_rx_src_rdy && data_rx_dst_rdy) + if(data_rx_src_rdy && data_rx_dst_rdy) begin transfer_count <= transfer_count + 1; + pktend_latch <= gpif_d_out_data[17]; //ok to do pkt end when we complete with EOF + end else state <= STATE_IDLE; last_data_bus_hog <= BUS_HOG_RX; @@ -314,9 +330,9 @@ module slave_fifo .arst(fifo_rst)); //rd_fifo buffers writes to the 2clock fifo above - fifo_cascade #(.WIDTH(16), .SIZE(RXFIFOSIZE)) rd_fifo + fifo_cascade #(.WIDTH(18), .SIZE(RXFIFOSIZE)) rd_fifo (.clk(~gpif_clk), .reset(gpif_rst), .clear(clear_rx), - .datain(data_rx_int), .src_rdy_i(rx_src_rdy_int), .dst_rdy_o(rx_dst_rdy_int), .space(rxfifospace), + .datain(data_rx_int[17:0]), .src_rdy_i(rx_src_rdy_int), .dst_rdy_o(rx_dst_rdy_int), .space(rxfifospace), .dataout(gpif_d_out_data), .src_rdy_o(data_rx_src_rdy), .dst_rdy_i(data_rx_dst_rdy), .occupied()); // //////////////////////////////////////////////////////////////////// diff --git a/usrp2/top/B100/u1plus_core.v b/usrp2/top/B100/u1plus_core.v index c1d6767d1..74151ce98 100644 --- a/usrp2/top/B100/u1plus_core.v +++ b/usrp2/top/B100/u1plus_core.v @@ -413,7 +413,7 @@ module u1plus_core // Readback mux 32 -- Slave #7 //compatibility number -> increment when the fpga has been sufficiently altered - localparam compat_num = {16'd9, 16'd3}; //major, minor + localparam compat_num = {16'd9, 16'd4}; //major, minor wire [31:0] reg_test32; |