跳到主要内容

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

Author

Codex

Description

Independent problem summary (English)

Official examination paper, Problem 4

Design a binary recurrence generator using AND, OR, NOT gates and positive-edge-triggered D flip-flops. Gates have negligible delay; the ideal clock has no skew and connects only to flip-flop clock inputs. For positive integers 0<j1<<jm2560<j_1<\cdots<j_m\le256, initial bits x0,,x255x_0,\ldots,x_{255} determine

xn=r=1mxnjr,n256.x_n=\bigoplus_{r=1}^{m}x_{n-j_r},\qquad n\ge256.

(1) Construct a two-input XOR circuit from the permitted gates.

(2) Three flip-flops are cascaded: the external input feeds D1D_1, Q1Q_1 feeds D2D_2, and Q2Q_2 feeds D3D_3. They share the clock and initially store zero. Draw all three outputs for the input and clock below.

Input and clock waveforms

(3) Use 512 flip-flops, X1,,X256X_1,\ldots,X_{256} and C1,,C256C_1,\ldots,C_{256}. Initially Xi=x256iX_i=x_{256-i} and Ci=1C_i=1 exactly at the selected tap indices. Design the circuit so that after kk clock edges, Xi=x256i+kX_i=x_{256-i+k}.

(4) Add inputs W,X0,C0W,X_0,C_0. When W=0W=0, each rising edge must copy Xi1X_{i-1} into XiX_i and Ci1C_{i-1} into CiC_i. When W=1W=1, perform the recurrence from (3). Give the required circuit changes.

Kai

(1)

For two input bits a,ba,b,

ab=(a¬b)(¬ab).a\oplus b=(a\land\neg b)\lor(\neg a\land b).

Use two NOT gates, two AND gates and one OR gate. The two AND outputs are disjoint: the result is one precisely for (a,b)=(1,0)(a,b)=(1,0) or (0,1)(0,1).

AND, OR and NOT implementation of XOR

(2)

At every rising edge, all flip-flops sample their inputs simultaneously. If uku_k is the external input at the kk-th edge, then

Q1(k)=uk,Q2(k)=Q1(k1),Q3(k)=Q2(k1).Q_1(k)=u_k,\qquad Q_2(k)=Q_1(k-1),\qquad Q_3(k)=Q_2(k-1).

All three outputs retain their values between rising edges. With the given initial zeros:

Rising edge kk123456
Input uku_k110100
Q1(k)Q_1(k)110100
Q2(k)Q_2(k)011010
Q3(k)Q_3(k)001101

Three-stage shift-register output timing

(3)

Let XiX_i and CiC_i also denote the current output bits of their flip-flops. Form the combinational feedback

Ti=CiXi,F=i=1256Ti.T_i=C_i\land X_i,\qquad F=\bigoplus_{i=1}^{256}T_i.

A cascade or tree of 255 two-input XOR circuits from (1) implements this expression; each tap term requires an AND gate. Connect the D inputs as follows:

D(X1)=F,D(Xi)=Xi1(2i256),D(Ci)=Ci(1i256).\begin{aligned} D(X_1)&=F,\\ D(X_i)&=X_{i-1} &&(2\le i\le256),\\ D(C_i)&=C_i &&(1\le i\le256). \end{aligned}

All 512 flip-flops share the unchanged clock. Each CiC_i retains its initialized tap bit.

To prove correctness, suppose that after kk edges, Xi=x256i+kX_i=x_{256-i+k}. Immediately before edge k+1k+1,

F=r=1mx256jr+k=x256+k.F=\bigoplus_{r=1}^{m}x_{256-j_r+k}=x_{256+k}.

Thus the next value of X1X_1 is x256+kx_{256+k}, and for i2i\ge2 the next value is

Xi1=x256(i1)+k=x256i+(k+1).X_{i-1}=x_{256-(i-1)+k}=x_{256-i+(k+1)}.

The initialization supplies the induction base k=0k=0.

Recurrence generator and load/run input equations

(4)

A multiplexer selecting bb when W=0W=0 and aa when W=1W=1 can be implemented as

muxW(a,b)=(Wa)(¬Wb).\operatorname{mux}_W(a,b)=(W\land a)\lor(\neg W\land b).

Use it at the D inputs:

D(X1)=muxW(F,X0),D(Xi)=Xi1(2i256),D(Ci)=muxW(Ci,Ci1)(1i256).\begin{aligned} D(X_1)&=\operatorname{mux}_W(F,X_0),\\ D(X_i)&=X_{i-1} &&(2\le i\le256),\\ D(C_i)&=\operatorname{mux}_W(C_i,C_{i-1}) &&(1\le i\le256). \end{aligned}

Here X0,C0X_0,C_0 are external inputs. For i2i\ge2, both modes require the same shift of XiX_i, so no selection gate is needed there. The tap registers shift in load mode and retain their values in recurrence mode. The clock continues to connect only to the flip-flop clock pins.

To load prescribed values Xi,CiX_i^*,C_i^*, keep W=0W=0 for 256 rising edges and supply X257k,C257kX_{257-k}^*,C_{257-k}^* at edge kk. After the final load edge, all registers contain their prescribed values; set W=1W=1 to begin generation.