以上语句等效为 process(indicator, sig variable temp: std_logic begin temp:=“0; temp: =temp xor(sig(O)and indicator(O)) temp: -temp xor (sig(1)and indicator(1) temp: =temp xor(sig(2)and indicator(2); temp: =temp xor(sig(3)and indicator(3)) output < temp end process
11 以上语句等效为: process(indicator, sig) variable temp : std_logic ; begin temp := ‘0’ ; temp :=temp xor (sig(0) and indicator(0)); temp :=temp xor (sig(1) and indicator(1)); temp :=temp xor (sig(2) and indicator(2)); temp :=temp xor (sig(3) and indicator(3)); output <= temp ; end process ;
如改为信号,则无法实现原功能 signal temp: std_logici process(indicator, sig, temp) begin temp<=0 temp<=temp xor(sig(o) and indicator(o)): temp<=temp xor(sig(1)and indicator(1); temp<=temp xor(sig(2)and indicator(2) temp<=temp xor(sig(3 )and indicator(3)) output <= temp i end process 12
12 如改为信号,则无法实现原功能: …… signal temp : std_logic; …… process(indicator, sig, temp) begin temp<= ‘0’ ; temp<=temp xor (sig(0) and indicator(0)); temp<=temp xor (sig(1) and indicator(1)); temp<=temp xor (sig(2) and indicator(2)); temp<=temp xor (sig(3) and indicator(3)); output <= temp ; end process ;
二、转向控制语句 转向控制语句通过条件控制开关决定是否执 行一条或几条语句,或重得执行一条或几条语句, 或跳过一条或几条语句。 分为五种 f语句、case语句 oop语句、next语句 exit语句
13 二、 转向控制语句 转向控制语句通过条件控制开关决定是否执 行一条或几条语句,或重得执行一条或几条语句, 或跳过一条或几条语句。 分为五种: if 语句、case 语句、 loop 语句、next 语句、 exit 语句
1、if语句 计f语句执行一序列的语句,其次序依赖于 个或多个条件的值。 1)讦语句的门闩控制 f条件then 顺序处理语句; end if LATCH 例:if(ena=1)then ena Q ENA <=d end if 综合后生成锁存器( latch)
14 1、if 语句 if 语句执行一序列的语句,其次序依赖于一 个或多个条件的值。 1)if 语句的门闩控制 例:if (ena = ‘1’) then q <= d; end if; 综合后生成锁存器(latch) if 条件 then 顺序处理语句; end if ;
条件改为时钟沿,则生成D触发器: library ieee use ieee std logic 1164.alli entity dff is port (clk, d: in std logici g: out std logic) end dff: architecture rtl of dff is begin process(clk) begin if (clk'event and clk=1')then g<=di end if end processi end rtl 15
15 条件改为时钟沿,则生成 D触发器: