summaryrefslogtreecommitdiffstats
path: root/simple_gemac
diff options
context:
space:
mode:
authormatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-31 07:39:34 +0000
committermatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-31 07:39:34 +0000
commit807014e4ad3b32bcc455bca4390e5cb2ec5b9512 (patch)
tree110be55fedcc3db06c58b9c5d1e3cee9a3f67878 /simple_gemac
parent3c19bda615e79c1de341f69ed9845c5e35334571 (diff)
downloaduhd-807014e4ad3b32bcc455bca4390e5cb2ec5b9512.tar.gz
uhd-807014e4ad3b32bcc455bca4390e5cb2ec5b9512.tar.bz2
uhd-807014e4ad3b32bcc455bca4390e5cb2ec5b9512.zip
tx should be fully working now
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10718 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'simple_gemac')
-rw-r--r--simple_gemac/simple_gemac_tb.v14
-rw-r--r--simple_gemac/simple_gemac_tx.v46
2 files changed, 34 insertions, 26 deletions
diff --git a/simple_gemac/simple_gemac_tb.v b/simple_gemac/simple_gemac_tb.v
index eacad7545..6584a1a81 100644
--- a/simple_gemac/simple_gemac_tb.v
+++ b/simple_gemac/simple_gemac_tb.v
@@ -123,16 +123,22 @@ module simple_gemac_tb;
SendPacketFromFile(60);
repeat (100)
@(posedge clk);
- SendPacketFromFile(59);
+ SendPacketFromFile(61);
repeat (100)
@(posedge clk);
- SendPacketFromFile(58);
+ SendPacketFromFile(62);
repeat (100)
@(posedge clk);
- SendPacketFromFile(61);
+ SendPacketFromFile(63);
repeat (100)
@(posedge clk);
- SendPacketFromFile(62);
+ SendPacketFromFile(64);
+ repeat (100)
+ @(posedge clk);
+ SendPacketFromFile(59);
+ repeat (100)
+ @(posedge clk);
+ SendPacketFromFile(58);
#10000 $finish;
end
diff --git a/simple_gemac/simple_gemac_tx.v b/simple_gemac/simple_gemac_tx.v
index 783f69e45..d164d3fed 100644
--- a/simple_gemac/simple_gemac_tx.v
+++ b/simple_gemac/simple_gemac_tx.v
@@ -43,8 +43,9 @@ module simple_gemac_tx
localparam TX_CRC_2 = TX_CRC_0 + 2;
localparam TX_CRC_3 = TX_CRC_0 + 3;
localparam TX_ERROR = 32;
- localparam TX_PAUSE = 56;
- localparam TX_PAUSE_SOF = 63;
+ localparam TX_PAUSE = 55;
+ localparam TX_PAUSE_SOF = TX_PAUSE + 7;
+ localparam TX_PAUSE_FIRST = TX_PAUSE_SOF + 1;
localparam TX_PAUSE_END = TX_PAUSE_SOF + 18;
reg send_pause;
@@ -138,8 +139,7 @@ module simple_gemac_tx
tx_en_pre <= 0;
TX_PAD :
txd_pre <= 0;
-
- 8'b01xx_xxxx : // In Pause Frame
+ TX_PAUSE_FIRST, 8'b01xx_xxxx : // In Pause Frame
txd_pre <= pause_dat;
endcase // case (tx_state)
@@ -195,25 +195,30 @@ module simple_gemac_tx
wire clear_crc = (tx_state == TX_IDLE);
-// wire calc_crc_pre = (tx_state==TX_FIRSTBYTE)||(tx_state==TX_IN_FRAME)||
-// ((tx_state ==TX_IN_FRAME_2)&tx_valid )||(tx_state==TX_PAD )||(tx_state[6]);
- // reg calc_crc;
- // always @(posedge tx_clk)
- // calc_crc <= calc_crc_pre;
- wire calc_crc = 0;
+ wire calc_crc =
+ (tx_state==TX_IN_FRAME) |
+ (tx_state==TX_IN_FRAME_2) |
+ (tx_state==TX_PAD) |
+ (tx_state[6]);
+
+ reg [7:0] crc_ctr;
+ reg calc_crc_d1;
+ always @(posedge tx_clk)
+ calc_crc_d1 <= calc_crc;
+
+ always @(posedge tx_clk)
+ if(reset)
+ crc_ctr <= 0;
+ else if(calc_crc)
+ crc_ctr <= crc_ctr+1;
+ else if(calc_crc_d1)
+ $display("CRC COUNT = %d",crc_ctr);
+ else
+ crc_ctr <= 0;
- /*
- wire calc_crc = ~(tx_state==TX_IDLE) &
- ~(tx_state==TX_IDLE) &
- ~(tx_state==TX_IDLE) &
- ~(tx_state==TX_IDLE) &
- */
crc crc(.clk(tx_clk), .reset(reset), .clear(clear_crc),
.data(txd_pre), .calc(calc_crc), .crc_out(crc_out));
-
-// .data(txd_pre), .calc(calc_crc & ~(tx_state==TX_CRC_0)), .crc_out(crc_out));
-
assign tx_ack = (tx_state == TX_FIRSTBYTE);
reg tx_valid_d1;
@@ -233,9 +238,6 @@ module simple_gemac_tx
GMII_TXD <= crc_out[15:8];
TX_CRC_3 :
GMII_TXD <= crc_out[7:0];
-// TX_IN_FRAME :
-// TX_PAD :
-// GMII_TXD <= tx_valid_d1 ? txd_pre : 0;
default :
GMII_TXD <= txd_pre;
endcase // case (tx_state)