# CS 140 Lecture 16 System Designs Professor CK Cheng CSE Dept. UC San Diego 1.

## Presentation on theme: "CS 140 Lecture 16 System Designs Professor CK Cheng CSE Dept. UC San Diego 1."— Presentation transcript:

CS 140 Lecture 16 System Designs Professor CK Cheng CSE Dept. UC San Diego 1

System Designs 1.Intro 2.Components 3.Implementation 2

Implementation: Example Given a hardware program, implement data path and control subsystems { Input X, Y type bit-vector, start type boolean; Local-Object A, B type bit-vector; Output Z 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; } 3

Data Subsystem Control Subsystem C 1-7 (A > B) B7B7 X Y start Z done Z = 4 Ceiling[ (X + |Y| )/ 2] if X< |Y| 4X otherwise 8 8 8 4

A  X B  Y B  -B A >= B A  A + 1 B  B – 1 Z  4A 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) control C 1 C 2 C 3 C 4 C 5 C 6 C 7 5

B A C2C2 C3C3 C5C5 C1C1 C4C4 X INC Comp Z Control Unit B C6C6 C7C7 CS DEC Y C1C1 C2C2 C3C3 C4C4 C5C5 C6C6 C7C7 start done 6

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’ 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 Designing the control unit 7

State Machine S0 S1 S2 S3 S4 S8 S7 S6 S5 k’ k B B’ start’ start 8

9 Control Subsystem: One-Hot State Machine Design Input: State Diagram 1.Use a flip flop to replace each state. 2.Set the flip flop which corresponds to the initial state and reset the rest flip flops. 3.Use an OR gate to collect all inward edges. 4.Use a Demux to distribute the outward edges.

start start’ S2 S3 B7B7’ S5 S6 S0 S1 S4 k k’ S7 S8 10 One-Hot State Machine

Download ppt "CS 140 Lecture 16 System Designs Professor CK Cheng CSE Dept. UC San Diego 1."

Similar presentations