bind - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

206


41
 
1
module Test (input bit[7:0] Addr, Data);
2
3
  initial
4
    #100 $stop;
5
6
endmodule
7
8
9
module CheckAddr (input clk, bit[7:0] Addr, Max);
10
  default clocking cb @(posedge clk); endclocking
11
    A1: assert property (Addr <= Max)
12
        else $error("Address is out of range");
13
endmodule
14
15
      
16
module DUT_TB;
17
  bit[7:0] Addr, Data;
18
  bit clk;
19
20
  assign #5 clk = (clk == 1'b1 ? 1'b0 : 1'b1);
21
  assign #10 Addr = Addr + 1;
22
  
23
  DUT dut_inst (clk, Addr, Data);
24
25
  // Binds an instance of the module Test to the testbench
26
  bind DUT_TB Test Test_inst(Addr, Data);
27
28
  // Binds an instance of the module CheckAddr to the DUT instance
29
  bind DUT_TB.dut_inst CheckAddr CA_inst1(clk, Addr, Data);
30
31
  // Alternative syntax for the above
32
  bind DUT: dut_inst CheckAddr CA_inst2(clk, Addr, Data);
33
34
35
  // Dump waves
36
  initial begin
37
    $dumpfile("dump.vcd");
38
    $dumpvars(1, DUT_TB.dut_inst);
39
  end
40
  
41
endmodule
xxxxxxxxxx
1
 
1
module DUT (input clk, bit[7:0] Addr,
2
            output     bit[7:0] Data);
3
4
  always @(posedge clk)
5
  begin
6
    Data = Addr + 1;
7
  end
8
9
endmodule
94 views and 0 likes     
 
Complete SystemVerilog example for bind topic.

Complete SystemVerilog example for bind topic.

160:0