aboutsummaryrefslogtreecommitdiffstats
path: root/fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-02-14 12:05:07 -0800
committerBen Hilburn <ben.hilburn@ettus.com>2014-02-14 12:05:07 -0800
commitff1546f8137f7f92bb250f685561b0c34cc0e053 (patch)
tree7fa6fd05c8828df256a1b20e2935bd3ba9899e2c /fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v
parent4f691d88123784c2b405816925f1a1aef69d18c1 (diff)
downloaduhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.tar.gz
uhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.tar.bz2
uhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.zip
Pushing the bulk of UHD-3.7.0 code.
Diffstat (limited to 'fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v')
-rw-r--r--fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v59
1 files changed, 59 insertions, 0 deletions
diff --git a/fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v b/fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v
new file mode 100644
index 000000000..4a6713397
--- /dev/null
+++ b/fpga/usrp3/lib/simple_gemac/rxmac_to_ll8.v
@@ -0,0 +1,59 @@
+//
+// Copyright 2011 Ettus Research LLC
+//
+
+
+
+module rxmac_to_ll8
+ (input clk, input reset, input clear,
+ input [7:0] rx_data, input rx_valid, input rx_error, input rx_ack,
+ output [7:0] ll_data, output ll_sof, output ll_eof, output ll_error, output ll_src_rdy, input ll_dst_rdy );
+
+ reg [2:0] xfer_state;
+
+ localparam XFER_IDLE = 0;
+ localparam XFER_ACTIVE = 1;
+ localparam XFER_ERROR = 2;
+ localparam XFER_ERROR2 = 3;
+ localparam XFER_OVERRUN = 4;
+ localparam XFER_OVERRUN2 = 5;
+
+ assign ll_data = rx_data;
+ assign ll_src_rdy = ((rx_valid & (xfer_state != XFER_OVERRUN2) )
+ | (xfer_state == XFER_ERROR)
+ | (xfer_state == XFER_OVERRUN));
+ assign ll_sof = ((xfer_state==XFER_IDLE)|(xfer_state==XFER_ERROR)|(xfer_state==XFER_OVERRUN));
+ assign ll_eof = (rx_ack | (xfer_state==XFER_ERROR) | (xfer_state==XFER_OVERRUN));
+ assign ll_error = (xfer_state == XFER_ERROR)|(xfer_state==XFER_OVERRUN);
+
+ always @(posedge clk)
+ if(reset | clear)
+ xfer_state <= XFER_IDLE;
+ else
+ case(xfer_state)
+ XFER_IDLE :
+ if(rx_valid)
+ xfer_state <= XFER_ACTIVE;
+ XFER_ACTIVE :
+ if(rx_error)
+ xfer_state <= XFER_ERROR;
+ else if(~rx_valid)
+ xfer_state <= XFER_IDLE;
+ else if(~ll_dst_rdy)
+ xfer_state <= XFER_OVERRUN;
+ XFER_ERROR :
+ if(ll_dst_rdy)
+ xfer_state <= XFER_ERROR2;
+ XFER_ERROR2 :
+ if(~rx_error)
+ xfer_state <= XFER_IDLE;
+ XFER_OVERRUN :
+ if(ll_dst_rdy)
+ xfer_state <= XFER_OVERRUN2;
+ XFER_OVERRUN2 :
+ if(~rx_valid)
+ xfer_state <= XFER_IDLE;
+ endcase // case (xfer_state)
+
+
+endmodule // rxmac_to_ll8