I have to drive internal signals of dut from the uvm driver.without using “force”, I read in some article that bind can be used. I did bind in my top module. Tried making that instance as virtual using uvm_configdb::set.But I am not able to do that. is it because of any syntax error?Please help
Why can’t you use a force statement? Depending on your design, using a bind may or may not work. If the signal that you are connecting to has other drivers, bind will only act as another driver which may result in ‘X’ values. Using a force will ensure that only the signal from your interface will be driven to the DUT signal.
Your problem is the hierarchical path in the uvm_config_db.
Is it correct the internal signal you want to set is part of your SV interface instancee in0?
If so you do not need an additional interface instance.
With the bind construct you have 2 options:
(1) binding to a design in your DUT
(2) binding to a certain instance in your DUT.
In case (1) you do not need to define an hierarchical path. In case (2) you have to specify the hierarchical path to the instance.
Regardless of whether what you’re trying to do is the best way of meeting your requirements (I think maybe :-)), from an SV/UVM perspective, you should probably be able to get it running.
So, in my scenario,it will be
serial_write in0(clk); // interface instance
cpu_write DUT(.clk(clk),.reset(in0.reset), .enable(in0.enable), .sin(in0.sin),.addr(in0.addr),.data(in0.data),.count(in0.count));
" bind cpu_write cpu_if b0(en)";
I checked it also,but getting same error:undefined variable b0
Your posts make it seem that you have some misunderstandings about what bind is used for.
It looks like you have an interface ‘serial_write’, which you instantiate at the top level of your testbench as ‘in0’.
Your DUT ‘cpu_write’ is instantiated in your testbench as ‘DUT’ and the ports are connected to the internal signals of the interface ‘in0’.
It then looks like you are trying to bind another instance of ‘serial_write’ inside the DUT? Is this correct? If you already have an instance of ‘serial_write’ at the top level, why do you want another instance inside of the DUT?
Perhaps if you can clearly describe what you want to accomplish along with posting a complete example that can be compiled and run, we can provide further assistance.