Verilog/Sysverilog Test Bench Question

Status
Not open for further replies.

Digital-L0gik

Member level 2
Joined
Jan 26, 2009
Messages
44
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,288
Activity points
1,577
how to access register from testbench

I am writing a test bench for a DUT I designed. However, I would like to use some flag signals that are within the DUT hierarchy at the test bench level to kick off some testing procedures. These flag signals are not part of my primary i/o to the DUT. How can I utilize these lower level DUT signals in my higher level test bench?
 

testbench for register file in verilog

If you want to use the rtl signal that does not come out on the pin. you should access it hierarchically in the testbench.
 

Yeah I heard about doing that, but I am not sure what the syntax is do that. Is this how you do it? Will this also work for signals that are even lower than the dut?

Code:
module y(...);
.....
reg flag1;


endmodule: y
 

module x(...);
.....
reg flag2;

y  i1  (....)  //instantiate y

endmodule: x

//--------------------------------------------
module xtb();
x  i ( ....);   //instantiate dut.

always @(i.flag2 or i.i1.flag1)
case(i.flag)
....


endmodule: xtb
 

just like the common usage in SV , you can get the signal in the design !
 

For example if you have testbench file as top.v where u instantiated dut and in that dut u want to access a register x in the block blka

then u need to use top.dut.blka.x (u can use force n release to change irrespective what its driven to x)

hope this helps in clear understanding
 
hi pra, i agree with your point. but i think that kind of expression can only apply for verilog.

wut should be used for vhdl? i know in ncsim you can use some special function, but it can only be recognized with ncverilog.


 

I am not confident on VHDL but I feel same will be there in that otherwise it becomes very tough to verify large designs in VHDL.
Lot of EDA companies will use VHDL for their designs too...
May be somebody who r expert in VHDL can tell you about this


 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…