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;
————————————————

 

--

posted @ 2021-11-18 15:25  瘋耔  阅读(500)  评论(0编辑  收藏  举报
跳至侧栏