我在使用 2-Bitgreater than Comparator
和 2-bit创建 4-Bit Comparator 时遇到了麻烦equality Comparator
。
大于比较器
entity bit2com is
Port ( a,b: in STD_LOGIC_vector(1 downto 0);
y : out STD_LOGIC);
end bit2com;
architecture Behavioral of bit2com is
signal p0,p1,p2:std_logic;
begin
p0 <= a(1) and not b(1);
p1 <= a(0) and a(1) and not b(0);
p2<=a(0) and not b(0) and not b(1);
y <= p0 or p1 or p2;
end Behavioral;
相等比较器
entity comaeqb is
Port ( a,b: in STD_LOGIC_vector(1 downto 0);
y : out STD_LOGIC);
end comaeqb;
architecture Behavioral of comaeqb is
signal p0,p1,p2,p3:std_logic;
begin
p0 <= a(0) and a(1) and b(0) and b(1);
p1 <= a(0) and not a(1) and b(0) and not b(1);
p2<=not a(0) and not a(1) and not b(0) and not b(1);
p3<=not a(0) and a(1) and not b(0) and b(1);
y <= p0 or p1 or p2 or p3;
我如何使用它来比比较器大 4 位?