习题3-4
(1)半减器
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY h_suber IS
PORT ( x, y : IN STD_LOGIC;
diff, s_out : OUT STD_LOGIC);
END ENTITY h_suber;
ARCHITECTURE fh1 OF h_suber IS
BEGIN
s_out <= (NOT x ) AND y;
diff <= x XOR y;
END ARCHITECTURE fh1;
(2)全减器
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
ENTITY f_suber IS
PORT ( X,Y,sub_in : IN STD_LOGIC;
diff,s_out : OUT STD_LOGIC);
END ENTITY f_suber;
ARCHITECTURE fd1 OF f_suber IS
COMPONENT h_suber
PORT (x ,y : IN STD_LOGIC; s_out ,diff : OUT STD_LOGIC);
END COMPONENT;
SIGNAL net1, net2, net3: STD_LOGIC;
BEGIN
u1 : h_suber PORT MAP(x=>X, y=>Y, diff=>net1, s_out=>net2);
u2 : h_suber PORT MAP(x=>net1, y=>sub_in, diff=>diffr, s_out=>net3);
sub_out <= net2 OR net3;
END fd1;
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |