Hi,
I am using Xilinx's ISE Webpack software to make a FIR filter. I have already designed the memory control module and the ROM module to store my coefficients. I was able to initialise the ROM using a series of signal statements. However, my filter design uses a RAM to store the incoming samples and to test my memory control module i would like to initialize the RAM with some known values.
At first i tried this using the same series of signal assignments i used with the ROM. This was to no avail as when i simulate the RAM's testbench in modelsim it tells me the values within the RAM are uninitialized. (UUUUUUUU). I do not know why the signal assignment method did not work since it worked with the ROM.
I also tried the write values to the ROM and verify that they were written using the waveforms in the testbench but that method gives me the same unitialized array as before.
Can someone help me please? Below is my code for the ROM and then for the RAM.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rom is
port (
MASTER_CLOCK : in std_logic;
ROM_ADRESS_IN : in std_logic_vector(6 downto 0);
COEFFICIENT_OUT : out std_logic_vector(15 downto 0));
end rom;
architecture syn3 of rom is
type rom_type is array (63 downto 0) of std_logic_vector (15 downto 0);
signal ROM : rom_type;
signal read_add : std_logic_vector(6 downto 0);
begin
ROM(0) <= "0000000000000001";
ROM(1) <= "0000000000000010";
ROM(2) <= "0000000000000011";
ROM(3) <= "0000000000000100";
ROM(4) <= "0000000000000101";
ROM(5) <= "0000000000000110";
ROM(6) <= "0000000000000111";
ROM(7) <= "0000000000001000";
ROM(8) <= "0000000000001001";
ROM(9) <= "0000000000001010";
ROM(10) <= "0000000000001011";
ROM(11) <= "0000000000001100";
ROM(12) <= "0000000000001101";
ROM(13) <= "0000000000001110";
ROM(14) <= "0000000000001111";
--ROM(15) <= "0000000000001111";
ROM(15) <= "0000000000010000";
ROM(16) <= "0000000000010001";
ROM(17) <= "0000000000010010";
ROM(18) <= "0000000000010011";
ROM(19) <= "0000000000010100";
ROM(20) <= "0000000000010101";
ROM(21) <= "0000000000010110";
ROM(22) <= "0000000000010111";
ROM(23) <= "0000000000011000";
ROM(24) <= "0000000000011001";
ROM(25) <= "0000000000011010";
ROM(26) <= "0000000000011011";
ROM(27) <= "0000000000011100";
ROM(28) <= "0000000000011101";
ROM(29) <= "0000000000011110";
ROM(30) <= "0000000000011111";
ROM(31) <= "0000000000100000";
ROM(32) <= "0000000000100001";
ROM(33) <= "0000000000100010";
ROM(34) <= "0000000000100011";
ROM(35) <= "0000000000100100";
ROM(36) <= "0000000000100101";
ROM(37) <= "0000000000100110";
ROM(38) <= "0000000000100111";
ROM(39) <= "0000000000101000";
ROM(40) <= "0000000000101001";
ROM(41) <= "0000000000101010";
ROM(42) <= "0000000000101011";
ROM(43) <= "0000000000101100";
ROM(44) <= "0000000000101101";
ROM(45) <= "0000000000101110";
ROM(46) <= "0000000000101111";
ROM(47) <= "0000000000110000";
ROM(48) <= "0000000000110001";
ROM(49) <= "0000000000110010";
ROM(50) <= "0000000000110011";
ROM(51) <= "0000000000110100";
ROM(52) <= "0000000000110101";
ROM(53) <= "0000000000110110";
ROM(54) <= "0000000000110111";
ROM(55) <= "0000000000111000";
ROM(56) <= "0000000000111001";
ROM(57) <= "0000000000111010";
ROM(58) <= "0000000000111011";
ROM(59) <= "0000000000111100";
ROM(60) <= "0000000000111101";
ROM(61) <= "0000000000111110";
ROM(62) <= "0000000000111111";
ROM(63) <= "0000000001000000";
process (MASTER_CLOCK)
begin
if( MASTER_CLOCK'event and MASTER_CLOCK = '1' ) then
read_add <= ROM_ADRESS_IN;
COEFFICIENT_OUT <= ROM(conv_integer(ROM_ADRESS_IN));
end if;
end process;
end syn3;
-----------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ram1 is
port (MASTER_CLOCK : in std_logic;
WRITE_EN_1 : in std_logic;
RAM_1_ADRESS : in std_logic_vector(5 downto 0);
SAMPLE_IN_1 : in std_logic_vector(7 downto 0);
SAMPLE_OUT_1 : out std_logic_vector(7 downto 0));
end ram1;
architecture syn of ram1 is
type ram_1_type is array (31 downto 0) of std_logic_vector (7 downto 0);
signal RAM : ram_1_type;
signal read_add : std_logic_vector(5 downto 0);
begin
RAM(0) <= "00000001";
RAM(1) <= "00000010";
RAM(2) <= "00000011";
RAM(3) <= "00000100";
RAM(4) <= "00000101";
RAM(5) <= "00000110";
RAM(6) <= "00000111";
RAM(7) <= "00001000";
RAM(8) <= "00001001";
RAM(9) <= "00001010";
RAM(10) <= "00001011";
RAM(11) <= "00001100";
RAM(12) <= "00001101";
RAM(13) <= "00001110";
RAM(14) <= "00001111";
RAM(15) <= "00010000";
RAM(16) <= "00010001";
RAM(17) <= "00010010";
RAM(18) <= "00010011";
RAM(19) <= "00010100";
RAM(20) <= "00010101";
RAM(21) <= "00010110";
RAM(22) <= "00010111";
RAM(23) <= "00011000";
RAM(24) <= "00011001";
RAM(25) <= "00011010";
RAM(26) <= "00011011";
RAM(27) <= "00011100";
RAM(28) <= "00011101";
RAM(29) <= "00011110";
RAM(30) <= "00011111";
RAM(31) <= "00100000";
process (MASTER_CLOCK)
begin
if( MASTER_CLOCK'event and MASTER_CLOCK = '1') then
if (WRITE_EN_1 = '1') then
RAM(conv_integer(RAM_1_ADRESS)) <= SAMPLE_IN_1;
end if;
read_add <= RAM_1_ADRESS;
SAMPLE_OUT_1 <= RAM(conv_integer(RAM_1_ADRESS));
end if;
end process;
end syn;
I am using Xilinx's ISE Webpack software to make a FIR filter. I have already designed the memory control module and the ROM module to store my coefficients. I was able to initialise the ROM using a series of signal statements. However, my filter design uses a RAM to store the incoming samples and to test my memory control module i would like to initialize the RAM with some known values.
At first i tried this using the same series of signal assignments i used with the ROM. This was to no avail as when i simulate the RAM's testbench in modelsim it tells me the values within the RAM are uninitialized. (UUUUUUUU). I do not know why the signal assignment method did not work since it worked with the ROM.
I also tried the write values to the ROM and verify that they were written using the waveforms in the testbench but that method gives me the same unitialized array as before.
Can someone help me please? Below is my code for the ROM and then for the RAM.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity rom is
port (
MASTER_CLOCK : in std_logic;
ROM_ADRESS_IN : in std_logic_vector(6 downto 0);
COEFFICIENT_OUT : out std_logic_vector(15 downto 0));
end rom;
architecture syn3 of rom is
type rom_type is array (63 downto 0) of std_logic_vector (15 downto 0);
signal ROM : rom_type;
signal read_add : std_logic_vector(6 downto 0);
begin
ROM(0) <= "0000000000000001";
ROM(1) <= "0000000000000010";
ROM(2) <= "0000000000000011";
ROM(3) <= "0000000000000100";
ROM(4) <= "0000000000000101";
ROM(5) <= "0000000000000110";
ROM(6) <= "0000000000000111";
ROM(7) <= "0000000000001000";
ROM(8) <= "0000000000001001";
ROM(9) <= "0000000000001010";
ROM(10) <= "0000000000001011";
ROM(11) <= "0000000000001100";
ROM(12) <= "0000000000001101";
ROM(13) <= "0000000000001110";
ROM(14) <= "0000000000001111";
--ROM(15) <= "0000000000001111";
ROM(15) <= "0000000000010000";
ROM(16) <= "0000000000010001";
ROM(17) <= "0000000000010010";
ROM(18) <= "0000000000010011";
ROM(19) <= "0000000000010100";
ROM(20) <= "0000000000010101";
ROM(21) <= "0000000000010110";
ROM(22) <= "0000000000010111";
ROM(23) <= "0000000000011000";
ROM(24) <= "0000000000011001";
ROM(25) <= "0000000000011010";
ROM(26) <= "0000000000011011";
ROM(27) <= "0000000000011100";
ROM(28) <= "0000000000011101";
ROM(29) <= "0000000000011110";
ROM(30) <= "0000000000011111";
ROM(31) <= "0000000000100000";
ROM(32) <= "0000000000100001";
ROM(33) <= "0000000000100010";
ROM(34) <= "0000000000100011";
ROM(35) <= "0000000000100100";
ROM(36) <= "0000000000100101";
ROM(37) <= "0000000000100110";
ROM(38) <= "0000000000100111";
ROM(39) <= "0000000000101000";
ROM(40) <= "0000000000101001";
ROM(41) <= "0000000000101010";
ROM(42) <= "0000000000101011";
ROM(43) <= "0000000000101100";
ROM(44) <= "0000000000101101";
ROM(45) <= "0000000000101110";
ROM(46) <= "0000000000101111";
ROM(47) <= "0000000000110000";
ROM(48) <= "0000000000110001";
ROM(49) <= "0000000000110010";
ROM(50) <= "0000000000110011";
ROM(51) <= "0000000000110100";
ROM(52) <= "0000000000110101";
ROM(53) <= "0000000000110110";
ROM(54) <= "0000000000110111";
ROM(55) <= "0000000000111000";
ROM(56) <= "0000000000111001";
ROM(57) <= "0000000000111010";
ROM(58) <= "0000000000111011";
ROM(59) <= "0000000000111100";
ROM(60) <= "0000000000111101";
ROM(61) <= "0000000000111110";
ROM(62) <= "0000000000111111";
ROM(63) <= "0000000001000000";
process (MASTER_CLOCK)
begin
if( MASTER_CLOCK'event and MASTER_CLOCK = '1' ) then
read_add <= ROM_ADRESS_IN;
COEFFICIENT_OUT <= ROM(conv_integer(ROM_ADRESS_IN));
end if;
end process;
end syn3;
-----------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ram1 is
port (MASTER_CLOCK : in std_logic;
WRITE_EN_1 : in std_logic;
RAM_1_ADRESS : in std_logic_vector(5 downto 0);
SAMPLE_IN_1 : in std_logic_vector(7 downto 0);
SAMPLE_OUT_1 : out std_logic_vector(7 downto 0));
end ram1;
architecture syn of ram1 is
type ram_1_type is array (31 downto 0) of std_logic_vector (7 downto 0);
signal RAM : ram_1_type;
signal read_add : std_logic_vector(5 downto 0);
begin
RAM(0) <= "00000001";
RAM(1) <= "00000010";
RAM(2) <= "00000011";
RAM(3) <= "00000100";
RAM(4) <= "00000101";
RAM(5) <= "00000110";
RAM(6) <= "00000111";
RAM(7) <= "00001000";
RAM(8) <= "00001001";
RAM(9) <= "00001010";
RAM(10) <= "00001011";
RAM(11) <= "00001100";
RAM(12) <= "00001101";
RAM(13) <= "00001110";
RAM(14) <= "00001111";
RAM(15) <= "00010000";
RAM(16) <= "00010001";
RAM(17) <= "00010010";
RAM(18) <= "00010011";
RAM(19) <= "00010100";
RAM(20) <= "00010101";
RAM(21) <= "00010110";
RAM(22) <= "00010111";
RAM(23) <= "00011000";
RAM(24) <= "00011001";
RAM(25) <= "00011010";
RAM(26) <= "00011011";
RAM(27) <= "00011100";
RAM(28) <= "00011101";
RAM(29) <= "00011110";
RAM(30) <= "00011111";
RAM(31) <= "00100000";
process (MASTER_CLOCK)
begin
if( MASTER_CLOCK'event and MASTER_CLOCK = '1') then
if (WRITE_EN_1 = '1') then
RAM(conv_integer(RAM_1_ADRESS)) <= SAMPLE_IN_1;
end if;
read_add <= RAM_1_ADRESS;
SAMPLE_OUT_1 <= RAM(conv_integer(RAM_1_ADRESS));
end if;
end process;
end syn;