A
Asm4PIC
Guest
i wrote this code:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
--
ENTITY ram_asynch IS
GENERIC (d_width : natural := 8;
a_width : natural := 8);
PORT(data_in : IN unsigned(d_width-1 DOWNTO 0);
wr_en : IN std_logic;
address : IN unsigned(a_width-1 DOWNTO 0);
data_out : OUT unsigned(d_width-1 DOWNTO 0));
END ENTITY ram_asynch;
--
ARCHITECTURE Arch OF ram_asynch IS
SUBTYPE byte IS unsigned(d_width-1 DOWNTO 0);
TYPE mem_type IS ARRAY (natural RANGE <> OF byte;
BEGIN
asynch : PROCESS(wr_en,data_in,address)
VARIABLE mem : mem_type(0 TO 2**a_width-1);
ATTRIBUTE ram_block : boolean;
ATTRIBUTE ram_block OF mem : VARIABLE IS TRUE;
BEGIN
IF (wr_en = '1') THEN
mem(to_integer(address)) := data_in;
END IF;
data_out <= mem(to_integer(address));
END PROCESS asynch;
END ARCHITECTURE Arch;
and the synthesis tool generates this report
# Resource Used Avail Utilization
# -----------------------------------------------
# IOs 25 86 29.07%
# Global Buffers 0 4 0.00%
# Function Generators 3143 384 818.49%
# CLB Slices 1572 192 818.75%
# Dffs or Latches 2048 672 304.76%
# Block RAMs 0 4 0.00%
How to force the synthesis tool to use Block RAMs instead of DFFs to
implement internal memory
thanx
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
--
ENTITY ram_asynch IS
GENERIC (d_width : natural := 8;
a_width : natural := 8);
PORT(data_in : IN unsigned(d_width-1 DOWNTO 0);
wr_en : IN std_logic;
address : IN unsigned(a_width-1 DOWNTO 0);
data_out : OUT unsigned(d_width-1 DOWNTO 0));
END ENTITY ram_asynch;
--
ARCHITECTURE Arch OF ram_asynch IS
SUBTYPE byte IS unsigned(d_width-1 DOWNTO 0);
TYPE mem_type IS ARRAY (natural RANGE <> OF byte;
BEGIN
asynch : PROCESS(wr_en,data_in,address)
VARIABLE mem : mem_type(0 TO 2**a_width-1);
ATTRIBUTE ram_block : boolean;
ATTRIBUTE ram_block OF mem : VARIABLE IS TRUE;
BEGIN
IF (wr_en = '1') THEN
mem(to_integer(address)) := data_in;
END IF;
data_out <= mem(to_integer(address));
END PROCESS asynch;
END ARCHITECTURE Arch;
and the synthesis tool generates this report
# Resource Used Avail Utilization
# -----------------------------------------------
# IOs 25 86 29.07%
# Global Buffers 0 4 0.00%
# Function Generators 3143 384 818.49%
# CLB Slices 1572 192 818.75%
# Dffs or Latches 2048 672 304.76%
# Block RAMs 0 4 0.00%
How to force the synthesis tool to use Block RAMs instead of DFFs to
implement internal memory
thanx