8-第五章 同步时序逻辑电路.ppt
文本预览下载声明
根据卡诺图可得激励函数和输出函数的表达式为 这个电路用VHDL语言的状态图描述方法描述如下: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity vendor is port ( clk, A,B,RD: in std_logic; Y,Z: out std_logic); end vendor; architecture one of vendor is type state_type is (s0,s1,s2); --用户自己定义的枚举类型 signal state : state_type; --信号声明 begin process(clk, RD) --状态转移进程,clk,RD为敏感信号 begin if RD=0 then state=s0; --初始状态为s0 elsif clkevent and clk=0 then --当clk下降沿到来时执行下面的语句 case state is when s0=if A=‘1’ then state=s2; elsif B=‘1’ then state=s1; end if; when s1=if A =‘1’ then state=s0; elsif B=‘1’ then state=s2; end if; when s2=if A =‘1’or B=‘1’ then state=s0; end if; end case; end if; end process; output_p : process(state) --输出变化进程,状态为敏感信号 begin case state is when s1= if A=‘1’ then Y=‘1’; --输出值取决于输入值与现态 Z=‘0’; end if; when s2= if A=‘1’ then Y=‘1’; --输出值取决于输入值与现态 Z=‘1’; elsif B=‘1’then Y=‘1’; Z=‘0’; end if; when others= Y=‘0’;Z=‘0’; --其余情况输出为零 end case; end process; en
显示全部