用与门、或门和非门构成异或门 ARCHITECTURE structure OF xor_gate IS COMPONENT not_gate PORT(a: IN BIT; b: OUT BIT); END COMPONENT; COMPONENT and_gate PORT(a, b: IN BIT; c: OUT BIT); END COMPONENT;
COMPONENT or_gate PORT(a, b: IN BIT; c: OUT BIT); END COMPONENT; SIGNAL na, nb: BIT; SIGNAL 1 c 1, c 2: BIT; BEGIN u 1: not_gate PORT MAP(a, na); u 2: not_gate PORT MAP(a, nb); u 3: and_gate PORT MAP(a, nb, c 1); u 4: and_gate PORT MAP(b, na, c 2); u 1: or_gate PORT MAP(c 1, c 2, c); END structure