Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Reading data from a ROM

I have created a ROM-1port via the MegaWizard which also has a .mif file and in my top level entity I have to instantiate that rom, but I don't know how to access the data from it.

My .mif file is this:


WIDTH=8;
DEPTH=2;
ADDRESS_RADIX=UNS;
DATA_RADIX=UNS;
CONTENT BEGIN
	0  :   14;
	1  :   21;
END;

And the rom component is:


component rom_int
port
(
	address	: in  std_logic_vector(4 downto 0);
	clock	: in  std_logic  := '1';
	q	: out std_logic_vector(15 downto 0)
);
	end component;

I actually wanted an address with only 2 positions but you can't on the megawizard and quartus fills the rest with zeros.

Anyway, so I have to send 2 adresses to the rom so it returns me the output data, and each adress is 8 bits and the output is 16 bits (0000 1110 0001 0101 (14 21)).

How do I write the code for the 2 adresses for the instantiation?

11 Replies