M
mrfirmware
Guest
I've written my testbench in SV to verify a Verilog RTL design. There
is a simple bus that I use to communicate with the design. The design
drives the clock for this bus. I've written an interface for my side
(testbench) to keep things neat. In my "null modem" module, I cross-
wire the designs bus signals to my testbench's bus signals. However,
my tool is complaining that I cannot drive a modport input with the
design's output signal. I can't figure out what I'm doing wrong.
Here's a simple demo of my problem.
interface bus_if;
logic clock;
modport mst (output clock);
modport slv(input clock);
endinterface
module verilog_rtl;
reg clock; /* not module output for various reasons */
/* drive clock at some freq */
endmodule
module sv_tb(bus_if.slv bus);
assign bus.clock = verilog_rtl.clock;
/* use design's clock as bus.clock now */
endmodule : sv_tb
module sv_top;
bus_if bus();
sv_tb tb(bus);
verilog_rtl rtl();
endmodule : sv_top
The tools says something to the effect of modport port cannot be
driven, port "clock" of modport "slv" has been restricted as input
port. Input ports cannot be driven. However, I think my tb is slaving
off the design's clock so I figured I should use the slv modport. What
don't I get here?
Thanks,
- Mark
is a simple bus that I use to communicate with the design. The design
drives the clock for this bus. I've written an interface for my side
(testbench) to keep things neat. In my "null modem" module, I cross-
wire the designs bus signals to my testbench's bus signals. However,
my tool is complaining that I cannot drive a modport input with the
design's output signal. I can't figure out what I'm doing wrong.
Here's a simple demo of my problem.
interface bus_if;
logic clock;
modport mst (output clock);
modport slv(input clock);
endinterface
module verilog_rtl;
reg clock; /* not module output for various reasons */
/* drive clock at some freq */
endmodule
module sv_tb(bus_if.slv bus);
assign bus.clock = verilog_rtl.clock;
/* use design's clock as bus.clock now */
endmodule : sv_tb
module sv_top;
bus_if bus();
sv_tb tb(bus);
verilog_rtl rtl();
endmodule : sv_top
The tools says something to the effect of modport port cannot be
driven, port "clock" of modport "slv" has been restricted as input
port. Input ports cannot be driven. However, I think my tb is slaving
off the design's clock so I figured I should use the slv modport. What
don't I get here?
Thanks,
- Mark