跳到主要内容

東京大学 情報理工学系研究科 コンピュータ科学専攻 2016年2月実施 問題4

Author

kainoj, 祭音Myyura

Description

The majority gate M3\text{M}_3 is a binary logic gate defined as follows: M3\text{M}_3 has 33 inputs and 11 output. The output is 11 if two or three of the inputs are 1; and 0 otherwise.

When you answer circuit designs in the questions below, you can use NOT gates and constants 00 and 11 in addition to M3\text{M}_3 gates, but other gates such as AND or OR cannot be used. You should draw an M3\text{M}_3 gate as a rectangle labeled with M3\text{M}_3, and a NOT gate as a circle, as shown in the following example:

Answer the following questions. Try to make M3\text{M}_3-levels (i.e. the maximum number of serially connected M3\text{M}_3 gates) as small as possible in your answers.

(1) Design and depict the following logic circuits:

  • (a) AND of 22 inputs,
  • (b) OR of 22 inputs,
  • (cc) XOR of 22 inputs.

(2) A 1-bit full adder FA1\text{FA}_1 is defined as follows: FA1\text{FA}_1 has 33 inputs and 22 outputs called S\text{S} (sum) and C\text{C} (carry), respectively. S\text{S} and C\text{C} are defined so that 2C+S2\text{C} + \text{S} is equal to the sum of the 33 input bits.
Design and depict a 11-bit full adder FA1\text{FA}_1. Answer its M3\text{M}_3-level, too. You can use the circuits you have designed in Question (1).

(3) Design and depict a 44-bit full adder FA4\text{FA}_4. Answer its M3\text{M}_3-level, too.

Here FA4\text{FA}_4 takes, as inputs: (i) two unsigned 44-bit integers, and (ii) a carry bit.
It outputs the 55-bit sum. You can use the circuits you have designed in Questions (1) and (2).

(4) Design and depict a 44-bit multiplier MUL4\text{MUL}_4. Answer its M3\text{M}_3-level, too.

Here MUL4\text{MUL}_4 takes two unsigned 44-bit integers as inputs. It outputs the 88-bit product of the inputs. You can use the circuits you have designed in Questions (1), (2), and (3).

题目描述

三输入多数门 M3\mathrm{M}_3 有三个输入和一个输出:三个输入中至少有两个为 11 时输出 11,否则输出 00

以下各题设计电路时,除 M3\mathrm{M}_3 外只可使用非门和常量 0,10,1,不得使用与门、或门等其他门。绘图时按题中示例,用标有 M3\mathrm{M}_3 的矩形表示多数门,用圆形表示非门。回答时应尽量减小 M3\mathrm{M}_3 层数,即任一通路上串联的 M3\mathrm{M}_3 门的最大数量。

(1)设计并画出以下逻辑电路:

  • 两输入与;
  • 两输入或;
  • 两输入异或。

(2)一位全加器 FA1\mathrm{FA}_1 有三个输入以及和位 S\mathrm{S}、进位 C\mathrm{C} 两个输出,且要求 2C+S2\mathrm{C}+\mathrm{S} 等于三个输入位之和。设计并画出 FA1\mathrm{FA}_1,同时给出其 M3\mathrm{M}_3 层数。可以使用第(1)问设计的电路。

(3)设计并画出四位全加器 FA4\mathrm{FA}_4,并给出其 M3\mathrm{M}_3 层数。该电路输入两个无符号四位整数和一个进位位,输出五位和;可以使用第(1)、(2)问的电路。

(4)设计并画出四位乘法器 MUL4\mathrm{MUL}_4,并给出其 M3\mathrm{M}_3 层数。该电路输入两个无符号四位整数,输出八位乘积;可以使用前面各问设计的电路。

Kai

(1)

  • AND(x,y)=M3(0,x,y)\operatorname{AND}(x,y)=\operatorname{M}_3(0,x,y)
  • OR(x,y)=M3(1,x,y)\operatorname{OR}(x,y)=\operatorname{M}_3(1,x,y)
  • XOR(x,y)=M3 ⁣(0,M3(1,x,y),¬M3(0,x,y))\operatorname{XOR}(x,y)=\operatorname{M}_3\!\left(0,\operatorname{M}_3(1,x,y),\neg\operatorname{M}_3(0,x,y)\right)

XOR is "22-M3\text{M}_3-level".

(2)

Classic 11-bit full adder. Just draw a table and then depict the circuit. Let a,b,cina,b,c_{in} be inputs.

The direct construction from (1),

S=(aXORb)XORcin,C=(ab){cin(ab)},S=(a\mathbin{\mathrm{XOR}}b)\mathbin{\mathrm{XOR}}c_{in}, \qquad C=(a\land b)\lor\{c_{in}\land(a\lor b)\},

is valid and has four M3\mathrm M_3 levels. A smaller equivalent construction is

C=M3(a,b,cin),T=M3(b,cin,¬a),S=M3(¬C,a,T).\begin{aligned} C&=\operatorname M_3(a,b,c_{in}),\\ T&=\operatorname M_3(b,c_{in},\neg a),\\ S&=\operatorname M_3(\neg C,a,T). \end{aligned}

Its truth table gives 2C+S=a+b+cin2C+S=a+b+c_{in}, and FA1\mathrm{FA}_1 has two M3\mathrm M_3 levels.

(3)

Connect four FA1\mathrm{FA}_1 cells as a ripple-carry adder, with Ci+1=M3(ai,bi,Ci)C_{i+1}=\operatorname M_3(a_i,b_i,C_i). Carry CiC_i has depth ii, and SiS_i needs two further majority levels; therefore the 44-bit adder has M3\mathrm M_3-level 55 (at S3S_3).

(4)

Use the shift-and-add circuit shown: generate all partial products pij=M3(0,ai,bj)p_{ij}=\operatorname M_3(0,a_i,b_j) in parallel, and combine the four shifted rows with three ripple-carry adders. Including the one partial-product level, the maximum depths after the first, second, and third adder rows are respectively 66, 99, and 1212. Thus this MUL4\mathrm{MUL}_4 has M3\mathrm M_3-level 1212.