OpenCores
URL https://opencores.org/ocsvn/ethmac10g/ethmac10g/trunk

Subversion Repositories ethmac10g

[/] [ethmac10g/] [trunk/] [bench/] [TransmitTop_min_frame_tb.v] - Blame information for rev 39

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 fisher5090
`include "TransmitTop.v"
2
module TransmitTop_min_frame_tb();
3
 
4
//Input from user logic
5
reg [63:0] TX_DATA;
6
reg [63:0] TX_DATA_int;
7
reg [7:0] TX_DATA_VALID; // To accept the data valid to be available
8
reg Append_last_bit;
9
reg TX_CLK;
10
reg RESET;
11
reg TX_START; // This signify the first frame of data
12
reg TX_UNDERRUN; // this will cause an error to be injected into the data
13
reg [7:0] TX_IFG_DELAY; // this will cause a delay in the ack signal
14
 
15
//input to transmit fault signals
16
reg RXTXLINKFAULT;
17
reg LOCALLINKFAULT;
18
reg [15:0] FC_TRANS_PAUSEDATA; //pause frame data
19
reg FC_TRANS_PAUSEVAL; //pulse signal to indicate a pause frame to be sent
20
 
21
//apply pause timing
22
reg [15:0] FC_TX_PAUSEDATA;
23
reg FC_TX_PAUSEVALID;
24
 
25
//apply configuration value
26
reg [31:0] TX_CFG_REG_VALUE;
27
reg TX_CFG_REG_VALID;
28
 
29
//output to stat register
30
wire TX_STATS_VALID;
31
wire [9:0] TXSTATREGPLUS; // a pulse for each reg for stats
32
wire [63:0] TXD;
33
wire [7:0] TXC;
34
wire TX_ACK;
35
reg D_START;
36
 
37
reg START_TX_BITS;
38
 
39
// Initialize all variables
40
initial begin
41
 
42
  Append_last_bit = 0;
43
  TX_CLK = 1;       // initial value of clock
44
  RESET <= 0;       // initial value of reset
45
  TX_START <= 0;      // initial value of enable
46
  TX_DATA_VALID <= 8'h00;
47
  D_START = 0;
48
  FC_TX_PAUSEVALID <= 0;
49
  FC_TX_PAUSEDATA <= 0;
50
  FC_TRANS_PAUSEDATA <= 0;
51
  FC_TRANS_PAUSEVAL <= 0;
52
  TX_UNDERRUN = 0;
53
  #5 RESET= 1;    // Assert the reset
54
  #10 RESET= 0;    // De-assert the reset 
55
  #15 TX_START = 1;
56
  //    TX_DATA = 64'h0000560000000000;
57
      TX_DATA_VALID = 8'hFF;
58
        D_START = 1;
59
  #20 TX_START = 0;
60
  //#1800 TX_DATA_VALID = 8'h07;
61
  #60 TX_DATA_VALID = 8'h07;
62
//  #1960 TX_DATA_VALID = 8'h07;
63
  //    TX_DATA = 64'h0000000000000011;
64
  #10   TX_DATA_VALID = 8'h00;
65
                D_START = 0;
66
//next frame
67
  #20 TX_START <= 1;
68
      TX_DATA_VALID <= 8'hFF;
69
        D_START = 1;
70
  #20 TX_START <= 0;
71
  #400  TX_DATA_VALID <= 8'h00;
72
  #10   TX_DATA_VALID <= 8'h00;
73
                D_START = 0;
74
 
75
  #1000 $finish;     // Terminate simulation
76
end
77
 
78
always @(posedge D_START or posedge TX_CLK)
79
begin
80
  if (D_START == 0) begin
81
    TX_DATA = 64'h0000000000000000;
82
  end
83
  //else if (TX_DATA_VALID == 8'h07) begin
84
  //  TX_DATA = 64'h000000000077FFCC;
85
  //end
86
  else if (Append_last_bit == 1) begin
87
//    TX_DATA = 64'h202020202077FFCC;
88
    TX_DATA = 64'h000000000077FFCC;
89
  end
90
  else if (START_TX_BITS == 1) begin
91
    TX_DATA = TX_DATA + 1;
92
  end
93
  else begin
94
    TX_DATA = 64'h0000000000000001;
95
  end
96
end
97
 
98
 
99
 
100
always @(TX_DATA)
101
begin
102
  if (TX_DATA == 2) begin
103
     TX_DATA_int[31:0] <= TX_DATA[31:0];
104
     TX_DATA_int[47:32] <= 300;
105
     TX_DATA_int[63:48] <= TX_DATA[63:48];
106
  end
107
  else begin
108
     TX_DATA_int <= TX_DATA;
109
  end
110
 
111
end
112
 
113
 
114
always @(TX_ACK | TX_START)
115
begin
116
  if (TX_ACK) begin
117
    START_TX_BITS = 1;
118
  end
119
  else if (TX_START) begin
120
    START_TX_BITS = 0;
121
  end
122
end
123
 
124
 
125
// Clock generator
126
always begin
127
  #5 TX_CLK= ~TX_CLK; // Toggle clock every 5 ticks
128
end
129
 
130
// Connect DUT to test bench
131
TRANSMIT_TOP U_top_module (
132
TX_DATA_int,
133
TX_DATA_VALID,
134
TX_CLK,
135
RESET,
136
TX_START,
137
TX_ACK,
138
TX_UNDERRUN,
139
TX_IFG_DELAY,
140
RXTXLINKFAULT,
141
LOCALLINKFAULT,
142
TX_STATS_VALID,
143
TXSTATREGPLUS,
144
TXD,
145
TXC,
146
FC_TRANS_PAUSEDATA,
147
FC_TRANS_PAUSEVAL,
148
FC_TX_PAUSEDATA,
149
FC_TX_PAUSEVALID,
150
TX_CFG_REG_VALUE,
151
TX_CFG_REG_VALID
152
);
153
 
154
 
155
 
156
 
157
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.