90 likes | 180 Views
CS 140 Lecture 16 System Designs. Professor CK Cheng CSE Dept. UC San Diego. System Designs. Intro Components Implementation. Implementation: Example. Given a hardware program, implement data path and control subsystems. { Input X<0:7>, Y<0:7> type bit-vector, start type boolean;
E N D
CS 140 Lecture 16System Designs Professor CK Cheng CSE Dept. UC San Diego
System Designs • Intro • Components • Implementation
Implementation: Example Given a hardware program, implement data path and control subsystems { Input X<0:7>, Y<0:7> type bit-vector, start type boolean; Local-Object A<0:7>, B<0:7> type bit-vector; Output Z<0:7> type bit-vector, done type boolean; Wait: If start’ goto Wait; S1: A <= X || B <= Y|| done <= 0; S2: If B >= 0 goto S4; S3: B <= -B; S4: If A >= B goto S6; S5: A <= A + 1 || B <= B-1 || goto S4; S6: Z <= 4 * A || done <= 1 || goto Wait; }
8 X Data Subsystem 8 Z 8 (A > B) Y B7 C1-7 Control Subsystem done start 4 Ceiling[ (X + |Y| )/ 2] if X< |Y| 4X otherwise Z =
control C1 C2 C3 C4 C5 C6 C7 operation A Load (X) B Load (Y) B CS (B) Comp (A, B) A INC (A) B DEC (B) Z Load (A) Z SHL (Z) A X B Y B -B A >= B A A + 1 B B – 1 Z 4A
CS DEC B Y Z Comp C2 C3 C5 C1 C4 C6 C7 X A Control Unit C1 C2 C3 INC C4 B<7> C5 C6 start C7 done
Designing the control unit S0: S1: S2: S3: S4: S5: S6: S7: S8: If start’, goto S0, else goto S1 A X || B Y || done 0 || goto S2 If B’<7> goto S4, else goto S3 B CS (B), goto S4 If k goto S6, else goto S5 A INC (A), B DEC (B), goto S4 Z A goto S7 Z SHL (z), goto S8 Z SHL (z), done 1, goto S0
State Machine S0 start’ start S1 S8 S2 S7 B’<7> B<7> S6 S3 k k’ S4 S5
S8 S0 start’ start S7 S1 S6 S2 B7’ B7 S5 k S3 k’ S4