Sorry I am not an expert with Verilog. I come from a software background.
I have RAM sharer/multiplexer that I am creating which can take "command requests" from 3 different sources (1. VGA controller, 2. Blitter, 3. External CPU). Each source gets a "slice" of time to communicate with an SRAM chip.
Rather than having if conditions everywhere, is there any way in which I can switch some wires to act like C pointers?
For example, I have the following 3 outputs:
bit [DATA_WIDTH-1 : 0 ] vgaCommandData
bit [DATA_WIDTH-1 : 0 ] bltCommandData
bit [DATA_WIDTH-1 : 0 ] cpuCommandData
Is there any way I can point something to one of these 3 buses so that my RAM controller just does a read to a "currentCommandData" bus that maps to one of the above 3 buses?
I don't want to do this:
if( sliceOwner == SLICE_VGA )
begin
vgaCommandData <= blah;
end
else
if( sliceOwner == SLICE_BLT )
begin
bltCommandData <= blah;
end
else
if( sliceOwner == SLICE_CPU )
begin
cpuCommandData <= blah;
end
This may be fine once, but I'm trying to avoid repeating these 3 conditions everywhere. Ideally I would like to have one statement that does something like this:
if( sliceOwner == SLICE_VGA )
begin
use vgaCommandData when currentCommandData is read/assigned
end
else
if( sliceOwner == SLICE_BLT )
begin
use bltCommandData when currentCommandData is read/assigned
end
else
if( sliceOwner == SLICE_CPU )
begin
use cpuCommandData when currentCommandData is read/assigned
end
....
currentCommandData <= blah;
I realise I can have a temporary currentCommandData value and then add a condition to copy it back into the respective bus but that's not what I am after.
Perhaps what I want cannot be done but I welcome suggestions.