正在加载图片...
例p428表5-50 8位无符号数比较器的行为设计 library ieee use Ieee entity compare is port(a, b: in std logic vector( 7 downto 0); eq, ne, gt,ge,It, le: out std logic) nd architecture beh of compare is process(a, b) eq<=0;ne<="0,gt<=0;ge<=0;t<0e<=0;, if a=b then eq <='I, end if; if a/=b then ne <='1. end if if a>b then gt <='1; end if if a>=b then ge <='1 if a<b then It <=l' end if if a<=b then le <='I end if d end beh. 算术逻辑单元ALU 通过控制变量的选择,可以对输入的两组数据进行不同的算 术算或逻辑运算 设计思想:将每一种运算设计为一个小程序块,通过选择语 句来选择实现 例带进位四位算术逻辑单元ALU设计例 p.428 表 5-50 8 位无符号数比较器的行为设计 library ieee; use ieee.std_logic_1164.all; entity vcompare is port (a,b: in std_logic_vector( 7 downto 0 ); eq,ne,gt,ge,lt,le: out std_logic); end vcompare; architecture beh of vcompare is begin process(a,b) begin eq <= '0';ne <= '0';gt <= '0';ge <= '0';lt <= '0';le <= '0'; if a=b then eq <= '1'; end if; if a/=b then ne <= '1'; end if; if a>b then gt <= '1'; end if; if a>=b then ge <= '1'; end if; if a<b then lt <= '1'; end if; if a<=b then le <= '1'; end if; end process; end beh; 算术逻辑单元 ALU 通过控制变量的选择,可以对输入的两组数据进行不同的算 术算或逻辑运算; 设计思想:将每一种运算设计为一个小程序块,通过选择语 句来选择实现; 例 带进位四位算术逻辑单元 ALU 设计
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有