正在加载图片...
when "110"=> y(3)<=a(3)Xorb(3)y(2)<=a(2)xorb(2),“实现 a xor b; y(I)<=a(1)xor b(1): y(O)<=a(0)xor b(o) when"111"→ y(3)=nota(3)y(2)=nota(2)-实现nota y(1)<=not a(1): y(o)<=not a(0) cout< when others=>y<=0000 cout<=O end process end beh a和b是 unsigned的数组类型,进行算术运算后结果可 以直接赋给 std logic vector类型(默认类型转换),不经过 运算或经过逻辑运算后不能直接赋值给 std logic vector类 型;但一位的 unsigned类型进行逻辑运算后结果可以直接赋 给 std logic类型(默认类型转换)。 作业 设计p441表5-53所示的算术逻辑单元的结构体:已知实体 为 entity kalu port( a, b: in std logic vector(3 downto 0)when "110" => y(3)<=a(3) xor b(3);y(2)<=a(2) xor b(2); --实现 a xor b; y(1)<=a(1) xor b(1);y(0)<=a(0) xor b(0); cout<='0'; when "111" => y(3)<=not a(3);y(2)<=not a(2); --实现 not a; y(1)<=not a(1);y(0)<=not a(0); cout<='0'; when others =>y<= "0000"; cout<='0'; end case; end process; end beh; a 和 b 是 unsigned 的数组类型,进行算术运算后结果可 以直接赋给 std_logic_vector 类型(默认类型转换),不经过 运算或经过逻辑运算后不能直接赋值给 std_logic_vector 类 型;但一位的 unsigned 类型进行逻辑运算后结果可以直接赋 给 std_logic 类型(默认类型转换)。 作业: 设计 p.441 表 5-53 所示的算术逻辑单元的结构体;已知实体 为: entity kalu is port( a, b : in std_logic_vector(3 downto 0);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有