diff options
author | Matt Ettus <matt@ettus.com> | 2009-09-10 22:52:08 -0700 |
---|---|---|
committer | Matt Ettus <matt@ettus.com> | 2009-12-21 16:50:35 -0800 |
commit | 37f1e195832e9c7e69a14947a810e8cc72b40e10 (patch) | |
tree | 6b6ed878f3b8ca86ba53ea62214e974d1760ee20 /control_lib/newfifo/fifo19_rxrealign.v | |
parent | a20bd4d33884d7d807facaff5b33a3785202c2aa (diff) | |
download | uhd-37f1e195832e9c7e69a14947a810e8cc72b40e10.tar.gz uhd-37f1e195832e9c7e69a14947a810e8cc72b40e10.tar.bz2 uhd-37f1e195832e9c7e69a14947a810e8cc72b40e10.zip |
19-bit fifo handling for receive side of eth/udp system
Diffstat (limited to 'control_lib/newfifo/fifo19_rxrealign.v')
-rw-r--r-- | control_lib/newfifo/fifo19_rxrealign.v | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/control_lib/newfifo/fifo19_rxrealign.v b/control_lib/newfifo/fifo19_rxrealign.v new file mode 100644 index 000000000..35ad90951 --- /dev/null +++ b/control_lib/newfifo/fifo19_rxrealign.v @@ -0,0 +1,42 @@ + + +// Adds a junk line at the beginning of every packet, which the +// following stages should ignore. This gives us proper alignment due +// to the 14 byte ethernet header + +// Bit 18 -- odd length +// Bit 17 -- eof +// Bit 16 -- sof +// Bit 15:0 -- data + +module fifo19_rxrealign + (input clk, input reset, input clear, + input [18:0] datain, input src_rdy_i, output dst_rdy_o, + output [18:0] dataout, output src_rdy_o, input dst_rdy_i); + + reg rxre_state; + localparam RXRE_DUMMY = 0; + localparam RXRE_PKT = 1; + + assign dataout[18] = datain[18]; + assign dataout[17] = datain[17]; + assign dataout[16] = (rxre_state==RXRE_DUMMY) | (datain[17] & datain[16]); // allows for passing error signal + assign dataout[15:0] = datain[15:0]; + + always @(posedge clk) + if(reset | clear) + rxre_state <= RXRE_DUMMY; + else if(src_rdy_i & dst_rdy_i) + case(rxre_state) + RXRE_DUMMY : + rxre_state <= RXRE_PKT; + RXRE_PKT : + if(datain[17]) // if eof or error + rxre_state <= RXRE_DUMMY; + endcase // case (rxre_state) + + assign src_rdy_o = src_rdy_i & dst_rdy_i; // Send anytime both sides are ready + assign dst_rdy_o = src_rdy_i & dst_rdy_i & (rxre_state == RXRE_PKT); // Only consume after the dummy + +endmodule // fifo19_rxrealign + |