EDA Interfaces

Instantiating RAM & ROM Functions in VHDL (Design Compiler Software)



The Quartus® II/Synopsys® interface offers full support for the memory capabilities for ACEX® 1K, APEX 20K, APEX II, FLEX 10KE, Cyclone, Mercury, Stratix, and Stratix GX devices, including synchronous and asynchronous RAM and ROM, cycle-shared dual port RAM, dual-port RAM, single-clock FIFO, and dual-clock FIFO functions. You can use the Altera®-provided genmem utility to generate functional simulation models and timing models for these functions. Type genmem Enter at the UNIX prompt to display information on how to use this utility, as well as a list of the functions you can generate.

To instantiate a RAM or ROM function in VHDL:

  1. Use the genmem utility to generate a memory model by typing the following command at the UNIX prompt:

    genmem <memory type> <memory size> -vhdl Enter

    For example: genmem asynrom 256x15 -vhdl Enter

  2. Create a VHDL design that incorporates the text from the genmem-generated Component Declaration, <memory name>.cmp, and instantiate the <memory name> function.

    Figure 1 shows a VHDL design that instantiates asyn_rom_256x15.vhd, a 256 x 15 ROM function.

    Figure 1: VHDL Design File with ROM Instantiation (tstrom.vhd)
    LIBRARY ieee;
    USE ieee.std_logic_1164.all;
    
    ENTITY tstrom IS
            PORT (
              addr    : IN STD_LOGIC_VECTOR (7 DOWNTO 0);
              memenab : IN STD_LOGIC;
              q       : OUT STD_LOGIC_VECTOR (14 DOWNTO 0));
    END tstrom;
    
    ARCHITECTURE behavior OF tstrom IS
    
    COMPONENT asyn_rom_256x15
    -- pragma translate_off
         GENERIC (LPM_FILE : string);
    
    -- pragma translate_on
         PORT (Address : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
               MemEnab : IN STD_LOGIC;
               Q       : OUT STD_LOGIC_VECTOR(14 DOWNTO 0)
         );
    END COMPONENT;
    
    BEGIN
    
       u1: asyn_rom_256x15
    -- pragma translate_off
            GENERIC MAP (LPM_FILE => "u1.hex")
    -- pragma translate_on
       PORT MAP (Address => addr, MemEnab => memenab, Q =>q);
    END behavior;
    
  3. (Optional for RAM functions) Specify an initial memory content file:
    Note:
    1. The MIF format is supported only for specifying initial memory content when compiling designs within the Quartus II software. You cannot use a MIF to perform simulation with Synopsys tools prior to Quartus II compilation.

    2. If you use an HEX File and wish to simulate the design with the VHDL System Simulator (VSS) after Quartus II compilation, you should use the Synopsys intelhex utility to translate the Hex File into a VSS-compatible Synopsys memory file. Refer to the Synopsys VHDL System Simulator Software Tool manual for details about using the intelhex utility.

  4. In the VHDL design file, add the compiler directive -- pragma translate_off Enter before the Generic Clause and Generic Map Clause, and add -- pragma translate_on Enter after the Generic Clause and Generic Map Clause. These directives tell the VHDL Compiler software when to stop and start synthesizing. For example, in Figure 1, the --pragma translate_off directive instructs the VHDL Compiler software to skip syntax checking until the --pragma translate_on directive is read.

  5. Because the VHDL Compiler software does not support the data type string for the Generic Clause, you must also type the following command before you read the design:

    hdlin_translate_off_skip_text=true Enter

  6. The timing model (.lib) generated by the genmem utility contains pin-to-pin delay information that the Synopsys Design Compiler software can use. You must add this timing model to the existing library so that the compiler can access the timing information. Type the following commands at the dc_shell prompt:

    read -f db apex20k[<speed grade>].db Enter
    update_lib apex20k[<speed grade>] <RAM/ROM function name>.lib Enter

  7. (Optional) Type the following command to update your apex20k[<speed grade>].db file with the RAM/ROM timing information:

    write_lib apex20k[<speed grade>] -o apex20k[<speed grade>].db Enter

  8. When you generate the EDIF netlist file from the design, include the bus structure from the RAM or ROM function(s).


Back to Top

- PLDWorld -

 

Created by chm2web html help conversion utility.