OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [sha1/] [port_sha1_tb.v] - Blame information for rev 9

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

Line No. Rev Author Line
1 2 peteralieb
// Port MD5 Testbench
2
 
3
`timescale 1ns / 100ps
4
 
5
module port_sha1_tb;
6
 
7
// Input stimulus:
8
reg     clk;
9
reg     rst;
10
reg     en;
11
reg     [7:0]    in_data;
12
reg     in_sof;
13
reg     in_eof;
14
reg     in_src_rdy;
15
reg     out_dst_rdy;
16
 
17
// Output connections:
18
wire    [7:0]    out_data;
19
wire    out_sof;
20
wire    out_eof;
21
wire    out_src_rdy;
22
wire    in_dst_rdy;
23
 
24
 
25
//Instantiate the DUT (device under test):
26
port_sha1 DUT (
27
        // Inputs:
28
        .clk ( clk ),
29
        .rst ( rst ),
30
        .wen ( en ),
31
        .ren ( en ),
32
        .in_data ( in_data ),   // Input
33
        .in_sof ( in_sof ),     // Input
34
        .in_eof ( in_eof ),     // Input
35
        .in_src_rdy ( in_src_rdy ),     // Input
36
        .out_dst_rdy ( out_dst_rdy ),   // Output
37
 
38
        // Outputs:
39
        .out_data ( out_data ), // Output
40
        .out_sof ( out_sof ),   // Output
41
        .out_eof ( out_eof ),   // Output
42
        .out_src_rdy ( out_src_rdy ),   // Output
43
        .in_dst_rdy ( in_dst_rdy )      // Input
44
);
45
 
46
        // Specify input stimulus:
47
 
48
initial begin
49
 
50
        // Initial values for input stimulus:
51
        clk = 1;
52
        rst = 1'b0;
53
        en = 1'b0;
54
        in_data = 8'b0;
55
        in_sof = 1'b0;
56
        in_eof = 1'b0;
57
        in_src_rdy = 1'b1;
58
        out_dst_rdy = 1'b0;
59
 
60
        //
61
        //--- INSERT YOUR INPUT STIMULUS DESCRIPTION HERE ---
62
        //
63
 
64
        @(posedge clk);
65
        rst = 1;
66
        @(posedge clk);
67
        rst = 0;
68
        @(posedge clk);
69
        en = 0;
70
        in_sof = 1;
71
        in_src_rdy = 1;
72
        in_data = "s";
73
        #1 en = 1;
74
        wait (in_dst_rdy);
75
        @(posedge clk);
76
        in_sof = 0;
77
        in_data = "u";
78
        @(posedge clk);
79
        in_data = "b";
80
        @(posedge clk);
81
        in_data = "a";
82
        @(posedge clk);
83
        in_data = "r";
84
        @(posedge clk);
85
        in_data = "u";
86
        @(posedge clk);
87
        in_data = 8'h80;
88
        @(posedge clk);
89
        in_data = 8'h0;
90
        @(posedge clk);
91
        @(posedge clk);
92
        @(posedge clk);
93
 
94
        in_src_rdy = 0;
95
        en = 0;
96
        @(posedge clk);
97
        in_src_rdy = 1;
98
        en = 1;
99
 
100
        @(posedge clk);
101
        @(posedge clk);
102
        @(posedge clk);
103
        @(posedge clk);
104
        @(posedge clk);
105
        @(posedge clk);
106
 
107
        @(posedge clk);
108
        @(posedge clk);
109
        @(posedge clk);
110
        @(posedge clk);
111
        @(posedge clk);
112
        @(posedge clk);
113
        @(posedge clk);
114
        @(posedge clk);
115
        @(posedge clk);
116
        @(posedge clk);
117
        @(posedge clk);
118
        @(posedge clk);
119
        @(posedge clk);
120
        @(posedge clk);
121
        @(posedge clk);
122
        @(posedge clk);
123
 
124
        @(posedge clk);
125
        @(posedge clk);
126
        @(posedge clk);
127
        @(posedge clk);
128
        @(posedge clk);
129
        @(posedge clk);
130
        @(posedge clk);
131
        @(posedge clk);
132
        @(posedge clk);
133
        @(posedge clk);
134
        @(posedge clk);
135
        @(posedge clk);
136
        @(posedge clk);
137
        @(posedge clk);
138
        @(posedge clk);
139
        @(posedge clk);
140
 
141
        //in_data = 8'h80;
142
        @(posedge clk);
143
        //in_data = 8'h00;
144
        @(posedge clk);
145
        @(posedge clk);
146
        @(posedge clk);
147
        @(posedge clk);
148
        @(posedge clk);
149
        @(posedge clk);
150
        @(posedge clk);
151
        @(posedge clk);
152
        @(posedge clk);
153
        @(posedge clk);
154
        @(posedge clk);
155
        @(posedge clk);
156
        @(posedge clk);
157
        //in_data = 8'h03;
158
        @(posedge clk);
159
        in_eof = 1;
160
        in_data = 8'h30;
161
        @(posedge clk);
162
        in_eof = 0;
163
        in_src_rdy = 0;
164
        wait (out_src_rdy);
165
        @(posedge clk);
166
        @(posedge clk);
167
        @(posedge clk);
168
        @(posedge clk);
169
        @(posedge clk);
170
        @(posedge clk);
171
        @(posedge clk);
172
        @(posedge clk);
173
        @(posedge clk);
174
        @(posedge clk);
175
        @(posedge clk);
176
        @(posedge clk);
177
        @(posedge clk);
178
        @(posedge clk);
179
        @(posedge clk);
180
        @(posedge clk);
181
        @(posedge clk);
182
        @(posedge clk);
183
        @(posedge clk);
184
        @(posedge clk);
185
        $stop;
186
 
187
end
188
 
189
        // Template for master clock. Uncomment and modify signal name as needed.
190
        // Remember to set the initial value of 'Clock' in the 'initial' block above.
191
always #5 clk = ~clk;
192
always @(posedge clk)
193
        out_dst_rdy = ~out_dst_rdy;
194
 
195
endmodule

powered by: WebSVN 2.1.0

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