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

Subversion Repositories sgmii

[/] [sgmii/] [trunk/] [src/] [mAltGX/] [mAlt8b10bdec_tb.v] - Blame information for rev 19

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

Line No. Rev Author Line
1 13 jefflieu
`define NO_PLI
2
`timescale 1ns / 1ps
3
 
4
module tb;
5
 
6
initial begin
7
  $display("***********************************************************");
8
  $display("title:  tb.demo_dec");
9
  $display("desc:   demonstration testbench");
10
  $display("        (c) Altera Inc. ALL RIGHTS RESERVED           ");
11
  $display("        www.altera.com                                     ");
12
  $display("***********************************************************");
13
  $display("PURPOSE: Demonstrate basic function and provide hookup example.");
14
  $display("PURPOSE: Note: no error checking is performed.");
15
  $display("METHOD:  A generator emits several random data and control values.");
16
  $display("***********************************************************");
17
end
18
 
19
/**********************************************************************/
20
// DEFINES AND INCLUDES
21
/**********************************************************************/
22
 
23
`define TBID "tb.demo_enc"
24
 
25
reg  clk;
26
reg  reset_n;
27
reg  dec_idle_del;
28
reg  dec_enable;
29
reg [9:0] dec_datain;
30
reg  dec_rdin;
31
reg  dec_rdforce;
32
 
33
wire  dec_kerr;
34
wire [7:0] dec_dataout;
35
wire  dec_valid;
36
wire  dec_rdout;
37
wire  dec_rdcascade;
38
wire  dec_kout;
39
wire     dec_rderr;
40
 
41
 
42
mAlt8b10bdec mAlt8b10bdec(
43
 .clk (clk) // input 
44
,.reset_n (reset_n) // input 
45
,.idle_del (dec_idle_del) // input 
46
,.ena (dec_enable) // input 
47
,.datain (dec_datain) // input [9:0]
48
,.rdforce (dec_rdforce) // input 
49
,.rdin (dec_rdin) // input 
50
,.valid (dec_valid) // output 
51
,.dataout (dec_dataout) // output [7:0]
52
,.kout (dec_kout) // output 
53
,.kerr (dec_kerr) // output 
54
//,.disparity (dec_disparity) // output [1:0]
55
,.rdout (dec_rdout) // output
56
,.rderr (dec_rderr) // output 
57
);
58
 
59
initial begin
60
        dec_enable = 1;
61
        dec_rdforce = 0;
62
        dec_rdin = 0;
63
        dec_idle_del = 0;
64
        @(posedge clk)  dec_datain <= 10'h0b9;
65
        @(posedge clk)  dec_datain <= 10'h0b9;
66
        @(posedge clk)  dec_datain <= 10'h17c;
67
        @(posedge clk)  dec_datain <= 10'h283;
68
        @(posedge clk)  dec_datain <= 10'h17c;
69
        @(posedge clk)  dec_datain <= 10'h283;
70
        @(posedge clk)  dec_datain <= 10'h17c;
71
        @(posedge clk)  dec_datain <= 10'h283;
72
        @(posedge clk)  dec_datain <= 10'h17c;
73
        @(posedge clk)  dec_datain <= 10'h283;
74
        @(posedge clk)  dec_datain <= 10'h17c;
75
        @(posedge clk)  dec_datain <= 10'h283;
76
        @(posedge clk)  dec_datain <= 10'h17c;
77
        @(posedge clk)  dec_datain <= 10'h283;
78
        @(posedge clk)  dec_datain <= 10'h17c;
79
        @(posedge clk)  dec_datain <= 10'h283;
80
        @(posedge clk)  dec_datain <= 10'h17c;
81
        @(posedge clk)  dec_datain <= 10'h283;
82
        @(posedge clk)  dec_datain <= 10'h17c;
83
        @(posedge clk)  dec_datain <= 10'h283;
84
        @(posedge clk)  dec_datain <= 10'h17c;
85
        @(posedge clk)  dec_datain <= 10'h283;
86
        @(posedge clk)  dec_datain <= 10'h17c;
87
        @(posedge clk)  dec_datain <= 10'h358;
88
        @(posedge clk)  dec_datain <= 10'h2d2;
89
        @(posedge clk)  dec_datain <= 10'h172;
90
        @(posedge clk)  dec_datain <= 10'h171;
91
        @(posedge clk)  dec_datain <= 10'h192;
92
        @(posedge clk)  dec_datain <= 10'h0ea;
93
        @(posedge clk)  dec_datain <= 10'h335;
94
        @(posedge clk)  dec_datain <= 10'h113;
95
        @(posedge clk)  dec_datain <= 10'h36a;
96
        @(posedge clk)  dec_datain <= 10'h30e;
97
        @(posedge clk)  dec_datain <= 10'h34c;
98
        @(posedge clk)  dec_datain <= 10'h2c3;
99
        @(posedge clk)  dec_datain <= 10'h21c;
100
        @(posedge clk)  dec_datain <= 10'h365;
101
        @(posedge clk)  dec_datain <= 10'h26c;
102
        @(posedge clk)  dec_datain <= 10'h2e4;
103
        @(posedge clk)  dec_datain <= 10'h1d2;
104
        @(posedge clk)  dec_datain <= 10'h1e1;
105
        @(posedge clk)  dec_datain <= 10'h08b;
106
        @(posedge clk)  dec_datain <= 10'h18d;
107
        @(posedge clk)  dec_datain <= 10'h267;
108
        @(posedge clk)  dec_datain <= 10'h313;
109
        @(posedge clk)  dec_datain <= 10'h0a9;
110
        @(posedge clk)  dec_datain <= 10'h1b2;
111
        @(posedge clk)  dec_datain <= 10'h2d3;
112
        @(posedge clk)  dec_datain <= 10'h272;
113
        @(posedge clk)  dec_datain <= 10'h283;
114
        @(posedge clk)  dec_datain <= 10'h1e9;
115
        @(posedge clk)  dec_datain <= 10'h22a;
116
        @(posedge clk)  dec_datain <= 10'h295;
117
        @(posedge clk)  dec_datain <= 10'h19e;
118
        @(posedge clk)  dec_datain <= 10'h1a4;
119
        @(posedge clk)  dec_datain <= 10'h057;
120
        @(posedge clk)  dec_datain <= 10'h26b;
121
        @(posedge clk)  dec_datain <= 10'h0b1;
122
        @(posedge clk)  dec_datain <= 10'h0c7;
123
        @(posedge clk)  dec_datain <= 10'h2d6;
124
        @(posedge clk)  dec_datain <= 10'h2b2;
125
        @(posedge clk)  dec_datain <= 10'h2b8;
126
        @(posedge clk)  dec_datain <= 10'h292;
127
        @(posedge clk)  dec_datain <= 10'h1bc;
128
        @(posedge clk)  dec_datain <= 10'h21a;
129
        @(posedge clk)  dec_datain <= 10'h1dc;
130
        @(posedge clk)  dec_datain <= 10'h22c;
131
        @(posedge clk)  dec_datain <= 10'h097;
132
        @(posedge clk)  dec_datain <= 10'h1e3;
133
        @(posedge clk)  dec_datain <= 10'h3a1;
134
        @(posedge clk)  dec_datain <= 10'h3a2;
135
        @(posedge clk)  dec_datain <= 10'h2a2;
136
        @(posedge clk)  dec_datain <= 10'h1b2;
137
        @(posedge clk)  dec_datain <= 10'h0e6;
138
        @(posedge clk)  dec_datain <= 10'h22e;
139
        @(posedge clk)  dec_datain <= 10'h296;
140
        @(posedge clk)  dec_datain <= 10'h296;
141
        @(posedge clk)  dec_datain <= 10'h07c;
142
        @(posedge clk)  dec_datain <= 10'h24b;
143
        @(posedge clk)  dec_datain <= 10'h139;
144
        @(posedge clk)  dec_datain <= 10'h33c;
145
        @(posedge clk)  dec_datain <= 10'h31c;
146
        @(posedge clk)  dec_datain <= 10'h178;
147
        @(posedge clk)  dec_datain <= 10'h04d;
148
        @(posedge clk)  dec_datain <= 10'h1a9;
149
        @(posedge clk)  dec_datain <= 10'h25a;
150
        @(posedge clk)  dec_datain <= 10'h23c;
151
        @(posedge clk)  dec_datain <= 10'h179;
152
        @(posedge clk)  dec_datain <= 10'h0b2;
153
        @(posedge clk)  dec_datain <= 10'h1cb;
154
        @(posedge clk)  dec_datain <= 10'h131;
155
        @(posedge clk)  dec_datain <= 10'h2cd;
156
        @(posedge clk)  dec_datain <= 10'h0ac;
157
        @(posedge clk)  dec_datain <= 10'h359;
158
        @(posedge clk)  dec_datain <= 10'h349;
159
        @(posedge clk)  dec_datain <= 10'h171;
160
        @(posedge clk)  dec_datain <= 10'h32c;
161
        @(posedge clk)  dec_datain <= 10'h143;
162
        @(posedge clk)  dec_datain <= 10'h0e5;
163
        @(posedge clk)  dec_datain <= 10'h139;
164
        @(posedge clk)  dec_datain <= 10'h2cb;
165
        @(posedge clk)  dec_datain <= 10'h249;
166
        @(posedge clk)  dec_datain <= 10'h17c;
167
        @(posedge clk)  dec_datain <= 10'h283;
168
        @(posedge clk)  dec_datain <= 10'h17c;
169
        @(posedge clk)  dec_datain <= 10'h283;
170
        @(posedge clk)  dec_datain <= 10'h2d6;
171
        @(posedge clk)  dec_datain <= 10'h095;
172
        @(posedge clk)  dec_datain <= 10'h0dc;
173
        @(posedge clk)  dec_datain <= 10'h05b;
174
        @(posedge clk)  dec_datain <= 10'h1ad;
175
        @(posedge clk)  dec_datain <= 10'h14e;
176
        @(posedge clk)  dec_datain <= 10'h11c;
177
        @(posedge clk)  dec_datain <= 10'h353;
178
        @(posedge clk)  dec_datain <= 10'h346;
179
        @(posedge clk)  dec_datain <= 10'h183;
180
        @(posedge clk)  dec_datain <= 10'h297;
181
        @(posedge clk)  dec_datain <= 10'h285;
182
        @(posedge clk)  dec_datain <= 10'h0b5;
183
        @(posedge clk)  dec_datain <= 10'h157;
184
        @(posedge clk)  dec_datain <= 10'h313;
185
        @(posedge clk)  dec_datain <= 10'h191;
186
        @(posedge clk)  dec_datain <= 10'h14d;
187
        @(posedge clk)  dec_datain <= 10'h1ea;
188
        @(posedge clk)  dec_datain <= 10'h12c;
189
        @(posedge clk)  dec_datain <= 10'h29a;
190
        @(posedge clk)  dec_datain <= 10'h0f1;
191
        @(posedge clk)  dec_datain <= 10'h0cd;
192
        @(posedge clk)  dec_datain <= 10'h0bc;
193
        @(posedge clk)  dec_datain <= 10'h2ad;
194
        @(posedge clk)  dec_datain <= 10'h278;
195
        @(posedge clk)  dec_datain <= 10'h2a8;
196
        @(posedge clk)  dec_datain <= 10'h17c;
197
        @(posedge clk)  dec_datain <= 10'h283;
198
        @(posedge clk)  dec_datain <= 10'h17c;
199
        @(posedge clk)  dec_datain <= 10'h283;
200
        @(posedge clk)  dec_datain <= 10'h28d;
201
        @(posedge clk)  dec_datain <= 10'h2a6;
202
        @(posedge clk)  dec_datain <= 10'h266;
203
        @(posedge clk)  dec_datain <= 10'h14e;
204
        @(posedge clk)  dec_datain <= 10'h2dc;
205
        @(posedge clk)  dec_datain <= 10'h093;
206
        @(posedge clk)  dec_datain <= 10'h0b9;
207
        @(posedge clk)  dec_datain <= 10'h27c;
208
        @(posedge clk)  dec_datain <= 10'h2a8;
209
        @(posedge clk)  dec_datain <= 10'h2ba;
210
        $display("$$$ Exit status for testbench tb.demo_dec :  TESTBENCH_PASSED ");
211
        $finish;
212
 
213
end
214
 
215
// clock generator (100 MHz)
216
initial begin
217
        clk <= 0;
218
        forever begin
219
                #10;
220
                clk = !clk;
221
        end
222
end
223
 
224
// reset task
225
initial begin
226
        reset_n <= 0;
227
        repeat (10) @(posedge clk);
228
        reset_n <= 1;
229
end
230
 
231
// logging task
232
 
233
always @(posedge clk) begin
234
        $display("%0t dec_enable = %b dec_datain = %x, dec_kout = %b, dec_dataout = %x",
235
                $time, dec_enable, dec_datain, dec_kout, dec_dataout);
236
end
237
endmodule

powered by: WebSVN 2.1.0

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