CS 140L Lecture 7 Professor CK Cheng 5/13/02
Announcements State Assignment: Chapters 7.4.3, 7.7.3, kinds of coding: 1) Binary – [ log 2 n ] bits 000,001,110, etc. 2) Gray – can change by only 1 bit i.e. 000-> 001->011->010. 3) Johnson - [ n/2 ] (bits) number of flip flops.
4) One hot: We use n F-Fs for n states. Q i = 1 iff present state = S i. S0 0 S1 0 1 S D Q Q’ X X’ D Q Q’ X X’ D Q Q’ X X’ (X not true -> back to 1 st FF, else to 2 nd ) Use OR gates to collect the inputs Use AND gates to branch out the transition
5) “Don’t Care State” coding S(n-1) S(n-2). S1 S0 Q n Q n Q Q State i Q j = 0 V j i Q i = 1 Q j = x V j i
System Design Inst R1 R2R3 I2I2 I1I1 I0I0 D3D3 D2D2 D1D1 D0D0 I 2 I 1 I Init Move 1 Move 2 Store Add Shift Comp Mask
Wrap Around Shift Init: R1 = R2 = R3 = (0,0,0,0) Mov1: R1 = (a,b,c,d) Mov2: R2 = (a,b,c,d) Store: R2 = R3 Add: R3 = R1 + R2 Overflow flag Shift: R3 = (R2 Shift left by (a,b) bits) Comp: flag(R1, R2) = 1 iff R1 > R2 And: R3 = (R1)&(R2)