Guest
Hi,
I am working on a microcoded CPU for a FPGA. I intend to use a RAM
core for my microcode, which has a std_logic_vector as data output. My
microcode consists of bit fields, and in order to access the fields by
name I defined a record:
type microinstruction is
record
read_sel : std_logic_vector(4 downto 0);
write_sel : std_logic_vector(4 downto 0);
alu : std_logic_vector(3 downto 0);
....
Now I am looking for a construct to map the output of my microcode ROM
(which is a std_logic_vector) to this record layout. I have thought
about using a conversion function, but the problem with that approach
is that I would have to replicate the record layout in the conversion
function in order to map the correct bits to the fields of the
microinstruction. So my question is: Is there something similar to a
C union that would automatically re-map the std_logic_vector that comes
out of my ROM to the microinstruction record format, without having to
maintain the instruction layout in both the record definition and a
conversion function?
Any advice would be greatly appreciated.
Thanks,
Hans
I am working on a microcoded CPU for a FPGA. I intend to use a RAM
core for my microcode, which has a std_logic_vector as data output. My
microcode consists of bit fields, and in order to access the fields by
name I defined a record:
type microinstruction is
record
read_sel : std_logic_vector(4 downto 0);
write_sel : std_logic_vector(4 downto 0);
alu : std_logic_vector(3 downto 0);
....
Now I am looking for a construct to map the output of my microcode ROM
(which is a std_logic_vector) to this record layout. I have thought
about using a conversion function, but the problem with that approach
is that I would have to replicate the record layout in the conversion
function in order to map the correct bits to the fields of the
microinstruction. So my question is: Is there something similar to a
C union that would automatically re-map the std_logic_vector that comes
out of my ROM to the microinstruction record format, without having to
maintain the instruction layout in both the record definition and a
conversion function?
Any advice would be greatly appreciated.
Thanks,
Hans