1、for語法使用規(guī)則
標(biāo)號:for?循環(huán)變量?in?離散范圍 generate
? ? ? ? ? <并行語句>;
end?generate?標(biāo)號;
代碼示例如下:文章來源:http://www.zghlxwxcb.cn/news/detail-499883.html
?? ?signal data_7p4bit : std_logic_vector(7*4-1 downto 0);
?? ?signal data_7p_bit : std_logic_vector(6 downto 0);
?? ? ?G_04deg : for I in 0 to 6 generate?
?? ? ?process(rst,clk)
?? ? ?begin
?? ??? ? ?if rst='1' then
?? ??? ??? ? ?data_7p4bit(4*(i+1)-1 downto 4*i )<=(others=>'0');
?? ??? ? ?elsif clk'event and clk='1' then?? ??? ?
?? ??? ??? ? ?if data_7p_8bit(i)='1' then
?? ??? ??? ??? ? ?data_7p4bit(4*(i+1)-1 downto 4*i )<="1100";
?? ??? ??? ? ?else
?? ??? ??? ??? ? ?data_7p4bit(4*(i+1)-1 downto 4*i )<="0100";
?? ??? ??? ? ?end if;?? ??? ??? ?
?? ??? ? ?end if;
?? ? ?end process;
? ? ? end generate G_04deg;文章來源地址http://www.zghlxwxcb.cn/news/detail-499883.html
到了這里,關(guān)于vhdl語言基礎(chǔ)篇-for的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!