On Jun 13, 11:45*pm, Mike Treseler <mtrese...@gmail.com> wrote:
> Cesar wrote:
> > I've employed RTL viewer from Xilinx ISE 11.4 to check out the
> > synthesis results and I've discovered that there is a problem
> > inferring a block-RAM.
> > I only read the block-RAM (ROM).
>
> If all you need is a rom, consider somthing like this.http://mysite.verizon.net/miketreseler/sync_rom.vhd
>
> > When reading, a block-RAM should
> > latch-in the address in the active clock edge and, after Tco, the data
> > should be output at DO. Synchronously speaking, reading the block-RAM
> > should imply one clock period delay.
> > When inferring the block-RAM in 'one-process' style, XST automatically
> > and always add a register for the address input and a register for the
> > data output (independently of the VHDL code you have).
>
> Here's a template for a block ram that works for brand A.
> It might work for X also.
>
> http://mysite.verizon.net/miketreseler/block_ram.vhd
I finally made it work properly. At first, I was trying to infer the
blockRAM as a ROM from a single VHDL module (the single-process
module). I made it like this:
p_main: process(clk)
type rom_t is array(0 to 2**NR_BITS_ADDR - 1) of
std_logic_vector(NR_BITS_DATA - 1 downto 0);
constant rom_c: rom_t := // ... (read from a file)
variable data_read_v: unsigned(NR_BITS_DATA - 1 downto 0);
variable addr_read_v: std_logic_vector(NR_BITS_ADDR - 1 downto 0);
procedure update_regs is
begin
// ...
data_read_v := rom_c(addr_read_v); // USE addr_read_v before
updating it (since blocRAM is registered)
// ...
addr_read_v := addr_read_v + 1; // UPDATE addr_read_v after
using it
// ...
end procedure update_regs;
begin
if rising_edge(clk) then
if rst = '1' then
init_regs;
else
update_regs;
end if;
end if;
update_ports;
end process p_main;
Logic simulation with Modelsim was ok, but post-synthesis simulation
(ISE) added and additional registering stage.
Then, I tried to infer the blockRAM (ROM) from an independent VHDL
module following the template suggested by Mike. At first it did not
work because of my fault. I did not take into consideration the
additional register stage added when the addr_read_v goes out to a
port from the 'one-process style' module towards the blockRAM module.
After debugging that, I worked ok.
Thank you all for your help,
César