1、for语法使用规则
标号:for 循环变量 in 离散范围 generate
<并行语句>;
end generate 标号;
代码示例如下:
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;