lecture 9 rtl design methodology sorting example

16
Lecture 9 RTL Design Methodology Sorting Example

Upload: karah

Post on 31-Jan-2016

53 views

Category:

Documents


0 download

DESCRIPTION

Lecture 9 RTL Design Methodology Sorting Example. Required reading. P. Chu, FPGA Prototyping by VHDL Examples Chapter 6, FSMD. S. Brown and Z. Vranesic , Fundamentals of Digital Logic with VHDL Design Chapter 10.2, Design Examples. Structure of a Typical Digital System. Data Inputs. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture 9 RTL Design Methodology Sorting Example

Lecture 9

RTL Design Methodology

Sorting Example

Page 2: Lecture 9 RTL Design Methodology Sorting Example

2ECE 448 – FPGA and ASIC Design with VHDL

Required reading

• S. Brown and Z. Vranesic, Fundamentals of Digital Logic with VHDL Design

Chapter 10.2, Design Examples

• P. Chu, FPGA Prototyping by VHDL Examples

Chapter 6, FSMD

Page 3: Lecture 9 RTL Design Methodology Sorting Example

Structure of a Typical Digital System

Datapath(Execution

Unit)

Controller(Control

Unit)

Data Inputs

Data Outputs

Control & Status Inputs

Control & Status Outputs

Control Signals

StatusSignals

Page 4: Lecture 9 RTL Design Methodology Sorting Example

Hardware Design with RTL VHDL

Pseudocode

Datapath Controller

Block

diagram

Block

diagram

State diagram

or ASM chart

VHDL code VHDL code VHDL code

Interface

Page 5: Lecture 9 RTL Design Methodology Sorting Example

Steps of the Design Process

1. Text description2. Interface3. Pseudocode4. Block diagram of the Datapath5. Interface with the division into the Datapath and the Controller6. ASM chart of the Controller7. RTL VHDL code of the Datapath, the Controller, and the Top

Unit8. Testbench of the Datapath, the Controller, and the Top Unit9. Functional simulation and debugging10. Synthesis and post-synthesis simulation11. Implementation and timing simulation12. Experimental testing

Page 6: Lecture 9 RTL Design Methodology Sorting Example

Steps of the Design ProcessPracticed in Class Today

1. Text description2. Interface3. Pseudocode4. Block diagram of the Datapath5. Interface with the division into the Datapath and the Controller6. ASM chart of the Controller7. RTL VHDL code of the Datapath, the Controller, and the

Top Unit8. Testbench of the Datapath, the Controller, and the Top

Unit9. Functional simulation and debugging10. Synthesis and post-synthesis simulation11. Implementation and timing simulation12. Experimental testing

Page 7: Lecture 9 RTL Design Methodology Sorting Example

Sorting

example

Page 8: Lecture 9 RTL Design Methodology Sorting Example

Sorting - Required Interface

Sorting

Clock

Resetn

DataInN

DataOut

N

DoneRAdd

L

WrInit

S(0=initialization 1=computations)

Rd

Page 9: Lecture 9 RTL Design Methodology Sorting Example

Sorting - Required Interface

Page 10: Lecture 9 RTL Design Methodology Sorting Example

Simulation results for the sort operation (1)Loading memory and starting sorting

Page 11: Lecture 9 RTL Design Methodology Sorting Example

Simulation results for the sort operation (2)Completing sorting and reading out memory

Page 12: Lecture 9 RTL Design Methodology Sorting Example

Before

sorting

During Sorting After

sorting

Address

0

1

2

3

3 3 2 2 1 1 1 1

2 2 3 3 3 3 2 2

4 4 4 4 4 4 4 3

1 1 1 1 2 2 3 4

i=0 i=0 i=0 i=1 i=1 i=2

j=1 j=2 j=3 j=2 j=3 j=3

MiMj

Legend:position of memory

indexed by i

position of memory

indexed by j

Sorting - Example

Page 13: Lecture 9 RTL Design Methodology Sorting Example

Pseudocode

for i = 0 tok 2 doA = ; for j = i + 1 tok 1 do

B = Mj ; if B < A then

Mi = B ; Mj = A ; A = Mi ;

endif ; endfor;

endfor;

-[load input data]

[read output data]

for i = 0 to 2 doA = Mi ; for j = i + 1 to3 do

B = Mj ; if B < A then

Mi = B ; Mj = A ; A = Mi ;

endif ; endfor;

endfor;

[load input data]

[read output data]

FOR k = 4 FOR any k ≥ 2

Mi

Page 14: Lecture 9 RTL Design Methodology Sorting Example

Pseudocode

wait for s=1for i=0 to k-2 do

A = Mi

for j=i+1 to k-1 doB = Mj

if A > B thenMi = BMj = AA = Mi

end ifend for

end forDonewait for s=0go to the beginning

Page 15: Lecture 9 RTL Design Methodology Sorting Example

DIN

DOUT

ADDR

WE

CLK

ENCLK RST

ENCLK RST

A>B

01 s

WrInit

Clock

Clock

Clock

Resetn Resetn

Wr

1 0 Bout

EA EB

AgtB

Addr

s

0

10

1

DataIn RAdd

Rd

DataOut

Csel

ENCLK

LDRST

Resetn

ENCLK

LDRST

Resetn

LiEi

Clock

LjEj

Clock

= k-2 = k-1

zi zj

NL

L

LL

N N

N

N

N

ABMux

A B

i

j

Mij

Din

We

0

L

+1

Block diagram of the Datapath

Page 16: Lecture 9 RTL Design Methodology Sorting Example

N

Clock Resetn

DataOut

N

WrInit s

Done

Wr

Li

Ei

Lj

Ej

EA

EB

Bout

Csel

Datapath Controller

RAddr

L

zi

Interface with the division into the Datapath and the Controller

DataIn Rd

AgtB

zj