Statistics
| Branch: | Tag: | Revision:

root / usrp2 / simple_gemac / eth_tasks_f36.v @ master

History | View | Annotate | Download (2.67 KB)

1 bfaa5d14 Josh Blum
//
2
// Copyright 2011 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17
18 91636cba Johnathan Corgan
19
20
task SendFlowCtrl;
21
   input [15:0] fc_len;
22
   begin
23
      $display("Sending Flow Control, quanta = %d, time = %d", fc_len,$time);
24 2a2e3357 Matt Ettus
      //pause_time <= fc_len;
25 c811e886 Matt Ettus
      @(posedge eth_clk);
26 2a2e3357 Matt Ettus
      //pause_req <= 1;
27 c811e886 Matt Ettus
      @(posedge eth_clk);
28 2a2e3357 Matt Ettus
      //pause_req <= 0;
29 91636cba Johnathan Corgan
      $display("Sent Flow Control");
30
   end
31
endtask // SendFlowCtrl
32
33
task SendPacket_to_fifo36;
34
   input [31:0] data_start;
35
   input [15:0] data_len;
36
   reg [15:0] 	count;
37
   begin
38
      $display("Sending Packet Len=%d, %d", data_len, $time);
39
      count   <= 2;
40 c811e886 Matt Ettus
      tx_f36_data <= {2'b0, 1'b0, 1'b1, data_start};
41 91636cba Johnathan Corgan
      tx_f36_src_rdy  <= 1;
42
      #1;
43
      while(count < data_len)
44
	begin
45
	   while(~tx_f36_dst_rdy)
46 c811e886 Matt Ettus
	     @(posedge sys_clk);
47
	   @(posedge sys_clk);
48
	   tx_f36_data[31:0] = tx_f36_data[31:0] + 32'h0101_0101;
49 91636cba Johnathan Corgan
	   count 	   = count + 4;
50 c811e886 Matt Ettus
	   tx_f36_data[32] <= 0;
51 91636cba Johnathan Corgan
	end
52 c811e886 Matt Ettus
      tx_f36_data[33] 	  <= 1;
53 91636cba Johnathan Corgan
      while(~tx_f36_dst_rdy)
54 c811e886 Matt Ettus
	@(posedge sys_clk);
55
      @(posedge sys_clk);
56 91636cba Johnathan Corgan
      tx_f36_src_rdy <= 0;
57
   end
58
endtask // SendPacket_to_fifo36
59
60 c811e886 Matt Ettus
/*
61 91636cba Johnathan Corgan
task Waiter;
62
   input [31:0] wait_length;
63
   begin
64
      tx_ll_src_rdy2 <= 0;
65
      repeat(wait_length)
66
	@(posedge clk);
67
      tx_ll_src_rdy2 <= 1;
68
   end
69
endtask // Waiter
70 c811e886 Matt Ettus
*/
71 91636cba Johnathan Corgan
72 c811e886 Matt Ettus
/*
73 91636cba Johnathan Corgan
task SendPacketFromFile_f36;
74
   input [31:0] data_len;
75
   input [31:0] wait_length;
76
   input [31:0] wait_time;
77
   
78
   integer count;
79
   begin
80
      $display("Sending Packet From File to LL8 Len=%d, %d",data_len,$time);
81
      $readmemh("test_packet.mem",pkt_rom );     
82
83
      while(~tx_f36_dst_rdy)
84
	@(posedge clk);
85 c811e886 Matt Ettus
      tx_f36_data <= pkt_rom[0];
86 91636cba Johnathan Corgan
      tx_f36_src_rdy <= 1;
87 c811e886 Matt Ettus
      tx_f36_eof     <= 0;
88 91636cba Johnathan Corgan
      @(posedge clk);
89
      
90
      for(i=1;i<data_len-1;i=i+1)
91
	begin
92
	   while(~tx_ll_dst_rdy2)
93
	     @(posedge clk);
94
	   tx_ll_data2 <= pkt_rom[i];
95
	   tx_ll_sof2  <= 0;
96
	   @(posedge clk);
97 c811e886 Matt Ettus
//	   if(i==wait_time)
98
//	     Waiter(wait_length);
99 91636cba Johnathan Corgan
	end
100
      
101
      while(~tx_ll_dst_rdy2)
102
	@(posedge clk);
103
      tx_ll_eof2 <= 1;
104
      tx_ll_data2 <= pkt_rom[data_len-1];
105
      @(posedge clk);
106
      tx_ll_src_rdy2 <= 0;
107
   end
108
endtask
109 c811e886 Matt Ettus
*/