Altera Home Page
文档资料 许可
在线购买 下载

  主页   |   产品   |   支持   |   最终市场   |   技术中心   |   教育与活动   |   公司介绍   |   在线购买  
  mySupport   |   器件   |   软件   |   IP   |   设计范例   |   参考设计  

 产品
   Quartus II
      SOPC Builder
      MAX+PLUS II
      ModelSim-Altera
  
 资源中心
      简介
      安装&许可
      脚本
       电路板设计& I/O
      网表阅读器 & 综合
      编译增强特性
      优化
      功耗管理
   TimeQuest时序分析器
      标准时序分析器
      仿真 & 确认
      片内调试
      HardCopy设计
  
 软件资源
      操作系统支持
      驱动安装
  
 下载与许可
      下载
   许可
  
 Quartus II EDA 支持
      Quartus II 接口
   综合工具
          Design Compiler
          DC FPGA
          FPGA Compiler II
          LeonardoSpectrum
          Precision RTL Synthesis
          Synplify
   仿真工具
   验证工具
   时序分析工具
   再综合工具
   电路板级工具
  
 老版软件EDA支持
      供应商类
      工具类
      功能类
  

Primitive and Old-Style Macrofunction Instantiation Example for VHDL

You can instantiate the Quartus II primitives listed in Design Compiler Technology Libraries in VHDL designs. These primitives can be used to control synthesis in the Quartus II software. You can also instantiate Quartus II megafunctions and old-style macrofunctions.

Unlike other logic functions, Quartus II primitives do not need to be defined with Component Declarations unless you want to simulate the design with any supported simulation software. Any references to these primitives are resolved by the Synopsys compilers. All buffer primitives except the ATRIBUF and TRIBUF primitives also have a "don't touch" attribute already assigned to them, which prevents the Synopsys compilers from optimizing them. The Synopsys compilers also automatically treat mega- and macrofunctions that do not have corresponding synthesis library models as black boxes.

The 4-bit full adder code sample contains registered output that also instantiates an AGLOBAL or GLOBAL primitive. This sample also illustrates the use of global Clock and global Reset pins in the MAX 7000 architecture. The design uses an old-style 7483 macrofunction, which is represented as a hollow body named fa4.

4-Bit Adder Design with Registered Output (adder.vhd)

LIBRARY ieee;
   USE ieee.std_logic_1164.ALL;

   ENTITY adder IS
   PORT (a, b     : IN  STD_LOGIC_VECTOR(4 DOWNTO 1);
         clk, rst : IN  STD_LOGIC;

         cout     : OUT STD_LOGIC;
         regsum   : OUT STD_LOGIC_VECTOR(4 DOWNTO 1));
   END adder;

ARCHITECTURE MAX7000 OF adder IS

SIGNAL sum            : STD_LOGIC_VECTOR(4 DOWNTO 1);
SIGNAL ci, gclk, grst : STD_LOGIC;

-- Component Declaration for GLOBAL primitive
COMPONENT global
   PORT (a_in      : IN  STD_LOGIC; 
         a_out     : OUT STD_LOGIC);
END COMPONENT;

-- Component Declaration for fa4 macrofunction
COMPONENT fa4
   PORT (c0,a1,b1,a2,b2,a3,b3,a4,b4 : IN  STD_LOGIC;
         s1,s2,s3,s4,c4             : OUT STD_LOGIC);
END COMPONENT;

BEGIN
   ci <= '0';

-- FA4 Component Instantiation
   u0: fa4 

   PORT MAP (ci,a(1),b(1),a(2),b(2),a(3),b(3),a(4),b(4),
             sum(1),sum(2),sum(3),sum(4),cout);

-- GLOBAL Component Instantiation for Clock 
   u1: global 
   PORT MAP (clk, gclk);

-- GLOBAL Component Instantiation for Reset 
-- For FLEX devices, global should be replaced with aglobal
   u2: global
   PORT MAP (rst, grst);

-- CLOCK process to create registered output 
   clocked: PROCESS(gclk,grst)

   BEGIN
      IF grst = '0' THEN
      regsum <= "0000";

      ELSIF gclk'EVENT AND gclk = '1' THEN
            regsum <= sum;
      END IF;

   END PROCESS clocked;
END MAX7000;

Before you can analyze the 4-bit adder design, you must first analyze the fa4 description in the sample above with the Synopsys VHDL Compiler software. You can ignore the warning that is issued for any unknown function, including the fa4 function in this example. You can avoid receiving such warning messages by creating a hollow-body description of the function.

A hollow-body VHDL description combines an Entity Declaration with an empty or null Architecture Body. An empty Architecture Body contains the ARCHITECTURE IS clause, followed by the BEGIN and END keywords and a semicolon (;). It does not include any information about the design's function or operation. The sample below shows the hollow-body description for the fa4 function.

Hollow-Body Description of a 4-Bit Full Adder (7483)

LIBRARY ieee;
USE     ieee.std_logic_1164.ALL;

-- fa4 maps to 7483. The interface names do not have to match.
ENTITY fa4 IS

PORT (c0,a1,b1,a2,b2,a3,b3,a4,b4 : IN STD_LOGIC;
      s1,s2,s3,s4,c4             : OUT STD_LOGIC);

END fa4;
ARCHITECTURE map7483 OF fa4 IS

BEGIN
-- This architecture body is left blank, and will map to the  
-- 7483 macrofunction in Quartus II.
END;

When you analyze the hollow-body design description with the Synopsys VHDL Compiler software, it produces a hollow-body component that contains a single level of hierarchy with input and output pins, but does not contain any underlying logic.

You can save the synthesized design as an EDIF netlist file (.edf) and compile it with the Quartus II software. After the VHDL Compiler software successfully processes the design, it generates the schematic shown in Figure 3, which you can view with the Design Analyzer software.

Synthesized Design Generated by the Design Compiler

Synthesized Design

However, before you compile the EDIF netlist file with the Quartus II software, you must create the adder.lmf file, shown in Figure 3, to map the fa4 function to the equivalent Quartus II function (7483). You must then specify the LMF as LMF #2 in the expanded EDIF Netlist Reader Settings dialog box on the Interfaces menu (LMF #1 is altsyn.lmf). For more information about creating LMFs, refer to Library Mapping File (.lmf) and Library Mapping File Format in Quartus II Help.

Library Mapping File Excerpt for fa4

BEGIN
FUNCTION 7483  (c0, a1, b1, a2, b2, a3, b3, a4, b4,)
RETURNS        (s1, s2, s3, s4, c4)

FUNCTION "fa4" ("c0", "a1", "b1", "a2", "b2", "a3",
               "b3","a4", "b4")
RETURNS        ("s1", "s2", "s3", "s4", "c4")
END

When you compile the design with the Quartus II software, you can disregard the warning "EDIF cell <name> already has LMF mapping so CONTENTS construct has been ignored". To verify the global Clock and global Reset usage, as well as the number of logic cells used, see the adder.rpt Report File generated by the Quartus II software.

 

 

  请填写反馈意见
  注册索取最新邮件通知