Hi,
I'm trying to use the M9K memory block of my FPGA cyclone IV.
For that purpose I use the Mega-wizard of Quartus II 10.1sp1 Web
Edition.
I implemented the 1 port RAM with single clock, the entity generated
looks like the code below:
1 | entity RAM_1Port IS
|
2 | PORT
|
3 | (
|
4 | address : IN STD_LOGIC_VECTOR (4 DOWNTO 0);
|
5 | clock : IN STD_LOGIC := '1';
|
6 | data : IN STD_LOGIC_VECTOR (15 DOWNTO 0);
|
7 | wren : IN STD_LOGIC ;
|
8 | q : OUT STD_LOGIC_VECTOR (15 DOWNTO 0)
|
9 | );
|
10 | END RAM_1Port ;
|
.
To test this memory, i have created the code below:
1 | -- Instantiate the RAM single port mode
|
2 | RAM1: RAM_1Port port map(RAM_address,CLOCK_50,RAM_data_IN,RAM_wren,Output_RAM);
|
3 |
|
4 | test: process(CLOCK_50,KEY) -- asynchonos process
|
5 | begin
|
6 |
|
7 | IF (KEY='0') THEN -- when reset is selected
|
8 |
|
9 | -- init signals RAM Single port
|
10 | wr_address <=(others => '0');
|
11 | RAM_address<=(others =>'0');
|
12 | RAM_data_IN<=(others =>'0');
|
13 | RAM_wren<='0';
|
14 | Write_Ok<='0';
|
15 | ELSIF(rising_edge(CLOCK_50)) then
|
16 |
|
17 | if(Write_Ok='0') then -- start writing
|
18 |
|
19 | RAM_wren<='1';
|
20 |
|
21 | RAM_address<=std_logic_vector(to_unsigned(10, 5));
|
22 | RAM_data_IN<=std_logic_vector(to_unsigned(1984, 16));
|
23 | cpt<=cpt+1;
|
24 |
|
25 | if(cpt=1) then
|
26 | Write_Ok<='1';
|
27 | cpt<=0;
|
28 | end if;
|
29 | end if;
|
30 |
|
31 | if(Write_Ok='1') then --start reading
|
32 |
|
33 | RAM_wren<='0';
|
34 | RAM_address<=std_logic_vector(to_unsigned(10, 5));
|
35 | cpt<=cpt+1;
|
36 | RAM_out<=Output_RAM;
|
37 |
|
38 | if(cpt=1) then
|
39 | Write_Ok<='0';
|
40 | cpt<=0;
|
41 | end if;
|
42 | end if;
|
43 | end if;
|
44 | end process;
|
45 | END;
|
The problem i have is that the output RAM_out is always zero, i don't
understand why.
Can you help on this please if you have an idea?
Best regards