cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
atdheu
Visitor
Visitor
8,507 Views
Registered: ‎05-30-2013

ROM content - Xilinx Platform Studio

Jump to solution

Hi

 

For my project, i need to implement a ROM component that stores routing order information. I have "designed" the ROM from ISE example in such a way that the ROM size can be increased depending on the size of the table order it needs to store.

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity ROM is
generic(
	ADDR_BITS : integer :=3;
	BITS : integer :=3
);
port(
		CLK   		: in  std_logic;
		EN  			: in  std_logic;
		ADDR		: in std_logic_vector(ADDR_BITS-1 downto 0);
		DATA			: out std_logic_vector(BITS-1 downto 0)
   );
end ROM;

architecture rtl of ROM is
	type rom_type is array (0 to 2**ADDR_BITS-1) of std_logic_vector(BITS-1 downto 0);
	signal ROM : rom_type :=
	(
	"000", "001", "010", "011","100","101","110","111"	--0,1,2,3,4,5,6,7   the routing order
	);    
			
	signal rdata 	: std_logic_vector(BITS-1 downto 0);
	
begin
	rdata 	<= ROM(conv_integer(ADDR));
	
	process (CLK)
		 begin
		  if (CLK'event and CLK = '1') then
		 	if (EN = '1') then
			 DATA <= rdata;
			end if;
		  end if;
	 end process;
end rtl;

 

On Xilinx Platform Studio (XPS), i generated the IP design and the following MPD file is what "describes" the ROM :

BEGIN ROM

## Peripheral Options
OPTION IPTYPE = PERIPHERAL
OPTION IMP_NETLIST = TRUE
OPTION HDL = MIXED
OPTION IP_GROUP = USER


## Bus Interfaces

## Generics for VHDL or Parameters for Verilog
PARAMETER ADDR_BITS = 3, DT = INTEGER
PARAMETER BITS = 3, DT = INTEGER

## Ports
PORT CLK = "", DIR = I
PORT EN = "", DIR = I
PORT ADDR = "", DIR = I, VEC = [(ADDR_BITS-1):0], ENDIAN = LITTLE
PORT DATA = "", DIR = O, VEC = [(BITS-1):0], ENDIAN = LITTLE

END

 

The problem that i can't figure out is how to code the ROM (both the vhd and the mpd)  in such a way that when on XPS i need to add 2 or more instances of the same ROM, i can change the content of the ROMs...there will be cases when i need more than 1 instance and the content is not the same, both length and order. F.ex. lets say i need 2 ROMs, the first one will have an addr size of 8, thus i need to enter 8 different values (values can be either int, std_logic_vector) and the second ROM will have an addr_size of 14. In the vhd example above i have hardcoded the values for testing purposes, but they need to be defined when i add the ROM(s) on XPS.

 

 

For the project purposes is enough if i have to enter the content manually everytime i add an instance of ROM, so if anyone can help or have suggestions pls let me know ASAP.

0 Kudos
Reply
1 Solution

Accepted Solutions
gszakacs
Professor
Professor
13,859 Views
Registered: ‎08-14-2007

If the ROM's don't have the same contents, then you'd need to make the contents selected by generics.  One way to do this is to use an external file holding the ROM contents and then having a generic that provides the file name for each instance.  The XST user guide has examples of using external data files to initialize the ROM contents.

 

You other approach is to have multiple copies of (almost) the same code, each with a different name and different contents.

-- Gabor

View solution in original post

0 Kudos
Reply
2 Replies
gszakacs
Professor
Professor
13,860 Views
Registered: ‎08-14-2007

If the ROM's don't have the same contents, then you'd need to make the contents selected by generics.  One way to do this is to use an external file holding the ROM contents and then having a generic that provides the file name for each instance.  The XST user guide has examples of using external data files to initialize the ROM contents.

 

You other approach is to have multiple copies of (almost) the same code, each with a different name and different contents.

-- Gabor

View solution in original post

0 Kudos
Reply
atdheu
Visitor
Visitor
8,482 Views
Registered: ‎05-30-2013

Thnx for the tips Gabor, it worked.

 

I used the external file option to provide the content everytime a ROM with different addr_width  is needed.

 

 

0 Kudos
Reply