Hi everyone;
I need to store data comes from an external ADC. So, i opted to use the
internal Memory M9K implemented in my Cyclone IV FPGA.
For that purpose, i used the mega-function ALTSYNCRAM provided by
Altera. The code is below:
1 | ENTITY RAM_2PORT IS
|
2 | PORT
|
3 | (
|
4 | clock : IN STD_LOGIC := '1';
|
5 | data : IN STD_LOGIC_VECTOR (31 DOWNTO 0);
|
6 | rdaddress : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
|
7 | wraddress : IN STD_LOGIC_VECTOR (12 DOWNTO 0);
|
8 | wren : IN STD_LOGIC := '0';
|
9 | q : OUT STD_LOGIC_VECTOR (31 DOWNTO 0)
|
10 | );
|
11 | END RAM_2PORT;
|
For this RAM there are two addresses, one fro write operations and the
other one for read operations. I have created init_file(ram.mif) with
known values, to initialize the RAM.
When i write a value in a specified address, i can read it after.
1 | if(rising_edge(CLOCK_50)) then
|
2 |
|
3 | if(interrupt_timer='1') then -- interrupt that activate the the write in the RAM
|
4 | -- RAM dual port mode -----
|
5 | RAM_W_address<='0' & X"001";
|
6 | RAM_wren2<='1';
|
7 | RAM_data_IN2<=X"55555557";
|
8 |
|
9 | else
|
10 |
|
11 | -- RAM dual port
|
12 | RAM_wren2<='0';
|
13 | RAM_R_address<='0' & X"001";
|
14 | LED<=RAM_out2(15 downto 8);
|
15 | end if;
|
16 | end if;
|
The problem is I get only zero when i want to read an initialized value
loaded from the init_file.
Do you have an idea what would be the problem ? Thank for any help.
Best Regards