19 fpga

53
19 FPGA Page 1 ECEn 224  © 2003 -2008 BYU Field Programmable Gate Array FPGA

Upload: daneshnedaie

Post on 03-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 1/53

19 FPGAPage 1

ECEn 224  © 2003-2008BYU

Field Programmable Gate Array

FPGA

Page 2: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 2/53

19 FPGAPage 2

ECEn 224  © 2003-2008BYU

Using ROM as Combinational Logic

A B C F

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 01 1 1 1

B

CA

C

F

8 x 1ROM(LUT)

A

B

C

F

Page 3: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 3/53

19 FPGAPage 3

ECEn 224  © 2003-2008BYU

Mapping Larger Functions To ROMsA B C D F

0 0 0 0 0

0 0 0 1 0

0 0 1 0 00 0 1 1 1

0 1 0 0 0

0 1 0 1 0

0 1 1 0 0

0 1 1 1 1

1 0 0 0 0

1 0 0 1 0

1 0 1 0 1

1 0 1 1 1

1 1 0 0 1

1 1 0 1 1

1 1 1 0 1

1 1 1 1 1

B

C

D

F

LUT(B+C)

LUT

(CD)

B

C

D

LUTA’f1 + Af2

A

f1

f2

Very similar to how we decomposed functions toimplement with MUX blocks…

Page 4: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 4/53

19 FPGAPage 4

ECEn 224  © 2003-2008BYU

ROM vs. LUT 

• A ROM can be used as a lookup table (LUT)

• An FPGA contains many, many such LUTs– Possibly hundreds of thousands

• A 3LUT has 3 inputs and 1 output• A 4LUT has 4 inputs and 1 output

• 4LUTs are the most common…

Page 5: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 5/53

Page 6: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 6/53

19 FPGAPage 6

ECEn 224  © 2003-2008BYU

3LUT #1

Mapping a Gate Network to 3LUTs

3LUT #2

3LUT #3

Page 7: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 7/53

19 FPGAPage 7

ECEn 224  © 2003-2008BYU

4LUT #1

Mapping Same Network to 4LUTs

4LUT #2

Page 8: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 8/53

19 FPGAPage 8

ECEn 224  © 2003-2008BYU

Mapping Equations to LUTs

• How many 4LUTs do the following functions

require?F = aF = abcd

F = a’b’c’d + a’bcd’ + a’b’c’d’ + a’b’cdF = a + b + c + dF = (a +b + c + d)(a’ + b’ + c’ + d’)

• Each equation requires a single 4LUT!Number of LUTs isn’t a function of equation complexity,

but a function of number of unique inputs

Page 9: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 9/53

19 FPGAPage 9

ECEn 224  © 2003-2008BYU

FPGAs – What Are They?

I/O Buffers

I/O Buffers

   I   /   O    B  u   f   f  e  r  s

   I   /   O    B  u   f   f  e  r  s

Programmable wiring areas

Programmable Logic Elements(LEs)

An FPGA is a Programmable Logic Device (PLD)It can be programmed to perform any function desired.

I/O Buffers communicatebetween FPGA andthe outside world

Page 10: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 10/53

19 FPGAPage 10

ECEn 224  © 2003-2008BYU

Programmable Logic Elements (LEs)

• Typically contain a LUT, wires, and storage

4LUT

0

1D Q

inA

inB

inC

inD

out

clk

16

Page 11: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 11/53

Page 12: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 12/53

19 FPGAPage 12

ECEn 224  © 2003-2008BYU

Programmable Logic Elements (LEs)

• Typically contain a LUT, wires, and storage

4LUT

0

1D Q

inA

inB

inC

inD

out

clk

16

Black dots indicate programming bits(configuration bits)

Page 13: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 13/53

19 FPGAPage 13

ECEn 224  © 2003-2008BYU

Programmable Logic Elements (LEs)

• Typically contain a LUT, wires, and storage

4LUT

0

1D Q

inA

inB

inC

inD

out

clk

16

On power up, configuration bits are loaded into FPGAThis customizes its operation (LUT function, MUX selection)

Page 14: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 14/53

19 FPGAPage 14

ECEn 224  © 2003-2008BYU

Programmable Logic Elements (LEs)

• Typically contain a LUT, wires, and storage

4LUT

0

1D Q

inA

inB

inC

inD

out

clk

16

Typically, configuration bits are not changed during circuit operation(but, some FPGA’s are dynamically reconfigurable )

Page 15: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 15/53

Page 16: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 16/53

19 FPGAPage 16

ECEn 224  © 2003-2008BYU

One Configuration

4LUT

0

1

0

1

D Q

inA

inB

inC

inD

inE

outR = reg(inB(inC+inD))

clk16

fn=inB(inC+inD)

=1

Page 17: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 17/53

Page 18: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 18/53

19 FPGAPage 18

ECEn 224  © 2003-2008BYU

Yet Another Configuration

4LUT

0

1

0

1

D Q

inA

inB

inC

inD

inE

outR = reg(inC’)

outC = inC’

clk16

fn=inC’

=1

=1

Page 19: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 19/53

Page 20: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 20/53

19 FPGAPage 20

ECEn 224  © 2003-2008BYU

An FPGA Architecture (Island Style)

   R  o  w   w

   i  r  e

  s

Column WiresLogic Elements

Each LE is configured to do a function

Wire intersections are programmed to either connect or not

Page 21: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 21/53

19 FPGAPage 21

ECEn 224  © 2003-2008BYU

Programmable Interconnect Junction

Row wire

Column wire

=1   ON 

OFF =0

Connected 

Unconnected 

Page 22: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 22/53

19 FPGAPage 22

ECEn 224  © 2003-2008BYU

Example Problem

ZD0-D5 ND5 Z’

N’P

• Generate the N, Z, P status flags for a 6-bit

microprocessor

Page 23: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 23/53

19 FPGAPage 23

ECEn 224  © 2003-2008BYU

Example Problem

ZD0-D5 ND5 Z’

N’P

• Generate the N, Z, P status flags for a 6-bit

microprocessor

Will require 2 4LUTsCan be done with

wiring only orwith 1 4LUT 

Will require 1 4LUT 

N

Page 24: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 24/53

19 FPGAPage 24

ECEn 224  © 2003-2008BYU

6

11

7

12

8

13

9

14

10

15

1 2 3 4 5D0D1

D2

D3D4D5

Z

P

N

LUT #1: F1 = D0’• D1’• D2’• D3’ LUT #8: F3 = D5 N outputLUT #7: F2 = F1•D4’•D5’ Z   output LUT #9: F4 = Z’ • N’ P output

N

Page 25: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 25/53

19 FPGAPage 25

ECEn 224  © 2003-2008BYU

6

11

7

12

8

13

9

14

10

15

1 2 3 4 5D0D1

D2

D3D4D5

P

N

LUT #1: F1 = D0’• D1’• D2’• D3’ LUT #8: F3 = D5 N outputLUT #7: F2 = F1•D4’•D5’ Z   output LUT #9: F4 = Z’ • N’ P output

Z

N

Page 26: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 26/53

19 FPGAPage 26

ECEn 224  © 2003-2008BYU

6

11

7

12

8

13

9

14

10

15

1 2 3 4 5D0D1

D2

D3D4D5

P

N

LUT #1: F1 = D0’• D1’• D2’• D3’ LUT #8: F3 = D5 N outputLUT #7: F2 = F1•D4’•D5’ Z   output LUT #9: F4 = Z’ • N’ P output

Z

N

Page 27: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 27/53

19 FPGAPage 27

ECEn 224  © 2003-2008BYU

6

11

7

12

8

13

9

14

10

15

1 2 3 4 5D0D1

D2

D3D4D5

P

N

LUT #1: F1 = D0’• D1’• D2’• D3’ LUT #8: F3 = D5 N outputLUT #7: F2 = F1•D4’•D5’ Z   output LUT #9: F4 = Z’ • N’ P output

Z

N

Page 28: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 28/53

19 FPGAPage 28

ECEn 224  © 2003-2008BYU

6

11

7

12

8

13

9

14

10

15

1 2 3 4 5D0D1

D2

D3D4D5

P

LUT #1: F1 = D0’• D1’• D2’• D3’ LUT #8: F3 = D5 N outputLUT #7: F2 = F1•D4’•D5’ Z   output LUT #9: F4 = Z’ • N’ P output

Z

Page 29: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 29/53

19 FPGAPage 29

ECEn 224  © 2003-2008BYU

Configuring an FPGA

• Most FPGAs have a configuration input pin

– Configuration bits are shifted into FPGA usingthis pin, one bit per cycle

– Configuration bits in FPGA linked into a long

shift register (SIPO)

• Examples on following slides are conceptual 

– Commercial devices slightly different

Page 30: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 30/53

19 FPGAPage 30

ECEn 224  © 2003-2008BYU

Structure of a 3LUT 

ConfigurationStorage

Bits(Flip Flops)

LUT Output

LUT Inputs

b0

b1b2

b3

b4

b5b6

b7

3

It’s just an 8:1 MUX

LUT inputs select which config

bit is sent to LUT output

Programming LUT functionsetting configuration bits

Page 31: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 31/53

19 FPGAPage 31

ECEn 224  © 2003-2008BYU

How are the Configuration Bit

Flip Flops Loaded?

D Q B70

1

CCLKCONFIG

D Q B60

1

CCLKCONFIG

 …

 …A serial-in/parallel-out(SIPO) shift register

These are the configuration bitswhich the LUT selects from

f h bl

Page 32: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 32/53

19 FPGAPage 32

ECEn 224  © 2003-2008BYU

Configuring the Programmable

Interconnect

Row wire

Column wire

Configuration bit

b

Also arranged in aSIPO shift register

Page 33: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 33/53

19 FPGAPage 33

ECEn 224  © 2003-2008BYU

Additional FPGA Features

Found in commercial FPGAs

Page 34: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 34/53

Page 35: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 35/53

19 FPGAPage 35

ECEn 224  © 2003-2008BYU

Configurable Input/Output

• I/O blocks allow internal FPGA signals to connect to external pins• Configurable I/O block features:

– Can be configured as inputs or outputs– Electrostatic discharge (ESD) protection– Input signal conditioning (voltage levels, …)– Output drive

• Fast, slow

• Strong, weak• Tri-state– Handles a variety of electrical standards

• LVTTL• LVCMOS

• PCI• LVDS• …

• I/O blocks are configured when the rest of the chip is configured

Page 36: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 36/53

19 FPGAPage 36

ECEn 224  © 2003-2008BYU

Configuration Storage

• Actual configuration storage is not flip flops

– Many use SRAM memory cells• Different technologies

– Program once

• Fuse, anti-fuse configuration– Program multiple times

• SRAM-based configuration

• Some chips can be partially reconfigured ,even while rest of chip is running

Page 37: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 37/53

19 FPGAPage 37

ECEn 224  © 2003-2008BYU

Programmable Interconnections

• Expensive to put programmable connections at

every wire junction– Commercial parts use partially populated junctions

– Little or no loss of routing flexibility

Page 38: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 38/53

19 FPGAPage 38

ECEn 224  © 2003-2008BYU

Hierarchical Routing

• Collection of short, medium, and long wires

– Both rows and columns• Signals use wires that go distance needed

• CAD tools make determinations

• Like alleys, streets, expressways in a city– Longer distance more limited access points

Page 39: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 39/53

19 FPGAPage 39

ECEn 224  © 2003-2008BYU

Clustered LE’s

• Cluster: >= 1 LE

– Example: Cluster of 4– Dedicated wires within groups of 4 LE’s

• Closely related to hierarchical routing

• Higher performance• Different vendors different clustering

Page 40: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 40/53

19 FPGAPage 40

ECEn 224  © 2003-2008BYU

Embedded Function Units

• Place the following into the FPGA fabric:

MultipliersMemories (Block RAM)I/O interfaces (e.g. gigabit serial links or

Ethernet PHY/MAC)CPU’s (PowerPC, ARM, …)

• Result: higher speed, higher density, lowerpower designs

Page 41: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 41/53

19 FPGAPage 41

ECEn 224  © 2003-2008BYU

FPGAs Compared To OtherTechnologies

Page 42: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 42/53

19 FPGAPage 42

ECEn 224  © 2003-2008BYU

Performance vs. Flexibility

   F   l  e  x   i   b   i

   l   i   t  y

Performance

ASICs

CPUs & DSPs

FPGAs

Goal: the performance of ASIC’s with theflexibility of programmable processors.

ASIC = Application SpecificIntegrated Circuit

FPGAs vs CPUs

Page 43: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 43/53

19 FPGAPage 43

ECEn 224  © 2003-2008BYU

FPGAs vs. CPUs

Flexibility• Any function can be programmed to run on a CPU

– Programming is relatively simple to do

• Any function can also be configured onto an FPGA– Design is much more difficult and time consuming since

it’s a digital logic design

– “Hardware is harder than software”• Both CPUs and FPGAs can be reprogrammed

(reconfigured) in the field

• The winner: CPUs

FPGAs vs CPUs

Page 44: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 44/53

19 FPGAPage 44

ECEn 224  © 2003-2008BYU

FPGAs vs. CPUs

Performance• 10+ years of research 10x-100x performance

advantage for FPGAs!

• Custom hardware– No fetch, decode, or memory access overhead– Significant parallelism (e.g., pipelining)

• Case in point: 1998 SONAR beamformer on an FPGA– BYU Configurable Computing Lab research– 2 x 109 FLOP/sec sustained – 10x-80x faster than comparable CPU technology

• The winner: FPGAs

Page 45: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 45/53

FPGAs vs ASICs

Page 46: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 46/53

19 FPGAPage 46

ECEn 224  © 2003-2008BYU

FPGAs vs. ASICs

Performance• Both ASICs and FPGAs are custom hardware designs• FPGA configurability comes at great cost

– FPGA density is much lower than that of an ASIC– Low density means logic must be physically spread out

• Result:– FPGAs are slower, physically larger, and more power

hungry than a custom ASIC chip– For some/many applications FPGAs may…

• …be too slow• ...not hold enough logic

• …be too power hungry

• The winner: ASICs

FPGAs vs ASICs

Page 47: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 47/53

19 FPGAPage 47

ECEn 224  © 2003-2008BYU

FPGAs vs. ASICs

Cost• Once the design is complete:

– FPGAs can be purchased off-the-shelf and programmed

in seconds• Negligible up-front costs• Inexpensive for small volume• Per part cost is high

– ASICs require time-consuming, expensivemanufacturing process• Fabrication facility (> $1 billion)• Significant up-front costs• Expensive for small volume• Per part cost is very low, when volume is high

• The winner: Depends on volume and application!

FPGA ASIC P d ti C t E l

Page 48: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 48/53

19 FPGAPage 48

ECEn 224  © 2003-2008BYU

FPGA vs. ASIC Production Cost Example

• FPGA– Non-recurring

engineering (NRE)costs = $0– Per-part cost = $20

(prices vary from a

few $’s to $1000’s)

– Cost to produce 100 =$2K

– Cost to produce 106 =$20M

• ASIC– NRE costs = $5M

– Per-part cost = $1

– Cost to produce 100 =$5M + $100 ≈ $5M

– Cost to produce 106 =$5M + $1M = $6M

Volume produced makes a big difference!

Page 49: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 49/53

FPGA ASIC S

Page 50: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 50/53

19 FPGAPage 50

ECEn 224  © 2003-2008BYU

FPGAs vs. ASICs - Summary

• Two very different technologies– Flexibility: FPGA wins

– Performance: ASIC wins– Risk: ?– Cost: ?

• Complex Decision– Only partially based on technical issues– Significant business issues

• Cost• Risk• Time-to-market• Market characteristics (elasticity, price sensitivity, …)

D si n f FPGAs

Page 51: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 51/53

19 FPGAPage 51

ECEn 224  © 2003-2008BYU

Design for FPGAs

1. Draw schematics or write HDL

2. CAD tool maps design to LUTs + FFs

3. CAD tool generates bitstream 

4. Load bitstream to configure the FPGA

Design for ASICs

Page 52: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 52/53

19 FPGAPage 52

ECEn 224  © 2003-2008BYU

Design for ASICs

1. Draw schematics or write HDL

2. CAD tool maps design to physical siliconlayout

3. Send layout data to silicon fab 

4. Finished chip does intended function

• Step 1 fairly similar for FPGAs and ASICs– Major differences in later steps

For More Information

Page 53: 19 FPGA

8/12/2019 19 FPGA

http://slidepdf.com/reader/full/19-fpga 53/53

19 FPGAPage 53

ECEn 224  © 2003-2008BYU

For More Information

• FPGA companies’ WWW sites tend to havelots of information– Catering to a wide range of customers

• Novice to expert

• Low volume to high volume– Data sheets

– Application notes

– Success stories– CAD tools