ROM initialization file

B

blakaxe@gmail.com

Guest
I have instantiated a ROM in Verilog.
databus = 40 bits
address lines = 7

now i want to initialize it for simulation in VCS.

I use

initial
begin
$readmemh("single_port_rom_init.txt", rom);
end
end

How should I format the initialization file
(single_port_rom_init.txt)?

Should it just be a file with hex numbers with/without spaces?
How does it assign the numbers to the ROM? Is is from the lsb of the
first address line?

Thanks
 
On Jul 11, 5:50 am, "blak...@gmail.com" <blak...@gmail.com> wrote:
I have instantiated a ROM in Verilog.
databus = 40 bits
address lines = 7

now i want to initialize it for simulation in VCS.

I use

initial
begin
$readmemh("single_port_rom_init.txt", rom);
end
end

How should I format the initialization file
(single_port_rom_init.txt)?

Should it just be a file with hex numbers with/without spaces?
How does it assign the numbers to the ROM? Is is from the lsb of the
first address line?

Thanks
The readmemh file is a single location entry per line, in hex. In
your case, 10 characters per line, 128 lines.

The data format is how you defined the bus. If it's data[39:0], then
the bits 39:36 are on the left.

Google for 'readmemh file format' - I found a couple of examples quite
quickly.
 
LittleAlex wrote:
On Jul 11, 5:50 am, "blak...@gmail.com" <blak...@gmail.com> wrote:
I have instantiated a ROM in Verilog.
databus = 40 bits
address lines = 7

now i want to initialize it for simulation in VCS.

I use

initial
begin
$readmemh("single_port_rom_init.txt", rom);
end
end

How should I format the initialization file
(single_port_rom_init.txt)?

Should it just be a file with hex numbers with/without spaces?
How does it assign the numbers to the ROM? Is is from the lsb of the
first address line?

Thanks

The readmemh file is a single location entry per line, in hex. In
your case, 10 characters per line, 128 lines.

The data format is how you defined the bus. If it's data[39:0], then
the bits 39:36 are on the left.

Google for 'readmemh file format' - I found a couple of examples quite
quickly.
You don't need a single entry per line. All whitespace is ignored. You
can cram all the data together if you want. You can also put in
comments (line and inline). You can use 'x', 'z', and '_' in your hex
numbers. It's helpful if you can make the rom width a multiple of 4 so
hex digits don't span rom locations. You can also specify the start and
end location for the load; otherwise loading starts at the lowest rom
address. -Kevin
 
Kevin Neilson wrote:

LittleAlex wrote:
On Jul 11, 5:50 am, "blak...@gmail.com" <blak...@gmail.com> wrote:
I have instantiated a ROM in Verilog.
databus = 40 bits
address lines = 7

now i want to initialize it for simulation in VCS.

I use

initial
begin
$readmemh("single_port_rom_init.txt", rom);
end
end

How should I format the initialization file
(single_port_rom_init.txt)?

Should it just be a file with hex numbers with/without spaces?
How does it assign the numbers to the ROM? Is is from the lsb of the
first address line?

Thanks

The readmemh file is a single location entry per line, in hex. In
your case, 10 characters per line, 128 lines.

The data format is how you defined the bus. If it's data[39:0], then
the bits 39:36 are on the left.

Google for 'readmemh file format' - I found a couple of examples quite
quickly.

You don't need a single entry per line. All whitespace is ignored. You
can cram all the data together if you want. You can also put in
comments (line and inline). You can use 'x', 'z', and '_' in your hex
numbers. It's helpful if you can make the rom width a multiple of 4 so
hex digits don't span rom locations. You can also specify the start and
end location for the load; otherwise loading starts at the lowest rom
address. -Kevin
At least for XST this isn't true.. I couldn't put anything except one value
per line (no comments!) otherwise XST would complain that the init wasn't
complete and would ignore it(!)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
 

Welcome to EDABoard.com

Sponsor

Back
Top