zoukankan      html  css  js  c++  java
  • VHDL语法点滴

    1. cnt <= (others => '0');
    这个是给cnt赋零的意思,还可以这样用
    比如说cnt是std_logic_vector(7 downto 0);
    那么cnt<=(1=>'1',others=>'0');就表示给cnt的第1位赋1,其他位的全部都赋0,结果cnt=“00000010”;

    2.f1_fi_din <= conv_std_logic_vector(8, DW/2-10) & AD_B & conv_std_logic_vector(4, DW/2-10) & AD_A;
    -- "00"-ch2(2bit)-"00"-ADB-"00"-ch1(2bit)-"00"-ADA
    conv_std_logic_vector 类型转换函数 把integer类型数8转换为6位标准逻辑矢量类型std_logic_vector(5 downto 0)即"001000" .
    & 相当于Verilog语法中的{},"连接"的意思。

    3.component 元件例化就是引入一种连接关系,将预先设计好的设计实体entity定义为一个元件,然后利用特定的语句将此元件与当前的设计实体中的指定端口相连接,从而实现结构化设计。语法如下:第一部分:元件定义语句例如:

    COMPONENT 元件名IS
    PORT ( 信号1,信号2 : in std_logic;
    信号3 : out std_logic_vector(7 downto 0);
    信号4,信号5 : inout std_logic );
    END COMPONENT;

      第二部分:连接说明语句:
      例化名:元件名PORT MAP ( 连接端口名1, 连接端口名2 , …… );
      语法举例:
       COMPONENT or_gate
      PORT( a,b : IN std_logic;
      c : OUT std_logic);
      END COMPONENT;

      BEGIN
        U0: or_gate PORT MAP((tmp3,tmp2,Co_F);

    4. 实体有实体名。实体名×××可以取英文名,且不能以数字开头;注意在编写完VHDL文本存盘时,设计文件×××.vhd的前缀一定要和实体名×××完全相同,否则有的EDA软件无法编译。

    5. ARCHITECTURE ...

       TYPE string IS ARRAY (1 TO 10) OF INTERGER;

       SIGNAL AA: string;

       begin

       AA <= (0,0,0,2,2,1,5,7,4,7);

      如果单独给AA中的某个元素赋值,可: AA(2) <= 110;

      =================

       TYPE matrix_index IS ARRAY (3 downto 0) OF STD_LOGIC_VECTOR(7 downto 0);

       constant R : matrix_index :=(x"15", x"0f", x"0a", x"0b"); ---define a constant array.

       because of "...3 downto 0...", R(0)等于x"0b",R(3)等于x"15".

       (fr:http://zhidao.baidu.com/question/274057527.html)

    
    
  • 相关阅读:
    BZOJ 1069 最大土地面积
    BZOJ 1059 矩阵游戏
    BZOJ 3570 动物园
    Luogu 3934 Nephren Ruq Insania
    Luogu 3233 [HNOI2014]世界树
    CF613D Kingdom and its Cities
    Luogu 4001 [BJOI2006]狼抓兔子
    Luogu 2824 [HEOI2016/TJOI2016]排序
    POJ 3463 Sightseeing
    Luogu 2495 [SDOI2011]消耗战
  • 原文地址:https://www.cnblogs.com/winkle/p/2951599.html
Copyright © 2011-2022 走看看