Lecture 16: Midterm Review (RTL and Timing) CSE 140: Components and - - PowerPoint PPT Presentation

lecture 16 midterm review rtl and timing cse 140
SMART_READER_LITE
LIVE PREVIEW

Lecture 16: Midterm Review (RTL and Timing) CSE 140: Components and - - PowerPoint PPT Presentation

Lecture 16: Midterm Review (RTL and Timing) CSE 140: Components and Design Techniques for Digital Systems Diba Mirza Dept. of Computer Science and Engineering University of California, San Diego 1 Final breakup Multiple Choice (Misc):


slide-1
SLIDE 1

Lecture 16: Midterm Review (RTL and Timing) CSE 140: Components and Design Techniques for Digital Systems

Diba Mirza

  • Dept. of Computer Science and Engineering

University of California, San Diego

1

slide-2
SLIDE 2

Final breakup

  • Multiple Choice (Misc): 12%
  • Timing and MUX/Decoder: 38%
  • RTL Design and Simulating circuit

behavior in RTL: 50%

slide-3
SLIDE 3

RTL Design (HLSM)

  • Deriving the HLSM (simple examples)
  • Simulating the circuit behavior (via timing

diagrams)

slide-4
SLIDE 4

Problem: Input B (1 bit), output P(1 bit) should go high for two clock cycles every time B goes high

slide-5
SLIDE 5
slide-6
SLIDE 6
slide-7
SLIDE 7

7

HLSMs

Q: What is the final state that is reached for the given HLSM?

  • A. State A
  • B. State B
  • C. State C
  • D. State D

A B C D (R<100)' R<100 R:=R+1 R:=99 Q:=R Local storage : R, Q (8 bits)

slide-8
SLIDE 8

8

HLSMs

Q: What is the final state that is reached for the given HLSM?

  • A. State A
  • B. State B
  • C. State C
  • D. State D

A B C D (R<100)' R<100 R:=R+1 R:=99 Q:=R Local storage : R, Q (8 bits) ? ?

99

A 99 ?

100

B 100 ?

R<100 clk R Q

slide-9
SLIDE 9

9

HLSMs

Q: Are the two HLSMs equivalent?

  • A. Yes
  • B. No

A B C D (R<100)' R<100 R:=R+1 R:=99 Q:=R Local storage : R, Q (8 bits) A B C D (R<100)' R<100 R:=R+1 R:=99 Q:=R Local storage : R, Q (8 bits) HLSM 1 HLSM 2

slide-10
SLIDE 10

Function Modules: Counter (updates to i)

10

C3

Y

LD

Register B D R C0

X

LD

16 Register A D R A C2

CLR

16 Register M D R M Adder A B S 1

LD

C4 << SHL B[15] B Selector << SHL 16 C1 Selector C5 1

C6 C7

CLR Inc

i[4] Counter i D R Source: CK Cheng

  • peration

A ß ß Load (X) B ß ß Load (Y) B ß SHL(B) Mß ß Clear(M) Mß Add(M,A) M ß SHL(M) iß Clear(i) i ß INC(i)

slide-11
SLIDE 11

11

C3

Y

LD

Register B D R C0

X

LD

16 Register A D R A C2

CLR

16 Register M D R M Adder A B S 1

LD

C4 << SHL B[15] B Selector << SHL 16 C1 Selector C5 1

C6 C7

CLR Inc

i[4] Counter i D R

Step 2d: Map Control Signals to Operations

Source: CK Cheng

  • peration

A ß ß Load (X) C0=1 B ß ß Load (Y) C5=0 and C3 =1 B ß SHL(B) C5=1 and C3 =1 Mß ß Clear(M) C2 =1 Mß Add(M,A) C4=0 and C1=1 M ß SHL(M) C4=1 and C1=1 iß Clear(i) C6=1 i ß INC(i) C7=1

slide-12
SLIDE 12

Data Subsystem Control Subsystem C0:7 X Y start Z done 16 16 32

12

B[15], i[4]

Source: CK Cheng

slide-13
SLIDE 13

Design the Control Subsystem

13

Multiply(X, Y, Z, start, done) {

S0: If start’ goto S0 || doneß ß1; S1: Aß ß X || B ß ßY || iß ß0 || Mß ß0 || done ß ß0; S2: If B15 = 0 goto S4 || iß ßi+1; S3: M ß ßM+A; S4: if i>= 16, goto S6 S5: Mß ßShift(M,L,1) || Bß ßShift(B,L,1) || goto S2; S6: Z:ß ßM || doneß ß1|| goto S0 } Source: CK Cheng

Multiply(X, Y, Z, start, done) {

S0: If start’ goto S0 || doneß ß1; S1: C0=1 || C5=0 and C3 =1 || C6=1|| C2 =1 || done ß ß0; S2: If B15 = 0 goto S4 || C7=1; S3: C4=0 and C1=1; S4: if i[4], goto S6 S5: C4=1 and C1=1|| C5=1 and C3 =1 || goto S2; S6: Z:ß ßM || doneß ß1|| goto S0 }

  • peration

A ß ß Load (X) C0=1 B ß ß Load (Y) C5=0 and C3 =1 B ß SHL(B) C5=1 and C3 =1 Mß ß Clear(M) C2 =1 Mß Add(M,A) C4=0 and C1=1 M ß SHL(M) C4=1 and C1=1 iß Clear(i) C6=1 i ß INC(i) C7=1

slide-14
SLIDE 14

Control Subsystem

14

S0 S1 S2 S3 S5 S4 B[15] start’ start i[4] B[15]’ i[4]’ S6 Source: CK Cheng

Multiply(X, Y, Z, start, done) {

S0: If start’ goto S0 || doneß ß1; S1: C0=1 || C5=0 and C3 =1 || C6=1|| C2 =1 || done ß ß0; S2: If B15 = 0 goto S4 || C7=1; S3: C4=0 and C1=1; S4: if i[4], goto S6 S5: C4=1 and C1=1|| C5=1 and C3 =1 || goto S2; S6: Z:ß ßM || doneß ß1|| goto S0 }

slide-15
SLIDE 15

15

One-Hot State Machine

S0 S1 S2 S3 S5 S4 B[15] start’ start i[4] B[15]’ i[4]’ S6 Source: CK Cheng

slide-16
SLIDE 16

start

start’ S2 S3

B15 B15’

S5 S6 S0 S1 S4 i[4] i[4]’

16

One-Hot State Machine

S0 S1 S2 S3 S5 S4 B[15] start’ start i[4] B[15]’ i[4]’ S6 Source: CK Cheng

slide-17
SLIDE 17

17

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.

Source: CK Cheng

slide-18
SLIDE 18

18

C3

Y

LD

Register B D R C0

X

LD

16 Register A D R A C2

CLR

16 Register M D R M Adder A B S 1

LD

C4 << SHL B[15] B Selector << SHL 16 C1 Selector C5 1

C6 C7

CLR Inc

i[4] Counter i D R

Data Subsystem

Source: CK Cheng

slide-19
SLIDE 19

19

C0 C1 C2 C3 C4 (mux) C5 (mux) C6 C7 done S0 X X 1 S1 1 1 X 1 S2 1 X X 1 S3 1 X S4 X X S5 1 1 1 1 S6 X X 1 Source: CK Cheng

Multiply(X, Y, Z, start, done) {

S0: If start’ goto S0 || doneß ß1; S1: C0=1 || C5=0 and C3 =1 || C6=1|| C2 =1 || done ß ß0; S2: If B15 = 0 goto S4 || C7=1; S3: C4=0 and C1=1; S4: if i[4], goto S6 S5: C4=1 and C1=1|| C5=1 and C3 =1 || goto S2; S6: Z:ß ßM || doneß ß1|| goto S0 }

slide-20
SLIDE 20

Best of luck for the Final Exam!

20