根据原理图写出相应的VHDL程序

2025-03-20 16:36:04
推荐回答(2个)
回答1:

library ieee;
use std_logic_1164.all;

entity temp is
port(a :in std_logic;
b : in std_logic;
c:out std_logic;
d:out std_logic
);
end temp;
archiecture str of temp is
begin

c <= a and b;
d <=( a or b) and (not(a and b));

end str;

回答2:

ENTITY and_or IS
PORT(A,B:IN bit; C,D:OUT bit);
END and_or;
ARCHITECTURE rtl OF and_or IS
BEGIN
C <= A AND B;
D <= A XOR B;
END rtl;
是个1位半加器。