I'm trying to understand how pins should be defined in SystemVerilog.
I have:
- a common
dataBus - a
ramControllermodule which can send or receive data on itsioDatapins. - a top level module which can write to the
ramController(e.g. prepare a display buffer) - a
vgaControllerwhich mostly receives data from theramControllerbut also has a command mode which allows it to be configured using data on thedataBus
The ioData pins in the ramController are bi-directional but also need to be tri-state so that the ramController can be "off the bus" when dataBus is being used to send commands to the vgaController
module RAMController(
inout wire[15 : 0 ] ioData,
..
);
..
logic [15 : 0 ] ioDataCopy;
assign ioData = ( chipSelect ) ? ioDataCopy : 16'hzzzzzzzzzzzzzzzz;
Even if vgaController never writes to the dataBus, does it's pins need to be inout in order to be input or HiZ?
module VGAController(
inout wire [15 : 0 ] iData;
);
..
logic [15 : 0 ] iDataCopy = 0;
assign iData = ( chipSelect ) ? iDataCopy : 16'bzzzzzzzzzzzzzzzz;
Is dataBus simply a set of wire values in the top module?
module Top(
..
);
..
wire [15 : 0 ] dataBus;
I may be going about this completely wrong. Can someone please help me in defining a system containing multiple modules that share the same bus.