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

 

--


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM