-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtop_tb.sv
61 lines (51 loc) · 1.26 KB
/
top_tb.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Intermediate Signal Testbench
//
// author: stf
module top_tb(
input clk,
input rst
);
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Testbench signals
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
logic tb_in1;
logic tb_in2;
logic tb_in3;
logic tb_out1;
logic tb_out2;
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Testbench logic for signal sequencing
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
logic [2:0] cnt;
always_ff @(posedge clk) begin
cnt <= cnt + 3'd1;
if (rst) begin
cnt <= 3'd0;
end
end
assign tb_in1 = cnt[0];
assign tb_in2 = cnt[1];
assign tb_in3 = cnt[2];
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
intermediate_signal intermediate_signal_inst(
// inputs
.in_1(tb_in1),
.in_2(tb_in2),
.in_3(tb_in3),
// outputs
.out_1(tb_out1),
.out_2(tb_out2)
);
always_ff @(posedge clk) begin
$display("tb_out1 = %d tb_out2 = %d", tb_out1, tb_out2);
end
// Print some stuff as an example
initial begin
if ($test$plusargs("trace") != 0) begin
$display("[%0t] Tracing to logs/vlt_dump.vcd...\n", $time);
$dumpfile("logs/vlt_dump.vcd");
$dumpvars();
end
$display("[%0t] Model running...\n", $time);
end
endmodule