summaryrefslogtreecommitdiff
path: root/midterm/SRC/tb.sv
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-19 17:24:08 -0800
committerFuwn <[email protected]>2026-02-19 17:24:08 -0800
commitf274b789abea8b783afc0296648dc02ff8f0709e (patch)
treedb6423b93d9703ffc263d8a640641d531c57ec43 /midterm/SRC/tb.sv
parentfeat(midterm): Add instructions (diff)
downloadcst456-f274b789abea8b783afc0296648dc02ff8f0709e.tar.xz
cst456-f274b789abea8b783afc0296648dc02ff8f0709e.zip
feat(midterm): Add implementation
Diffstat (limited to 'midterm/SRC/tb.sv')
-rw-r--r--midterm/SRC/tb.sv48
1 files changed, 48 insertions, 0 deletions
diff --git a/midterm/SRC/tb.sv b/midterm/SRC/tb.sv
new file mode 100644
index 0000000..2d17084
--- /dev/null
+++ b/midterm/SRC/tb.sv
@@ -0,0 +1,48 @@
+`include "macro.svh"
+`include "typedef_pkg.sv"
+`include "interface.sv"
+`include "transaction.sv"
+`include "scoreboard_monitor.sv"
+`include "bfm.sv"
+
+module tb;
+ localparam int TOTAL_TESTS = 4 * 256 * 256;
+
+ logic clk = 1'b0;
+
+ intf intf0 (.clk(clk));
+
+ transaction tr_drv;
+ transaction tr_mon;
+ bfm bfm0;
+ scoreboard_monitor sb_mon0;
+
+ duv ALU0 (
+ .clk(intf0.clk),
+ .op_start(intf0.op_start),
+ .operation(intf0.operation),
+ .operand_a(intf0.operand_a),
+ .operand_b(intf0.operand_b),
+ .result(intf0.result)
+ );
+
+ always #1ns clk = ~clk;
+
+ initial begin
+ tr_drv = new();
+ tr_mon = new();
+ bfm0 = new(intf0, tr_drv);
+ sb_mon0 = new();
+ sb_mon0.alu_if = intf0;
+ sb_mon0.tr = tr_mon;
+
+ fork
+ bfm0.drive();
+ sb_mon0.check();
+ join
+
+ $display("All tests passed! Total tests: %0d", TOTAL_TESTS);
+ $display("Finished Successfully!");
+ $finish;
+ end
+endmodule : tb