• FPGA编程语言VHDL OR Verilog


    --

    1)实体部分
    
    //verilog
    
    module AD9517_Cfg
    (
     i_9517cfg_CfgClk , // 数据时钟                      
     i_9517cfg_CfgClk180 ,       // 配置时钟,与数据时钟反向180度 
     i_9517cfg_Arst_n , // 全局复位
    
    
     o_9517cfg_SpiClk , // 输出SPI时钟
     o_9517cfg_SpiDat , // 输出SPI数据
     o_9517cfg_Cs_n , // 输出片选
     o_9517cfg_Sync_n // 9517各通道间输出同步控制信号
    
    );
    
    input i_9517cfg_CfgClk ;
    input i_9517cfg_CfgClk180 ;
    input i_9517cfg_Arst_n ;
    output o_9517cfg_SpiClk ;
    output o_9517cfg_SpiDat ;
    output o_9517cfg_Cs_n              ;
    
    output o_9517cfg_Sync_n ;
    
    
    ----------------VHDL
    
    entity gesignal is
    port(clk:in std_logic;
     --cmd:in std_logic_vector(1 downto 0);
     reset:in std_logic;
     
     --cnout3:out std_logic_vector(5 downto 0);
     --go:out STD_LOGIC;
     --flag:out STD_LOGIC;
     
     --ackrout:out STD_LOGIC;
     ODB:out STD_LOGIC;
     IAG1,IAG2:out STD_LOGIC;
     SAG1,SAG2:out STD_LOGIC;
     SRG1,SRG2:out STD_LOGIC;
     CMG:out STD_LOGIC;
     ACK:out STD_LOGIC
     );
    end entity gesignal;
    
    不难发现两者语法的实体都很精简,只是定义管脚Verilog在实体外,VHDL在实体内。
    
    2)进程
    
    //verilog
    
    always @( posedge i_9517cfg_CfgClk, negedge i_9517cfg_Arst_n )
    begin
        if( ! i_9517cfg_Arst_n )
            int_Cs_n <= 1'b1;
        else if ((int_CsWidthCnt_5b > 7) && (!int_CfgDone))
         int_Cs_n <= 1'b0;
        else
        int_Cs_n <= 1'b1;
    
    end
    
    -----------VHDL
    
    ge_cn3:process(read_flag,clk,iACKT)
     begin
     if(iACKT='1')then
     cn3<=(others=>'0');
     else
     if(clk'event and clk='1')then
     if(read_flag='1')then
     cn3<=cn3+'1';
     end if;
     end if;
     end if;
     end process ge_cn3;
    ————————————————

    --

    作者:柒月
    Q群 :2122210(嵌入式/机器学习)
  • 相关阅读:
    [编程题]多多的数字组合
    mac传输文件到服务器
    git 清除缓存、查看add内容
    go build
    vim编辑器
    Git: clone指定分支
    查看端口占用以及kill
    curl小记录
    Python3.9 malloc error: can’t allocate region
    设计模式-策略模式
  • 原文地址:https://www.cnblogs.com/Ph-one/p/15572582.html
Copyright © 2020-2023  润新知