interface binding with wrapper - 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

202


47
 
1
`include "uvm_macros.svh"
2
`include "interf_wrapper.sv"
3
4
// TOP MODULE    
5
module top;
6
    
7
  import uvm_pkg::*; 
8
  import interf_pkg::*;
9
  
10
  
11
  logic clk, reset;  
12
  
13
  initial begin
14
    clk = 0;
15
    reset = 1;
16
    repeat(3) @(posedge clk);
17
    reset = 0;
18
    #1000;
19
    foreach(interf_instances[i])
20
      `uvm_info("INTERF INSTANCES", $sformatf("%s", interf_instances[i]), UVM_LOW)
21
    $finish;
22
  end
23
  
24
  always begin
25
    clk = #10 ~clk;
26
  end
27
  
28
  dut #(100) dut_inst1(clk, reset);
29
  dut #(200) dut_inst2(clk, reset);
30
  dut #(300) dut_inst3(clk, reset);
31
  dut #(400) dut_inst4(clk, reset);
32
    
33
  bind dut interf_wrapper if_wrp( // Bind interf_wrapper to all dut instances
34
    .clk(i_clk),
35
    .reset(i_reset),
36
    .en(o_en),
37
    .data(o_data),
38
    .out(o_out)  
39
  );
40
  
41
  //Dump waves
42
  initial begin
43
    $dumpfile("dump.vcd");
44
    $dumpvars(0, top);
45
  end
46
  
47
endmodule
xxxxxxxxxx
1
44
 
1
`include "interf_pkg.sv"
2
import interf_pkg::*;
3
4
interface interf(
5
  
6
  input logic clk, 
7
  input logic reset, 
8
  input logic en,
9
  input logic [7:0] data,
10
  input logic out);
11
  
12
  string interf_name =  $sformatf("%m");    
13
  
14
  //Every time that interf is instantiated, the name will be added to a queue
15
  initial begin
16
    interf_instances.push_back(interf_name);
17
  end
18
19
endinterface
20
21
///////////////////////////////////////////////////////////////////
22
module dut#(parameter MAX_RANGE = 100) (
23
  
24
  input logic i_clk, 
25
  input logic i_reset, 
26
  output logic o_en,
27
  output logic [7:0] o_data,
28
  output logic o_out);
29
  
30
  always @(posedge i_reset) begin
31
      o_out <= 0; 
32
      o_en <= 0;
33
      o_data <= 0;
34
  end
35
  
36
  always @(posedge i_clk) begin 
37
    if(!i_reset) begin
38
      o_out <= o_en; 
39
      o_en <= $urandom_range(0,1);
40
      o_data <= $urandom_range(0,MAX_RANGE);
41
    end
42
  end
43
  
44
endmodule
659 views and 0 likes     
 
How to use bind and wrapper to connect to module in design.
How to set that interface to config db for further manipulation.

How to use bind and wrapper to connect to module in design.
How to set that interface to config db for further manipulation.

2230:0