Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

one-port Ram om altera

Hey i´m using the "1- port ram" from the megaWizard plugin manager.

when i change the adress, the output is always the value of the first adress.

Do i have to do some settings or how can i change this?#


LIBRARY ieee;
USE ieee.std_logic_1164.all;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--  Entity Declaration
ENTITY block_name IS
    -- {{ALTERA_IO_BEGIN}} DO NOT REMOVE THIS LINE!
    PORT
    (
        clock : IN STD_LOGIC;  // clock
        resultim : IN STD_LOGIC_VECTOR(23 downto 0); // newinputdata
        speicher : IN STD_LOGIC_VECTOR(31 downto 0); // data from the actual adress of the ram
        adresse : buffer STD_LOGIC_VECTOR(11 downto 0); // adress
        writeenable : OUT STD_LOGIC; //
        ausgang2 : OUT STD_LOGIC_VECTOR(31 downto 0) // output and input from the ram
    );
    -- {{ALTERA_IO_END}} DO NOT REMOVE THIS LINE!
    
END block_name;
--  Architecture Body
ARCHITECTURE aufsummiererimaginaerteil_architecture OF block_name IS
signal zaehler : natural range 0 to 12;
BEGIN
writeenable <= '1';
process (clock  ) 
begin
If clock = '1' and clock'event then
    if zaehler = 12 then 
        zaehler <= 0;
    else zaehler <= zaehler + 1;
    end if;
        
    ausgang2 <= resultim + speicher;
If zaehler = 0 then  adresse <= "000000000000";end if;
If zaehler = 1 then adresse <= adresse + "1000";end if;
If zaehler = 2 then  adresse <= adresse + "1000";end if;
If zaehler = 3 then adresse <= adresse + "1000";end if;
If zaehler = 4 then  adresse <= adresse + "1000";end if;
If zaehler = 5 then adresse <= adresse + "1000";end if;
If zaehler = 6 then  adresse <= adresse + "1000";end if;
If zaehler = 7 then  adresse <= adresse + "1000";end if;
If zaehler = 8 then  adresse <= adresse + "1000";end if;
If zaehler = 9 then  adresse <= adresse + "1000";end if;
If zaehler = 10 then  adresse <= adresse + "1000";end if;

If zaehler = 11 then adresse <= adresse + "1000";end if;

If zaehler = 12 then adresse <= adresse + "1000";end if;

end if;

end process;

END aufsummiererimaginaerteil_architecture;

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    ok and how i do a ram instance? ( that was not my ram code only a code to initialize the adresses and the input and so on) kind regards

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i don´t know the code from the ramblock i´m using the megafunction and it doesn´t work