跳到主要内容

東京大学 情報理工学系研究科 電子情報学専攻 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 addition/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 are NOT, AND , OR, and XOR, each 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 occurred, or '0' otherwise.

(4) 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,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) 用十进制写出 AA、BB 各自的最大值和最小值。

(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=A−BY=A-B 的行波进位加法器。可使用 A3..0A_{3..0}、B1,0B_{1,0}、VDDV_{DD} 和 GND,输出为 Y3..0Y_{3..0},并使用 (2) 中的半加器、全加器模块。

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

Kai​

(1)​

−8≤A≤7,−2≤B≤1.\boxed{-8\le A\le7,\qquad -2\le B\le1}.

最大値のビット表現は A=0111,B=01A=0111,B=01、最小値は A=1000,B=10A=1000,B=10 である。

(2)​

半加器は S=a⊕b, C=abS=a\oplus b,\ C=ab、全加器は S=a⊕b⊕c, C=ab+c(a⊕b)S=a\oplus b\oplus c,\ C=ab+c(a\oplus b) を実現する。

BB を4ビットに符号拡張して B3..0ext=(B1,B1,B1,B0)B_{3..0}^{\mathrm{ext}}=(B_1,B_1,B_1,B_0) とする。下図の UU を GND(00)に接続すれば、4段の全加器で A+BA+B が得られる。最下位段は C0=0C_0=0 なので半加器に置き換えてもよい。

Signed four-bit ripple-carry addition and subtraction

(3)​

加算の符号付きオーバーフローは、二つの入力の符号が同じで、結果の符号がその符号と異なるときに発生する。BB の符号ビットは B1B_1 なので

D=A3⊕B1‾ (A3⊕Y3).\boxed{D=\overline{A_3\oplus B_1}\,(A_3\oplus Y_3)}.

(4)​

A−B=A+Bext‾+1(mod16).A-B=A+\overline{B^{\mathrm{ext}}}+1\pmod{16}.

(2) の回路で UU を VDDV_{DD}(11)に接続する。二つの XOR ゲートにより B0,B1B_0,B_1 を反転し、B1‾\overline{B_1} を上位2段にも入力する。最下位のキャリー入力は C0=1C_0=1 とする。4段の全加器から Y3..0Y_{3..0} が得られる。

(5)​

A−B>7A-B>7 または A−B<−8A-B<-8 となる組を列挙すればよい。全入力パターンは次の4通りである。

AAA3..0A_{3..0}BBB1..0B_{1..0}真の A−BA-B
660110−2-21088
770111−2-21099
770111−1-11188
−8-810001101−9-9

減算時の検出式は D=(A3⊕B1)(A3⊕Y3)D=(A_3\oplus B_1)(A_3\oplus Y_3) である。