HELP: Can i hook non input/output signal to testbench?

Status
Not open for further replies.

akira12345

Newbie level 2
Joined
Mar 28, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
1,303
Hi,

I am using modelsim. I would like to hook up non input/out signal to testbench from design unit.
Example

Design unit:
module design_unit( out1, out2, in1, in2);
input in1, in2;
output reg out1, out2;
.......
reg [5:0] int_reg;
......
endmodule


Testbench unit:
module design_unit_tb();
reg in1, in2;
wire out1, out2;

........

//my problem is how do i make it as below
always @(int_reg) <--- int_reg is not input/output of design unit
.........
endmodule

I would like to capture the int_reg signal and print to text file, but i dont know how to hook out int_reg (reg type) to testbench.

Thanks for your help.
 

You can just use the hierarchical path to any signals to reference it. Assuming the module design_unit is the top-level module (i.e. not instantiated anywhere), then you can do this:

always @(design_unit.int_reg) <--- int_reg is not input/output of design unit


If the module design_unit is instantiated in design_unit_tb as design_unit_inst, for example, then you can do this:

always @(design_unit_tb.design_unit_inst.int_reg) <--- int_reg is not input/output of design unit

- Hung
 

    akira12345

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…