《EDA技术实用教程(第五版)》习题答案(第1~10章)--潘

xin yin

a

c

b

diff_out

图3-18 全减器结构图

--解(1.1):实现1位半减器h_suber(diff=x-y;s_out=1,x

PORT( x,y: IN STD_LOGIC; diff,s_out: OUT STD_LOGIC); END ENTITY h_suber;

ARCHITECTURE hs1 OF h_suber IS BEGIN

Diff <= x XOR (NOT y); s_out <= (NOT x) AND y;

END ARCHITECTURE hs1;

--解(1.2):采用例化实现图4-20的1位全减器

LIBRARY IEEE; --1位二进制全减器顺层设计描述 USE IEEE.STD_LOGIC_1164.ALL; ENTITY f_suber IS

PORT(xin,yin,sub_in: IN STD_LOGIC; sub_out,diff_out: OUT STD_LOGIC); END ENTITY f_suber;

ARCHITECTURE fs1 OF f_suber IS

COMPONENT h_suber --调用半减器声明语句 PORT(x, y: IN STD_LOGIC; diff,s_out: OUT STD_LOGIC); END COMPONENT;

SIGNAL a,b,c: STD_LOGIC; --定义1个信号作为内部的连接线。 BEGIN

u1: h_suber PORT MAP(x=>xin,y=>yin, diff=>a, s_out=>b); u2: h_suber PORT MAP(x=>a, y=>sub_in, diff=>diff_out,s_out=>c); sub_out <= c OR b;

END ARCHITECTURE fs1;

(2)以1位全减器为基本硬件,构成串行借位的8位减法器,要求用例化语句来完成此项设计(减法运算是x-y-sun_in=difft)。

x7 y7 a6 x1 y1 xin sub_out yin u7 sub_in diff_out ………………. ………………. xin sub_out yin u1 sub_in diff_out xin sub_out yin u0 sub_in diff_out 串行借位的8位减法器

a1 sout diff7

a0 diff1 diff0

x0 y0 sin

--解(2):采用例化方法,以1位全减器为基本硬件;实现串行借位的8位减法器(上图所示)。 LIBRARY IEEE;

USE IEEE.STD_LOGIC_1164.ALL; ENTITY suber_8 IS

PORT(x0,x1,x2,x3,x4,x5,x6,x7: IN STD_LOGIC; y0

>>展开全文<<
12@gma联系客服:779662525#qq.com(#替换为@)