Skip to content

Commit e8f8d67

Browse files
committed
added dataset to check CI
1 parent c2dc4cb commit e8f8d67

File tree

7 files changed

+262
-0
lines changed

7 files changed

+262
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module top_module ( output zero );
2+
3+
assign zero = 1'b0; // value 0 assigned to variable 'zero'
4+
// another acceptable value is 1'd0
5+
// NOTE: unlike previous case - 0 is perfectly fine (latter)
6+
// However for consistency we allow policy to appreciate the former
7+
// instead of latter for training data uniformity
8+
9+
endmodule
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This is a top module with an output
2+
module top_module( output zero );
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is a top module with an output
2+
module top_module( output zero );
3+
// Assign value to output
4+
// Insert code here
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This is a top module with an output
2+
module top_module( output zero );
3+
// Assign value to output
4+
// That output should always outputs 0
5+
// Insert code here
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
`timescale 1ns/1ps
2+
3+
module tb_top_module();
4+
// Signal to connect to DUT output
5+
wire zero;
6+
7+
// Instantiate the Design Under Test (DUT)
8+
top_module dut (
9+
.zero(zero)
10+
);
11+
12+
// Test variables
13+
reg test_passed;
14+
integer num_tests_passed;
15+
16+
initial begin
17+
// Initialize test tracking
18+
test_passed = 1'b0;
19+
num_tests_passed = 0;
20+
21+
// Display header
22+
$display("====================================");
23+
$display("Testing top_module");
24+
$display("====================================");
25+
$display("Time\tOutput\tExpected\tResult");
26+
$display("------------------------------------");
27+
28+
// Wait for any initialization
29+
#10;
30+
31+
// Test Case 1: Check if 'zero' equals plain 0
32+
if (zero == 0) begin
33+
$display("%0t\t%b\t1\t\tPASS", $time, zero);
34+
num_tests_passed = num_tests_passed + 1;
35+
end else begin
36+
$display("%0t\t%b\t1\t\tFAIL", $time, zero);
37+
test_passed = 1'b0;
38+
end
39+
40+
// Test Case 2: Check if 'zero' equals 1'b0
41+
#10;
42+
if (zero == 1'b0) begin
43+
$display("%0t\t%b\t1'b0\t\tPASS", $time, zero);
44+
num_tests_passed = num_tests_passed + 1;
45+
end else begin
46+
$display("%0t\t%b\t1'b0\t\tFAIL", $time, zero);
47+
test_passed = 1'b0;
48+
end
49+
50+
// Test Case 3: Check if 'zero' is NOT 1'b1
51+
#10;
52+
if (zero != 1'b1) begin
53+
$display("%0t\t%b\t!1'b0\t\tPASS", $time, zero);
54+
num_tests_passed = num_tests_passed + 1;
55+
end else begin
56+
$display("%0t\t%b\t!1'b0\t\tFAIL", $time, zero);
57+
test_passed = 1'b0;
58+
end
59+
60+
// Test Case 4: Check exact match with === operator
61+
#10;
62+
if (zero === 1'b0) begin
63+
$display("%0t\t%b\t===1'b0\t\tPASS", $time, zero);
64+
num_tests_passed = num_tests_passed + 1;
65+
end else begin
66+
$display("%0t\t%b\t===1'b0\t\tFAIL", $time, zero);
67+
test_passed = 1'b0;
68+
end
69+
70+
// Final Summary
71+
#10;
72+
$display("====================================");
73+
$display("Test Summary: %0d/4 tests passed", num_tests_passed);
74+
if (test_passed)
75+
$display("Overall Result: ALL TESTS PASSED");
76+
else
77+
$display("Overall Result: SOME TESTS FAILED");
78+
$display("====================================");
79+
80+
// End simulation
81+
#10;
82+
$finish;
83+
end
84+
85+
// Optional: Generate VCD file for waveform viewing
86+
initial begin
87+
$dumpfile("top_module_tb.vcd");
88+
$dumpvars(0, tb_top_module);
89+
end
90+
91+
endmodule
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#! /opt/homebrew/Cellar/icarus-verilog/12.0/bin/vvp
2+
:ivl_version "12.0 (stable)";
3+
:ivl_delay_selection "TYPICAL";
4+
:vpi_time_precision - 12;
5+
:vpi_module "/opt/homebrew/Cellar/icarus-verilog/12.0/lib/ivl/system.vpi";
6+
:vpi_module "/opt/homebrew/Cellar/icarus-verilog/12.0/lib/ivl/vhdl_sys.vpi";
7+
:vpi_module "/opt/homebrew/Cellar/icarus-verilog/12.0/lib/ivl/vhdl_textio.vpi";
8+
:vpi_module "/opt/homebrew/Cellar/icarus-verilog/12.0/lib/ivl/v2005_math.vpi";
9+
:vpi_module "/opt/homebrew/Cellar/icarus-verilog/12.0/lib/ivl/va_math.vpi";
10+
S_0x14e607320 .scope module, "tb_top_module" "tb_top_module" 2 3;
11+
.timescale -9 -12;
12+
v0x600000d641b0_0 .var/i "num_tests_passed", 31 0;
13+
v0x600000d64240_0 .var "test_passed", 0 0;
14+
L_0x150078010 .functor BUFT 1, C4<0>, C4<0>, C4<0>, C4<0>;
15+
v0x600000d642d0_0 .net "zero", 0 0, L_0x150078010; 1 drivers
16+
S_0x14e606020 .scope module, "dut" "top_module" 2 8, 3 1 0, S_0x14e607320;
17+
.timescale -9 -12;
18+
.port_info 0 /OUTPUT 1 "zero";
19+
v0x600000d64120_0 .net "zero", 0 0, L_0x150078010; alias, 1 drivers
20+
.scope S_0x14e607320;
21+
T_0 ;
22+
%pushi/vec4 0, 0, 1;
23+
%store/vec4 v0x600000d64240_0, 0, 1;
24+
%pushi/vec4 0, 0, 32;
25+
%store/vec4 v0x600000d641b0_0, 0, 32;
26+
%vpi_call 2 22 "$display", "====================================" {0 0 0};
27+
%vpi_call 2 23 "$display", "Testing top_module" {0 0 0};
28+
%vpi_call 2 24 "$display", "====================================" {0 0 0};
29+
%vpi_call 2 25 "$display", "Time\011Output\011Expected\011Result" {0 0 0};
30+
%vpi_call 2 26 "$display", "------------------------------------" {0 0 0};
31+
%delay 10000, 0;
32+
%load/vec4 v0x600000d642d0_0;
33+
%pad/u 32;
34+
%cmpi/e 0, 0, 32;
35+
%jmp/0xz T_0.0, 4;
36+
%vpi_call 2 33 "$display", "%0t\011%b\0111\011\011PASS", $time, v0x600000d642d0_0 {0 0 0};
37+
%load/vec4 v0x600000d641b0_0;
38+
%addi 1, 0, 32;
39+
%store/vec4 v0x600000d641b0_0, 0, 32;
40+
%jmp T_0.1;
41+
T_0.0 ;
42+
%vpi_call 2 36 "$display", "%0t\011%b\0111\011\011FAIL", $time, v0x600000d642d0_0 {0 0 0};
43+
%pushi/vec4 0, 0, 1;
44+
%store/vec4 v0x600000d64240_0, 0, 1;
45+
T_0.1 ;
46+
%delay 10000, 0;
47+
%load/vec4 v0x600000d642d0_0;
48+
%cmpi/e 0, 0, 1;
49+
%jmp/0xz T_0.2, 4;
50+
%vpi_call 2 43 "$display", "%0t\011%b\0111'b0\011\011PASS", $time, v0x600000d642d0_0 {0 0 0};
51+
%load/vec4 v0x600000d641b0_0;
52+
%addi 1, 0, 32;
53+
%store/vec4 v0x600000d641b0_0, 0, 32;
54+
%jmp T_0.3;
55+
T_0.2 ;
56+
%vpi_call 2 46 "$display", "%0t\011%b\0111'b0\011\011FAIL", $time, v0x600000d642d0_0 {0 0 0};
57+
%pushi/vec4 0, 0, 1;
58+
%store/vec4 v0x600000d64240_0, 0, 1;
59+
T_0.3 ;
60+
%delay 10000, 0;
61+
%load/vec4 v0x600000d642d0_0;
62+
%cmpi/ne 1, 0, 1;
63+
%jmp/0xz T_0.4, 4;
64+
%vpi_call 2 53 "$display", "%0t\011%b\011!1'b0\011\011PASS", $time, v0x600000d642d0_0 {0 0 0};
65+
%load/vec4 v0x600000d641b0_0;
66+
%addi 1, 0, 32;
67+
%store/vec4 v0x600000d641b0_0, 0, 32;
68+
%jmp T_0.5;
69+
T_0.4 ;
70+
%vpi_call 2 56 "$display", "%0t\011%b\011!1'b0\011\011FAIL", $time, v0x600000d642d0_0 {0 0 0};
71+
%pushi/vec4 0, 0, 1;
72+
%store/vec4 v0x600000d64240_0, 0, 1;
73+
T_0.5 ;
74+
%delay 10000, 0;
75+
%load/vec4 v0x600000d642d0_0;
76+
%cmpi/e 0, 0, 1;
77+
%jmp/0xz T_0.6, 6;
78+
%vpi_call 2 63 "$display", "%0t\011%b\011===1'b0\011\011PASS", $time, v0x600000d642d0_0 {0 0 0};
79+
%load/vec4 v0x600000d641b0_0;
80+
%addi 1, 0, 32;
81+
%store/vec4 v0x600000d641b0_0, 0, 32;
82+
%jmp T_0.7;
83+
T_0.6 ;
84+
%vpi_call 2 66 "$display", "%0t\011%b\011===1'b0\011\011FAIL", $time, v0x600000d642d0_0 {0 0 0};
85+
%pushi/vec4 0, 0, 1;
86+
%store/vec4 v0x600000d64240_0, 0, 1;
87+
T_0.7 ;
88+
%delay 10000, 0;
89+
%vpi_call 2 72 "$display", "====================================" {0 0 0};
90+
%vpi_call 2 73 "$display", "Test Summary: %0d/4 tests passed", v0x600000d641b0_0 {0 0 0};
91+
%load/vec4 v0x600000d64240_0;
92+
%flag_set/vec4 8;
93+
%jmp/0xz T_0.8, 8;
94+
%vpi_call 2 75 "$display", "Overall Result: ALL TESTS PASSED" {0 0 0};
95+
%jmp T_0.9;
96+
T_0.8 ;
97+
%vpi_call 2 77 "$display", "Overall Result: SOME TESTS FAILED" {0 0 0};
98+
T_0.9 ;
99+
%vpi_call 2 78 "$display", "====================================" {0 0 0};
100+
%delay 10000, 0;
101+
%vpi_call 2 82 "$finish" {0 0 0};
102+
%end;
103+
.thread T_0;
104+
.scope S_0x14e607320;
105+
T_1 ;
106+
%vpi_call 2 87 "$dumpfile", "top_module_tb.vcd" {0 0 0};
107+
%vpi_call 2 88 "$dumpvars", 32'sb00000000000000000000000000000000, S_0x14e607320 {0 0 0};
108+
%end;
109+
.thread T_1;
110+
# The file index is used to find the file name in the following table.
111+
:file_names 4;
112+
"N/A";
113+
"<interactive>";
114+
"tb_zero.v";
115+
"answer_zero.v";
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
$date
2+
Tue Aug 19 20:03:12 2025
3+
$end
4+
$version
5+
Icarus Verilog
6+
$end
7+
$timescale
8+
1ps
9+
$end
10+
$scope module tb_top_module $end
11+
$var wire 1 ! zero $end
12+
$var reg 1 " test_passed $end
13+
$var integer 32 # num_tests_passed [31:0] $end
14+
$scope module dut $end
15+
$var wire 1 ! zero $end
16+
$upscope $end
17+
$upscope $end
18+
$enddefinitions $end
19+
$comment Show the parameter values. $end
20+
$dumpall
21+
$end
22+
#0
23+
$dumpvars
24+
b0 #
25+
0"
26+
0!
27+
$end
28+
#10000
29+
b1 #
30+
#20000
31+
b10 #
32+
#30000
33+
b11 #
34+
#40000
35+
b100 #
36+
#60000

0 commit comments

Comments
 (0)