45
Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu [email protected] 1

EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

  • Upload
    ngodang

  • View
    228

  • Download
    1

Embed Size (px)

Citation preview

Page 1: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

EITF35: Introduction to Structured

VLSI Design

Part 3.1.1: FSMD

Liang Liu

[email protected]

1

Page 2: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Outline

FSMD Overview

Algorithmic state machine with data-path (ASMD)

FSMD design of a repetitive-addition multiplier

Timing analysis of FSMD

2

Page 3: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Why FSMD? Start with algorithm

Task: sums four elements of an array, divides the sum by 8 and

rounds the result to the closest integer

Two characteristics of an algorithm:

• Use of variables

e.g., sum, or q = q + 1

• Sequential execution

e.g., sum must be finished before division

Algorithm: a sequence

steps of actions

3

Page 4: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

“Dataflow” implementation in VHDL

• Convert the algorithm in to combinational circuit

Converting algorithm to hardware

4

The ”sequential”

operations are

represented by the data

flow from left to right

Page 5: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Problems with dataflow implementation:

• Can only be applied to simple trivial algorithm

• Not flexible

What if size=10, 100, 1000 …

or size = n, i.e., size is determined by an external input

or changing operation depending on instructions

Dataflow Implementation: Drawbacks

5

Page 6: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Alternatively?

Hardware resembles the variable and sequential execution

model

• Use register to store intermediate data and imitate variable

e.g. sum=sum+a => sum_reg+a_reg->sum_reg

• Basic format of RT operation

rdest f (rsrc1, …, rsrcn)• Sequence of data manipulation and transfer among registers (RTL)

6

Page 7: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

RT Operation: Timing

Timing:

• Hardware! major difference between a variable and a register is that a

clock is embedded in an RT operation

• Rising edge of clk: outputs of source reg rsrc1 rsrc2 etc. are available

• The output are passed to a combinational circuit that performs f( )

• At the NEXT rising edge of the clock, the result is stored into rdest

7

R1

D QCOMB

f( )In

ClktClk1

R2

D Q

tClk2

Page 8: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Hardware Mapping of RT: Example 1

E.g. r1 r1+r2

• C1: r1_next<=r1_reg+r2_reg

• C2: r1_reg<=r1_next

8

Page 9: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Hardware Mapping of RT: Example 1

E.g. r1 r1+r2

• C1: r1_next<=r1_reg+r2_reg

• C2: r1_reg<=r1_next

9

Page 10: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Multiple RT operationsHow can we organize multiple

operations on one register (in

a time-multiplexing way)?

Hardware Mapping of RT: Example 2

Control signals are needed!

10

Page 11: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSM as Control Path

FSMD: FSM with data path

• Use a data path to realize all the

required RT operations

• Use a control path (FSM) to

specify the order of RT operation

11

Page 12: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSMD (FSM with Date Path)

12

Page 13: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSMD (FSM with Date Path)

Control Path: FSM

•Command: the external command signal to the FSMD

•Internal status: signal from the data path.

•Control signal: output, used to control data path operation.

•External status: output, used to indicate the status of the FSMD

13

Page 14: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSMD (FSM with Date Path)

Data Path: perform all the required RT operations

•Data registers: store the intermediate results.

•Functional units: perform RT operations

•Routing circuit: connection, selection (multiplexers)

14

Page 15: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Outline

Overview of FSMD

Algorithmic state machine with data-path (ASMD)

FSMD design of a repetitive-addition multiplier

Timing analysis of FSMD

15

Page 16: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

ASM (algorithmic state machine) chart

•Flowchart-like diagram, provide the same information as an FSM

•More descriptive, better for complex algorithm

•Can easily be transformed to VHDL code

ASM (algorithmic state machine)

An ASM chart is a network

of ASM blocks

One state box: FSM state

Decision boxes: with T or

F exit path: next state logic

Conditional output boxes:

for Mealy output

16

Page 17: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

State Diagram and ASM Chart: Example 1

Moore FSM

17

Page 18: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Moore and Mealy

State Diagram and ASM Chart: Example 2

18

Page 19: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

ASMD

19

ASMD:

Extend ASM chart to incorporate RT operations

RT operations are treated as another type of activity and be

placed where the output signals are used

S0:

r1r1+1

if a>b

r2r2+a

else

r2r2+b

+

Page 20: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Suggestion: use meaningful names for your

signals (direction_function_type)

ASMD: Timing Value is available at the

register input before the

NEXT clock tick

20

reg

reg

reg

comb

comb

Page 21: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Suggestion: use meaningful names for your

signals (direction_function_type)

ASMD: Timing Value is available at the

register input before the

NEXT clock tick

21

reg

reg

reg

comb

comb

Page 22: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Outline

Overview of FSMD

Algorithmic state machine with data-path (ASMD)

FSMD design of a repetitive-addition multiplier

Timing analysis of FSMD

22

Page 23: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Map Algorithm to FSMD

Example: Repetitive addition multiplier

Basic algorithm: 7*5 = 7+7+7+7+7

Pseudo code ASMD-friendly code

23

Page 24: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Map Algorithm to FSMD

Example: Repetitive addition multiplier

Basic algorithm: 7*5 = 7+7+7+7+7

Pseudo code ASMD-friendly code

Watch Out!

No loop in ASMD

Un-synthesizable

24

Page 25: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Input:

•a_in, b_in: 8-bit unsigned

•clk, reset

•start: command

Output:

•r: 16-bit unsigned

•ready: ready for new input

ASMD chart

•3 registers (n,a,r)

•4 states

•Data-path: RT operations

•FSM: state transition

ASMD Chart

25

Translate ASMD to Hardware

Page 26: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Construction of the data path

• List all possible RT operations

• Group RT operation according to the destination register

• Add combinational circuit/mux

Construction of FSMD

26

a

b

ab0

Grouping RT

Operations

a

a

a

a

a

Page 27: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Circuit associated with r register

ab0

a

Construction of the Date Path

27

Page 28: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Continue with

n-register

a-register

Add status circuits

28

Construction of the Date Path

Page 29: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Input of FSM

•External: start, clock, reset

•Internal: decision box in ASMD

Output of FSM

Construction of the Control Path

29

Decision Box

Page 30: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Entity

VHDL Follow the Block Diagram

30

Page 31: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSM (state registers)

31

Page 32: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

FSM (next-state/output logic)

32

Page 33: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Data Path (Data Registers)

33

Page 34: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Data Path (Function Unit)

34

Page 35: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Data Path (Multiplexer Routing)

35

Page 36: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Design Flow

36

task/algorithm

RT

opt.

state

trans.

data path control

reg function muxstate

regcomb.

VHDL

ASMD

Circuit

Page 37: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Outline

Overview of FSMD

Algorithmic state machine with data-path (ASMD)

FSMD design of a repetitive-addition multiplier

Timing analysis of FSMD

37

Page 38: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Timing and Performance of FSMD

Maximal clock rate

•More difficult to analyze because of two interactive loops, depend on the

specified design

•The boundary of the clock rate can be found, best/worse-case

38

Page 39: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Best-Case

Best-case scenario:

•Control signals needed at late stage

•Status signal available at early stage

39

Input to the

next_state

logic

Input to the

next_data

logic

Page 40: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Best-Case

Best-case scenario

•Output logic overlaps with the data path, no extra delay

•Next-state logic of the control path and the data path are in parallel

•Clock rate dominates by the data-path (most of the case)

40

Page 41: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Best-Case

Best-case scenario

•Output logic overlaps with the data path, no extra delay

•Next-state logic of the control path and the data path are in parallel

•Clock rate dominates by the data-path (most of the case)

41

Page 42: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Worst-Case

Worst-case scenario:

•Control signals needed at early stage

•Status signal available at late stage

42

?

Page 43: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Thanks!

Page 44: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Worst-Case

Worst-case scenario

•The data path must wait for the FSM to generate the output signals

•The control path must wait for status signals to generate the next-state

•Clock period includes the delays of all combinational components

44

Page 45: EITF35: Introduction to Structured VLSI Design ·  · 2014-09-15Lund University / EITF35/ Liang Liu 2014 EITF35: Introduction to Structured VLSI Design Part 3.1.1: FSMD Liang Liu

Lund University / EITF35/ Liang Liu 2014

Clock-Rate Boundary: Worst-Case

Worst-case scenario

•The data path must wait for the FSM to generate the output signals

•The control path must wait for status signals to generate the next-state

•Clock period includes the delays of all combinational components

45