A
Andrew FPGA
Guest
Hi,
We are verifying a VHDL DUT using System Verilog. We attach the class
based testbench hierarchy to the DUT via SV interfaces (virtual
interfaces) in the standard way. However, we have not figured out how
to model a bus with multiple drivers from procedural code?
Below is what we currently do for a cpu bus. The data bus must be
declared of type wire, because it can have multiple drivers. The DUT
drives data directly, but the class based testbench hierarchy can only
procedurally assign, hence the TB writes to bup_data_from_task
variable, which is then continuously assigned to data within the SV
interface. This works, but it does not work as expected for multiple
bus masters in the class based testbench. We get last assignment
"wins" behaviour i.e. whichever task/class assigned to
bup_data_from_task gets driven onto the bus. When really a proper
model would allow the TB to have multiple drivers and then a
conflicted state on the bus.
There must be a way to model tristate/multiple TB drivers in System
Verilog using SV interfaces? But we havn't figured it out yet... Any
ideas on how to do this?
interface cpu_bus_if();
wire[7:0] data; //dut bup_data port is of inout type, so can
have multiple drivers. Thus must be wire type, not logic.
logic[10:0] addr = 0;
...
logic [7:0] bup_data_from_task = 8'bz;
assign data = bup_data_from_task;
endinterface : cpu_bus_if
Cheers
Andrew
We are verifying a VHDL DUT using System Verilog. We attach the class
based testbench hierarchy to the DUT via SV interfaces (virtual
interfaces) in the standard way. However, we have not figured out how
to model a bus with multiple drivers from procedural code?
Below is what we currently do for a cpu bus. The data bus must be
declared of type wire, because it can have multiple drivers. The DUT
drives data directly, but the class based testbench hierarchy can only
procedurally assign, hence the TB writes to bup_data_from_task
variable, which is then continuously assigned to data within the SV
interface. This works, but it does not work as expected for multiple
bus masters in the class based testbench. We get last assignment
"wins" behaviour i.e. whichever task/class assigned to
bup_data_from_task gets driven onto the bus. When really a proper
model would allow the TB to have multiple drivers and then a
conflicted state on the bus.
There must be a way to model tristate/multiple TB drivers in System
Verilog using SV interfaces? But we havn't figured it out yet... Any
ideas on how to do this?
interface cpu_bus_if();
wire[7:0] data; //dut bup_data port is of inout type, so can
have multiple drivers. Thus must be wire type, not logic.
logic[10:0] addr = 0;
...
logic [7:0] bup_data_from_task = 8'bz;
assign data = bup_data_from_task;
endinterface : cpu_bus_if
Cheers
Andrew