跳到主要内容

東京大学 情報理工学系研究科 電子情報学専攻 2019年8月実施 専門 第2問

Author

Josuke, diohabara

Description

Let us design a circuit that obtains a 4-bit signed integer Y3..0Y_{3..0} by calculating 4-bit additon/subtraction of a 4-bit signed integer A3..0A_{3..0} and a 2-bit signed integer B1,0B_{1,0}. The integers A,BA,B and YY are expressed in two's complement. The types of logic gates that you can use arc NOT, AND , OR ,and , XOR , cach of which is equipped with as many inputs as the design requires. Answer the following questions.

(1) Show the maximum and minimum values of AA and BB in decimal form.

(2) Show a circuit that calculates A+BA + B to obtain YY by combining logic gates. Organize the adder as a ripple carry adder. You can use signals from A3..0,B1,0A_{3..0},B_{1,0}, supply voltage VDDV_{DD}, and grounding voltage GND as inputs, The output should be Y3..0Y_{3..0}. To simplify the diagram, use the "half-adder" blocks and the "full-adder" blocks after showing gate-level designs of both blocks.

(3) Consider adding an overflow detection mechanism to the circuit designed in (2). Show the overflow detection circuit by combining the logic gates. You can use signals from A3..0,B1,0A_{3..0},B_{1,0} and Y3..0Y_{3..0} as inputs. The output should be a 1-bit signal named DD; it should be '1' when the overflow occured, or '0' otherwise.

(4) Show a circuit that calculates ABA - B to obtain YY by combining logic gates. Organize the adder as a ripple carry adder. You can use signals from A3..0,B1,0,VDDA_{3..0},B_{1,0},V_{DD} and GND as inputs. The output should be Y3..0Y_{3..0}. Use the "half-adder" blocks and the "full-adder" blocks in (2).

(5) Show all the input patterns that cause overflows for the calculation designed in (4).

题目描述

设计一个电路,对 44 位有符号整数 A3..0A_{3..0}22 位有符号整数 B1,0B_{1,0}44 位加/减运算,得到 44 位有符号整数 Y3..0Y_{3..0}A,B,YA,B,Y 均用二进制补码表示。可用的门为 NOT、AND、OR、XOR,每种门的输入数可按设计需要确定。

(1) 用十进制写出 AABB 各自的最大值和最小值。

(2) 用逻辑门组合出计算 Y=A+BY=A+B 的行波进位加法器。可使用 A3..0A_{3..0}B1,0B_{1,0}、电源电压 VDDV_{DD} 和地电压 GND 作为输入,输出为 Y3..0Y_{3..0}。先给出半加器和全加器的门级设计,随后可用二者的模块符号简化总图。

(3) 为 (2) 的电路增加溢出检测。用 A3..0A_{3..0}B1,0B_{1,0}Y3..0Y_{3..0} 中的信号组合逻辑门,输出一位信号 DD;发生溢出时 D=1D=1,否则 D=0D=0

(4) 用逻辑门组合出计算 Y=ABY=A-B 的行波进位加法器。可使用 A3..0A_{3..0}B1,0B_{1,0}VDDV_{DD} 和 GND,输出为 Y3..0Y_{3..0},并使用 (2) 中的半加器、全加器模块。

(5) 列出 (4) 所设计减法运算中会造成溢出的全部输入模式。

Kai

(1)

Amax=0111(2)=7Amin=1000(2)=(10001111+1)(2)=8Bmin=01(2)=1Bmax=10(2)=(1011+1)(2)=2\begin{aligned} A_{\text{max}} &= 0111_{(2)} = 7 \\ A_{\text{min}} &= 1000_{(2)} = -(1000 \oplus 1111 + 1)_{(2)} = -8 \\ B_{\text{min}} &= 01_{(2)} = 1 \\ B_{\text{max}} &= 10_{(2)} = -(10 \oplus 11 + 1)_{(2)} = -2 \end{aligned}

(2)

(3)

(2) で設計した回路がオーバーフローするとき、A3C2=1A_3C_2=1 となる。 また、(2) の回路は以下の論理式を満たす。

C2=A2C1C1=A1C0+A1B1+B1C0=C0(A1+B1)+A1B1C0=A0B0\begin{aligned} C_2 &= A_2C_1 \\ C_1 &= A_1C_0 + A_1B_1 + B_1C_0 = C_0(A_1 + B_1) + A_1B_1 \\ C_0 &= A_0B_0 \end{aligned}

これらの式を代入して

A3A2C1=1A2A3(C0(A1+B1)+A1B1)=1A2A3(A0B0(A1+B1)+A1B1)=1\begin{aligned} &A_3A_2C_1 = 1 \\ &A_2A_3(C_0(A_1 + B_1) + A_1B_1) = 1 \\ &A_2A_3(A_0B_0(A_1 + B_1) + A_1B_1) = 1 \end{aligned}

よって求めるオーバーフロー検知機構の回路は次の通り。

(4)

(5)

1ビットの信号 DD でオーバフローかどうかを出力し、オーバフロー発生時に 11、そうでないときに 00 を出力するとする。
(3) と同じように考え、D=1D = 1 となるのは以下の論理式を満たす場合である。

A3C2=1C2=A2C1C1=C0(A1+B1)+A1B1C0=A0+B0\begin{aligned} A_3 C_2 &= 1 \\ C_2 &= A_2 C_1 \\ C_1 &= C_0 (A_1 + \overline{B_1}) + A_1 \overline{B_1} \\ C_0 &= A_0 + \overline{B_0} \end{aligned}

これを解いて

A3C2=1A3A2C1=1A2A3(C0(A1+B1)+A1B1)=1A2A3((A0+B0)(A1+B1)+A1B1)=1A2A3(A0A1+A0B1+A1B0+B0B1)=1A0A1A2A3+A0A2A3B1+A1A2A3B0+A2A3B0B1=1\begin{aligned} &A_3 C_2 = 1 \\ &A_3 A_2 C_1 = 1 \\ &A_2 A_3 (C_0 (A_1 + \overline{B_1}) + A_1 \overline{B_1}) = 1 \\ &A_2 A_3 ((A_0 + \overline{B_0})(A_1 + \overline{B_1}) + A_1 \overline{B_1}) = 1 \\ &A_2 A_3 (A_0 A_1 + A_0 \overline{B_1} + A_1 \overline{B_0} + \overline{B_0} \overline{B_1}) = 1 \\ &A_0 A_1 A_2 A_3 + A_0 A_2 A_3 \overline{B_1} + A_1 A_2 A_3 \overline{B_0} + A_2 A_3 \overline{B_0} \overline{B_1} = 1 \end{aligned}

以上からオーバフローが発生する入力パターンは以下の通り。ただし、 *00 でも 11 でも良い。

A0A_0A1A_1A2A_2A3A_3B0B_0B1B_1
1111**
1*11*0
*1110*
001100
*111*0