+ All Categories
Home > Documents > TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA,...

TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA,...

Date post: 09-Apr-2018
Category:
Upload: hadung
View: 219 times
Download: 2 times
Share this document with a friend
25
8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010 http://www.tkt.cs.tut.fi/kurssit/1426/ Tampere University of Technology Department of Computer Systems Waqar Hussain 31.08.2010 23:49 2 Lecture Contents Lecture 1: Introduction Course arrangements Recap of basic digital design concepts EDA tool demonstration
Transcript
Page 1: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

1

TKT-1426 Digital design for FPGA, 6cpFall 2010http://www.tkt.cs.tut.fi/kurssit/1426/

Tampere University of TechnologyDepartment of Computer SystemsWaqar Hussain

31.08.2010 23:492

Lecture Contents

Lecture 1:• Introduction• Course arrangements• Recap of basic digital design concepts• EDA tool demonstration

Page 2: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

2

Course History

• Last year, the course was taught byRiku UusikartanoFabio Garzia

o Emails : [email protected]

• They have the major contribution in preparing the lecture notes

3

31.08.2010 23:494

Course Goals• Teach digital design for FPGAs

EDA tools, Altera DE2 FPGA platformHands-on work

• Bring the knowledge level and skill set up to par with finnish students

’Need-to-know’ approach• Prepare for studying more advanced courses• Prepare for M.Sc. Thesis work

FPGA design skills often needed in the department’s projects, and within industrial companies

Page 3: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

3

31.08.2010 23:495

International Studies

31.08.2010 23:496

Course Content• Computer-aided digital circuit design using EDA tools

Design software: Mentor Graphics' HDL Designer• Design fundamentals: Synchronous, hierarchical, and modular

designInterfaces, design re-use

• Modeling digital systems using different design entry methods: schematic capture, truth tables, and state diagrams

• Design verification: Test benches, simulationSimulation software: Mentor Graphics' ModelSim

o Delay simulation• Design implementation: Logic synthesis, place & route, FPGA

implementationFPGAs: structure and propertiesEDA tools: Altera Quartus, Mentor Graphics' LeonardoSpectrum

o Power, speed, and area optimization and analysis• Hardware description language (VHDL)

Page 4: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

4

31.08.2010 23:497

General Info• Prerequisites

Basics of digital circuitsRecommendable: Basic knowledge about digital design and microprocessors

• RequirementsExamCompulsory computer exercises

• Grading0-5, based on the exam and exercise project

• PlagiarismCopying of computer exercises from other group member, cheating in examination will result in serious consequences.

31.08.2010 23:498

Personnel• Lectures

Waqar Hussaino Room TG313o Email: [email protected]

Lecture notes will be available on POP• Exercises

Lasse Lehtonen, Tomasz Patyko Rooms TC429, TH315o Email: [email protected]

All exercise information will be on POPSend your exercises at [email protected]

Page 5: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

5

31.08.2010 23:499

Course Schedule• Lectures

Period 1, 2: o Wednesday 14-16, TB224

• ExercisesPeriods 1, 2

o Wednesday 12-14, TC417o Thursday 12-14, TC417

• Web: http://www.tkt.cs.tut.fi/kurssit/1426/Announcements about possible changes will be also emailed to the registered students

31.08.2010 23:4910

Course Material

• Everything available on the course web pages

• Lecture notesNo text book

• Exercise materialEDA tool tutorials

• Additional materialVHDL guides, tutorials, coding rules etc.Extra slide sets (if needed)

Page 6: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

6

31.08.2010 23:4911

Exercises in Practice• Project work: calculator

Done alone or in groups of two/three

o Identical returnings between two groups are NOT allowed!

Constructed piece by piece during the weekly exercisesEach task must be completed and acceptedFinal assembly and testing on the last exerciseFPGA prototyping on the Altera DE2 platform

31.08.2010 23:4912

Exercises in Practice• Two weekly exercise sessions

in TC417Presence is not requiredPerson hours for each exercise must be reported

• Possible to do the exercises on your own PC

Instructions given on the course web pages

• Return deadline for each exercise is listed on the course web pages

• Exercise return by emailEmail address given on the exercise web page

• Possibility to gain ~8 bonus points to a passed exam

Max. raise of two grades

Page 7: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

7

31.08.2010 23:4913

Altera DE2 FPGA Platform• Development board

Includes an FPGA and lots of peripherals

31.08.2010 23:4914

Altera DE2 FPGA Platform

Page 8: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

8

31.08.2010 23:4915

Digital Design Overview• Combinational system design• Design views

Functionality, Architecture, Implementation• Abstraction levels and hierarchy• Digital design flow & automation

Specification, Design, Verification, Implementation

31.08.2010 23:4916

Digital Systems Classification• Two main categories

Combinational (old name: combinatorial)Sequential

• Combinational systemNo memoryOutput determined only by the current inputsAny system can be designed with two levels of logic

• Sequential systemContains memoryOutput is determined by the inputs AND the current state

Page 9: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

9

31.08.2010 23:4917

Combinational System Specification• Specification defines at the highest level:

1. Set of values for the input: input set2. Set of values for the output: output set 3. Specification of the input-output function

• This information is always presented independent of the level of abstraction

• Input/output set definition must also include the data types

Example:o Inputs A, B: 8-bit unsigned integero Output Y: 16-bit unsigned integerEDA tools allow high-level data types such as floating-point numbers and enumerated typeso Eventually, however, everything will be represented with

only ones and zeros

31.08.2010 23:4918

Design Example: Half-Adder• Specification

Inputs A, B: 1-bit unsigned integerOutput Y: 2-bit unsigned integerFunction: Y = A + B (arithmetic addition, not OR!)

• Truth table: Karnaugh maps:Y1 Y0

= =

• Boolean equations: Y1 = ABY0 = A’B + AB’ = A xor B

A B Y0 0 000 1 011 0 011 1 10

A B Y1 Y0

0 0 0 00 1 0 11 0 0 11 1 1 0 1

A01

0 1B

11

A01

0 1B

A B Y0 0 00 1 11 0 11 1 2

Page 10: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

10

31.08.2010 23:4919

Design Example: Half-Adder• Boolean equations: Y1 = AB

Y0 = A’B + AB’ = A xor B• Gate mapping:

=

31.08.2010 23:4920

Combinational System Design• Any digital system can be designed using

this approach!1. Truth table

Relationship between the inputs and outputsSequential systems must include the current stateamong the input column, and the next state among the output columns

2. Karnaugh map for each output bit (and for each next state bit on sequential systems)

Select as large areas from the map as possible3. Form Boolean equations from the Karnaugh

mapsOptimize the equations, if possible

4. Transform the equations into logic gates

Page 11: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

11

31.08.2010 23:4921

Basic Gates Recap

InverterANDORNANDNORXORNXOR

z = x’

x1x0z =

z = x1x0( )’

x1 x0z = +

z = x1 x0+( )’

z = +x1x0’ x1x0’1 0

z = +x1x0’ x1x0’= x x+

x

x1x0

x1x0

x1x0

x1x0

x1x0

x1x0

31.08.2010 23:4922

Example: HDL• Graphical representation (logic gates):

• Hardware description language:A3 <= x3 AND x2;B4 <= x2 AND x1 AND x0;Z <= A3 OR B4;...or alternatively:Z <= (x3 AND x2) OR (x2 AND x1 AND x0);

Intermediate signals do not have to be used, but tometimes they help to clarify the design

x3

x2x1x0

zA

BC

1

2123

3

4

Page 12: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

12

31.08.2010 23:4923

Digital Design Views

Architecture

Implementation

Functionality

• What should be done?• What is the behavior?

• What are the physical components?

• What kind are they?

• What are the logical building blocks?

• How are they organized?

Behavior

Physical

Structure

31.08.2010 23:4924

Characteristics (example)

y = a+by(t+1) = x(t-1)+y(t)

Clock frequencyDelay

Power consumptionSize

Number of AND-gatesClock cycles

Architecture

Implementation

Functionality

Page 13: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

13

31.08.2010 23:4925

What is an Implementation• Realization of the desired functionality on the

available architecture• Direct mapping, one-to-one

Architecture is designed to realize the functionalityEach functional operation has corresponding realization in architectureArchitecture cannot realize any other functionalityExample: digital watch

• Indirect mappingArchitecture can realize also other functionalitiesThere is no exactly corresponding physical component for each functional operation

o Shared resources, re-used with respect to timeUltimate example: general-purpose processor

31.08.2010 23:4926

Example:Custom VLSI Chip Implementation

• Functionality is the same as the architecture• Direct mapping, the smallest unit is gate (transistor)• Implementation = connecting building blocks together!

( )z ab cFunctionality:

Architecture:

Implementation:ASIC

Library of basiccomponents(all gate typesavailable)

Page 14: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

14

31.08.2010 23:4927

Example:Discrete Logic Chip Implementation

• The smallest unit is chip• Direct mapping, but how to select the best mapping?

( )z ab cFunctionality:

Architecture:

Implementation:74-series discretelogic

z

ab

c

31.08.2010 23:4928

Example:FPGA Implementation

• Indirect mapping, the smallest unit is Look-up Table (can perform all basic logic functions)

( )z ab cFunctionality:

Architecture:

Implementation:FPGA

Page 15: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

15

31.08.2010 23:4929

Design Views - Problems• SW engineer

Designs only functionalityExperience needed to fulfill e.g. performance requirementsCannot affect the architecture

• Electronics engineerDesigns architectureFunctionality = ArchitectureCannot understand separation of the two

31.08.2010 23:4930

Design Views - Problems• Basic digital design courses

Exercises must be simple”Design” often means only architecture design

( )z ab cFunctionality Architecture

Specification(functional specification)

”Design” - often still same as functional specification in a graphical notation!

=

Page 16: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

16

31.08.2010 23:4931

Abstraction Levels

Processors, memories

Registers

Gates

Transistors

AlgorithmsRegister transfer

Boolean expressionsDiff. equations

Transistor layout

Cells

ChipsBoards

Architecture

Implementation

Functionality

31.08.2010 23:4932

Abstraction Levels in Design Flow• High abstraction level

Suitable to coarse planning of what is desiredTypically in the beginning of the design flow

• The lower the level, the more detailed the information

…and the more effort required if something is changed

• Abstraction levels and design hierarchy can be considered at the same time

• On this course, the abstraction level is lowRegister and gate-level

Page 17: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

17

31.08.2010 23:4933

Hierarchy in Digital Design

• Large designs must be partitioned into blocks to be manageable

• Compare: SW functions

Nobody writes only mainfunction?

• Example:

RX RY

ADD

Input

Output

Clock

Logical (gate andflip-flop) level

Physical (transistor)level

Transistor

Module level

Gates

Clock Flip-Flop

+5V

Registers

xin

xreg yreg

addout

Adder

clk

z

X(i)

Z

(a )

(b)

(c)

Z(i) = X(i-1) + Y(i-1)

31.08.2010 23:4934

Design Flow & HierarchyTop-down design Bottom-up design

System

Modules

Gates andflip-flops

Transistors Bottom level

Top level

B

A DCDC

B

A

Hie

rarc

hy le

vel

Ord

er o

f des

ign

1.

2.

N. 1.

2.

N.

Page 18: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

18

Design Phases1. Specification

Specify input/outputs and their protocols as well as functionality

2. DesignRefine the specificaiton, create simulation and implementation models

3. VerificationEnsure that models meet the specification

4. ImplementationSynthesize the design into target technology and execute on prototype

35

Different Tools for Different Phases

1. SPECIFICATION, DOCUMENTATIONVarious tools and text-based formats for expressing the design behaviorOn this course, the specification is always given

2. DESIGN: HDL Designer (Mentor Graphics)A complete design creation environmentMakes it possible to instantiate different kind of design files in one top-level designMany description styles, good for educationProvides link to simulation and implementationo Push-button simulation, synthesis, and P&R

36

Page 19: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

19

Different Tools for Different Phases

3. VERIFICATION: ModelSim (Mentor Graphics)Simulator for digital designsWidely used in the industryVisualizes the behavior via, e.g. wave forms Can communicate with HDL Designero Interactive simulation and debugging

4. IMPLEMENTION: Quartus (Altera)Quartus implementation flow tasks1. Synthesize a netlist from the Hardware Description

Language source files (from HDL designer) 2. Map and fit the logic elements into the FPGA chip3. Program the FPGA device

37

2. HDL Designer• A design environment allowing a broad range

of design styles:Block and gate diagrams (schematic)State diagramsTruth tablesHardware description languages (eg. VHDL)

• Generates standard VHDL code from the user’s block and state diagrams

VHDL allows the simulation and synthesis

38

Page 20: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

20

2. HDL Designer – Design Styles

1. RTL block diagram

2. state diagram, truth table

4. hand-written VHDL

3. top-level structural block diagram

as is

standard VHDL for other tools

39

2. HDL Designer Design Flow

HDL Designer

Auto-generatedVHDL

.sof programming file

FPGA chip

Simulation results

ASIC chip

.GDSII

.edif

40

Page 21: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

21

2. HDL Designer Main View

• asdtest

User logic

Menubar

Toolbar

View selection

List of objectsProject info

41

Hierarchical Design• Hierarchical design and component re-use are

extremely powerful methods • Same block can be instantiated multiple

times• Blocks can contain

sub-blocks

1202_s08

action buttons

library

details of selected blcok

Blocks defined top-down,

components bottom-up,

otherwise equal

42

Page 22: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

22

Automated Verification• All designs should be automatically verified

Ensure that they meet the specification• Assistants provide most of the test benches on this

course

testi

test input

resultsuser’s block

testbench

OK?

43

2. HDL Designer in Practice1. Create a new project and library for your design files2. Create design files in your library

Designs can be used as components simply by dragging and dropping them into the upper level designs re-use and duplication

3. Connect your design into a test bench that generates the inputs and checks the outputs

4. Run ModelSim to simulate the designCorrect any problems in your design and re-run ModelSim until the design passes the test bench

5. Run Quartus synthesization and place&route flows6. Program the FPGA chip with Quartus Programmer7. Verify design by using the FPGA board

44

Page 23: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

23

3. ModelSim• Powerful event-based simulator for VHDL (and

Verilog)Can automatically use VHDL files generated by the HDL DesignerWidely used in the industryUsed in several TKT-courses also

• Simulates only logical behavior (results)Does not know hardware-related issues eg. delaysDelays are accurately known only after synthesis, placement, and routingThe delay information can be back-annotated to the simulator

o A timing file is generated by synthesiso Thus, also the timing specification can be verified with

ModelSim45

3. ModelSim Main View

simulated design and its sub-bloks

signals and parameters of selected component

simulated waveform

(this space can shown other info as well)

command prompt and messages will appear into transcript window on the bottom

Manubar and toolbar

46

Page 24: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

24

3. ModelSim Features• Draws a waveform diagram including

Inputs OutputsAny internal signal of any design unit

• Supports different kinds of data representation forms Binary, decimal numbers, ascii data, analog

• Allows, for example,Searching for events in the waveformGeneration of input signals and Manipulation of any signalAdding breakpoints to the VHDL code

47

3. ModelSim - Waveform

Monitored signals

Values at cursor Cursor line

Analog view of bus

multibit bus

high-freq signal

1-bit signal

Time axis

48

Page 25: TKT-1426 Digital design for FPGA, 6cp Fall 2010 · 8/31/2010 1 TKT-1426 Digital design for FPGA, 6cp Fall 2010  Tampere University of Technology Department of Computer Systems

8/31/2010

25

3. ModelSim in Practice• ModelSim works

as standalone simulatortogether with HDL Designer

• Starting ModelSim from HDL Designer:a) Start from the topmost level including a test

bencho Do not have a design block selected!

b) Can be started from any design unit as wello However, inputs have to be generated manuallyo Impractical

• Always use a testbench to verify designs thoroughly!

49

4. Quartus• Accepts HDL description of a system (VHDL,

Verilog)• Quartus flow phases

1. Setup2. Perform RTL synthesis3. Map basic gates into FPGA logic4. Place the logic into specific location in chip5. Route (connect) the logic elements together6. Provide statistics and analysis results7. Create a programming file and upload it into the FPGA

50


Recommended