summaryrefslogtreecommitdiff
path: root/midterm/SRC/tb.sv
blob: 2d1708440eb7778c751778e961d3405776067a63 (plain) (blame)
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
`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