aboutsummaryrefslogtreecommitdiffstats
path: root/simple_gemac/simple_gemac_tb.v
diff options
context:
space:
mode:
authormatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-31 05:56:47 +0000
committermatt <matt@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-31 05:56:47 +0000
commit97357ec460e5663f5dc84c2a109f654d2fd5af51 (patch)
tree353a055a4c62f2c8545779d0cb1c3642083a11d3 /simple_gemac/simple_gemac_tb.v
parent7df18a16ff4d9cf5ab95871a5b8d1a96f184f725 (diff)
downloaduhd-97357ec460e5663f5dc84c2a109f654d2fd5af51.tar.gz
uhd-97357ec460e5663f5dc84c2a109f654d2fd5af51.tar.bz2
uhd-97357ec460e5663f5dc84c2a109f654d2fd5af51.zip
nearly there
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10716 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'simple_gemac/simple_gemac_tb.v')
-rw-r--r--simple_gemac/simple_gemac_tb.v68
1 files changed, 63 insertions, 5 deletions
diff --git a/simple_gemac/simple_gemac_tb.v b/simple_gemac/simple_gemac_tb.v
index 61dbbe4c9..30a475960 100644
--- a/simple_gemac/simple_gemac_tb.v
+++ b/simple_gemac/simple_gemac_tb.v
@@ -38,6 +38,7 @@ module simple_gemac_tb;
task SendFlowCtrl;
begin
$display("Sending Flow Control");
+ $display($time);
@(posedge clk);
pause_req <= 1;
@(posedge clk);
@@ -51,12 +52,15 @@ module simple_gemac_tb;
input [31:0] data_len;
begin
$display("Sending Packet");
+ $display($time);
count <= 0;
tx_data <= data_start;
tx_error <= 0;
tx_valid <= 1;
while(~tx_ack)
@(posedge tx_clk);
+ $display("Packet Accepted");
+ $display($time);
while(count < data_len)
begin
tx_data <= tx_data + 1;
@@ -68,21 +72,75 @@ module simple_gemac_tb;
end
endtask // SendPacket
+ task SendPacketFromFile;
+ input [31:0] data_len;
+ begin
+ $display("Sending Packet From File");
+ $display($time);
+ $readmemh( "test_packet.mem",pkt_rom );
+ count = 0;
+ tx_data = pkt_rom[count];
+ tx_error = 0;
+ tx_valid = 1;
+ while(~tx_ack)
+ @(posedge tx_clk);
+ $display("Packet Accepted");
+ $display($time);
+ count = 1;
+ while(count < data_len)
+ begin
+ tx_data = pkt_rom[count];
+ count = count + 1;
+ @(posedge clk);
+ end
+ tx_valid <= 0;
+ @(posedge tx_clk);
+ end
+ endtask // SendPacket
+
initial $dumpfile("simple_gemac_tb.vcd");
initial $dumpvars(0,simple_gemac_tb);
-
+
+ integer i;
+ reg [7:0] pkt_rom[0:65535];
+ reg [1023:0] ROMFile;
+
+ initial
+ for (i=0;i<65536;i=i+1)
+ pkt_rom[i] <= 8'h0;
+
initial
begin
@(negedge reset);
repeat (20)
@(posedge clk);
SendFlowCtrl;
- repeat (100)
+ //repeat (200)
@(posedge clk);
SendPacket(8'hAA,10);
- repeat (1000)
- @(posedge clk);
- $finish;
+ //repeat (100)
+ // @(posedge clk);
+ SendPacketFromFile(60);
+ SendPacketFromFile(59);
+ SendPacketFromFile(58);
+ #10000 $finish;
end
+
+ always @(posedge clk)
+ if(GMII_TX_EN)
+ $display("%x",GMII_TXD);
endmodule // simple_gemac_tb
+
+/*
+ if ( !$value$plusargs( "rom=%s", ROMFile ) )
+ begin
+ $display( "Using default ROM file, 'flash.rom'" );
+ ROMFile = "flash.rom";
+ end
+ else
+ $display( "Using %s as ROM file.", ROMFile);
+
+ #1 $readmemh( ROMFile,rom );
+ end
+ */