全减器真值表理解:点击了解
采用元件例化方式,选择顶层文件
一位半减器程序:
library ieee;
use ieee.std_logic_1164.all;
entity bjq is
port (x_h,y_h:in std_logic;
c1,s1:out std_logic);
end;
architecture one of bjq is
begin
process(x_h,y_h)
begin
s1<= x_h xor y_h;
c1<= (not x_h) and y_h;
end process;
end;
或门程序:
library ieee;
use ieee.std_logic_1164.all;
entity org is
port(a,b:in std_logic;
o:out std_logic);
end entity;
architecture one of org is
begin
o<=a or b;
end;
一位全减器程序:
library ieee;
use ieee.std_logic_1164