Merged SVN matt/new_eth r10782:11633 into new_eth
[debian/gnuradio] / usrp2 / fpga / simple_gemac / eth_tasks_f36.v
1
2
3 task SendFlowCtrl;
4    input [15:0] fc_len;
5    begin
6       $display("Sending Flow Control, quanta = %d, time = %d", fc_len,$time);
7       pause_time <= fc_len;
8       @(posedge clk);
9       pause_req <= 1;
10       @(posedge clk);
11       pause_req <= 0;
12       $display("Sent Flow Control");
13    end
14 endtask // SendFlowCtrl
15
16 task SendPacket_to_fifo36;
17    input [31:0] data_start;
18    input [15:0] data_len;
19    reg [15:0]   count;
20    begin
21       $display("Sending Packet Len=%d, %d", data_len, $time);
22       count   <= 2;
23       tx_f36_dat <= {2'b0, 1'b0, 1'b1, data_start};
24       tx_f36_src_rdy  <= 1;
25       #1;
26       while(count < data_len)
27         begin
28            while(~tx_f36_dst_rdy)
29              @(posedge clk);
30            @(posedge clk);
31            tx_f36_dat[31:0] = tx_f36_dat[31:0] + 32'h0101_0101;
32            count           = count + 4;
33            tx_f36_dat[32] <= 0;
34         end
35       tx_f36_dat[3]       <= 1;
36       while(~tx_f36_dst_rdy)
37         @(posedge clk);
38       @(posedge clk);
39       tx_f36_src_rdy <= 0;
40    end
41 endtask // SendPacket_to_fifo36
42
43
44 task Waiter;
45    input [31:0] wait_length;
46    begin
47       tx_ll_src_rdy2 <= 0;
48       repeat(wait_length)
49         @(posedge clk);
50       tx_ll_src_rdy2 <= 1;
51    end
52 endtask // Waiter
53
54 task SendPacketFromFile_f36;
55    input [31:0] data_len;
56    input [31:0] wait_length;
57    input [31:0] wait_time;
58    
59    integer count;
60    begin
61       $display("Sending Packet From File to LL8 Len=%d, %d",data_len,$time);
62       $readmemh("test_packet.mem",pkt_rom );     
63
64       while(~tx_f36_dst_rdy)
65         @(posedge clk);
66       tx_f36_data2 <= pkt_rom[0];
67       tx_f36_src_rdy <= 1;
68       tx_ll_eof2     <= 0;
69       @(posedge clk);
70       
71       for(i=1;i<data_len-1;i=i+1)
72         begin
73            while(~tx_ll_dst_rdy2)
74              @(posedge clk);
75            tx_ll_data2 <= pkt_rom[i];
76            tx_ll_sof2  <= 0;
77            @(posedge clk);
78            if(i==wait_time)
79              Waiter(wait_length);
80         end
81       
82       while(~tx_ll_dst_rdy2)
83         @(posedge clk);
84       tx_ll_eof2 <= 1;
85       tx_ll_data2 <= pkt_rom[data_len-1];
86       @(posedge clk);
87       tx_ll_src_rdy2 <= 0;
88    end
89 endtask