36
Lect 16 Programmable Logic and Hardware Programming (Verilog HDL) Hardware Programming (Verilog HDL) CS221 Di it l D i CS221: DigitalDesign Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati Indian Institute of Technology Guwahati 9/2/2018

Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Lect 16

Programmable Logic and 

Hardware Programming (Verilog HDL)Hardware Programming (Verilog HDL)

CS221 Di it l D iCS221: Digital Design

Dr. A. SahuDept of Comp. Sc. & Engg.

Indian Institute of Technology GuwahatiIndian Institute of Technology Guwahati9/2/2018

Page 2: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Outline• Programmable Logic• PAL PLA• PAL, PLA, • Memory

–ROM, PROM, EPROM, EEPROM–SRAM : Memory CellSRAM : Memory Cell

• CPLD, CLB, FPGA• FPGA/ASIC Design Flow • HDL Programming : Verilog HDL• HDL Programming : Verilog HDL9/2/2018

Page 3: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Programmable Logic Organization• Pre‐fabricated building block of many AND/OR gates (or NOR, NAND)

• "Personalized" by making or breaking connections among the gates

Inputs 

Dense Array of AND gates

Dense Array of OR GatesProduct  termsterms 

Outputs

Programmable Array Block Diagram for Sum of Products Form9/2/2018

Page 4: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

1. PLA Logic ImplementationAlternative representation

Un‐programmed device

Sh t h d t ti d 't h tShort‐hand notation  so we don't have todraw all the wires!

X at junction indicates a connection 9/2/2018

Page 5: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

2. PALsWhat is difference between Programmable Array Logic (PAL) and

Programmable Logic Array (PLA)?PAL concept — implemented by Monolithic MemoriesPAL concept  implemented by Monolithic MemoriesAND array is programmable, OR array is fixed at fabrication

A given column of the OR array has access to only a subset of the 

possible product terms

PLA concept — Both AND and OR arrays are programmable9/2/2018

Page 6: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

3. ROM as Memory•Read Example: For input (A2,A1,A0) = 011, output is (F0,F1,F2,F3 ) = 0010.What are functions F F F and F in terms of (A A A )?

0 1 1 0 1Address 8x4 ROM

•What are functions F3, F2 , F1 and F0 in terms of (A2, A1, A0)?

0 1 1 0 1

1 0 0 0 0

2 1 0 0 1

D0D1D2D3

X XX

XX

X

3 0 0 1 0

4 0 0 0 03 4

D4D5D6D7

A2A1A0

AB

C

XX

XX

A[2:0] F[3:0]

5 1 0 0 0

6 0 0 1 1

7 0 1 0 07 0 1 0 0F3F2F1F0

9/2/2018

Page 7: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

4. SRAM: Memory Cell 

Select

R

S DOutputInput

R/W’ S RW’ D O/p

0 X X 00 X X 0

1 1 X D

1 0 In 09/2/2018

Page 8: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

4. SRAM : Memory Data Inputs

BC BC BC BC

W0

2x4 Dec

BC BC BC BC

BC BC BC BC

W1

Decoder

BC BC BC BCAddrW2

BC BC BC BC

Enable

W3

BC BC BC BCEnable 

R/W’R/W  

Data  Outputs9/2/2018

Page 9: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

AdvancedAdvanced Programmable LogicProgrammable Logic 

Devices

9/2/2018

Page 10: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

SPLD , CPLD and FPGA

• Simple Programmable logic deviceSimple Programmable logic device– Single AND LevelFli Fl d f db k– Flip‐Flops and feedbacks

• Complex Programmable logic device– Several PLDs Stacked together

9/2/2018

Page 11: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

SPLD ‐ CPLD• Simple Programmable logic device

– Single AND Level– Flip‐Flops and feedbacks

AA BB CC SelectSelectEnableEnable

FFFlip-flopFlip-flop

DD QQ MUXMUX

F1F1

ClockClock

AND planeAND plane9/2/2018

Page 12: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

SPLD ‐ CPLD• Complex Programmable logic device

– Several PLDs Stacked together

PLD PLD

I/O B

I/O B• •

Block Block

Block

Block

•••

•••

Interconnection MatrixInterconnection Matrix

PLD PLD

I/O B

I/O B• •

Block Block

Block

Block

•••

•••

9/2/2018

Page 13: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA

9/2/2018

Page 14: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Field Programmable Gate Arrays ( )(FPGAs)

• FPGAs have much more logic than CPLDsFPGAs have much more logic than CPLDs– 2K to >10M equivalent gatesRequires different architecture– Requires different architecture

– FPGAs can be RAM‐based or Flash‐based• RAM FPGAs must be programmed at power on• RAM FPGAs must be programmed at power‐on

– External memory needed for programming data– May be dynamically reconfigured

• Flash FPGAs store program data in non‐volatile memory– Reprogramming is more difficult– Holds configuration when power is off– Holds configuration when power is off

9/2/2018

Page 15: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA ‐ Field Programmable Gate ArrayArray

• Programmable logic blocks (Logic Element “LE”) or CLBElement  LE ) or CLB– Implement combinatorial and sequential logic. Based on LUT and DFF. 

• Programmable I/O blocks– Configurable I/Os for external connections supports various voltages and tri‐states.

• Programmable interconnect – Wires to connect inputs , outputs and logic blocks. – Clocksshort distance local connections– short distance local connections

– long distance connections across chip9/2/2018

Page 16: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA ‐ Field Programmable Gate Array•Programmable logic blocks  or CLB

(Logic Element “LE”)Implement combinatorial and sequential logicImplement combinatorial and sequential logic. Based on LUT and DFF. 

9/2/2018

Page 17: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Configuring LUTLUT is a RAM with data width of 1bit.The contents are programmed at power up

a b c yRequired FunctionTruth Table

0 0 0 10 0 1 0 Programmed LUT

y a b c= • +0 1 0 10 1 1 1

g

10

LUT

1 0 0 11 0 1 0

1110

MUX y

1 1 0 11 1 1 1

011

a,b,c9/2/2018

Page 18: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA ‐ Field Programmable Gate ArrayLogic blockLogic block Interconnection switchesInterconnection switches

I/O/I/O

I/O

I/O

I/OI/O9/2/2018

Page 19: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Field‐Programmable Gate Arrays structure

• Logic blocks– To implement combinational

d ti l l iand sequential logic• Interconnect

– Wires to connect inputs andWires to connect inputs andoutputs to logic blocks

• I/O blocks– Special logic blocks at periphery of device forexternal connections

• Key questions:– How to make logic blocks programmable?– How to connect the wires?

9/2/2018

Page 20: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA structure

CLB SB CLB

SB SB SBSB SB SB

CLB SB CLBConfigurable Logic Blocks

Interconnection NetworkInterconnection Network

I/O Signals (Pins)9/2/2018

Page 21: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Simplified CLB StructureSimplified CLB Structure

CLB SB CLB

SB SB SB

CLB SB CLBConfigurable Logic Blocks

Interconnection Network

I/O Signals (Pins)

9/2/2018

Page 22: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Example: 4‐input AND gateA B C D O0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 00 1 1 0 00 1 1 1 01 0 0 0 01 0 0 1 01 0 1 0 01 0 1 0 01 0 1 1 01 1 0 0 01 1 0 1 01 1 0 1 01 1 1 0 01 1 1 1 1

9/2/2018

Page 23: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Interconnection Network

CLB SB CLB

SB SB SB

CLB SB CLBConfigurable Logic Blocks

Interconnection Network

I/O Signals (Pins)9/2/2018

Page 24: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Configurable InterconnectConfigurable Interconnect

9/2/2018

Page 25: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Placement: Select CLBsInput1

CLB0 SB0 CLB1Input2

SB1 SB2 SB3

Input3CLB2 SB4 CLB3 Output

Input3

9/2/2018

Page 26: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Routing: Select pathInput1

Input2CLB0 SB0 CLB1

Input2

SB1 SB2 SB3

CLB2 SB4 CLB3 OutputInput3

CLB2 SB4 CLB3 Output

9/2/2018

Page 27: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Shannon’s expansion theoremUsed to implement many variable logic functions using MUX and LUTsf(x1, x2, …, xn) = x1  f(0, x2, .., xn) + x1  f(1, x2, …, xn)

b l bl d l k lSince x1 is a boolean variable, we need to look at only two cases: x1 = 0 and x1 = 1.

•Setting x1 = 0 in the above expression, we have:•f(0, x2, …, xn)  = 1  f(0, x2, …, xn) + 0 f(1, x2, …, xn)

= f(0, x2, …, xn)•Setting x1 = 1, we have:

•f(1, x2, …, xn)  =0  f(0, x2, …, xn) + 1  f(1, x2, …, xn)( , , , ) ( , , , ) ( , , , )= f(1; x2; …; xn)

9/2/2018

Page 28: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA Structures• Configurable Logic Block (CLB)

– Two identical slices in each CLB– Two LUT in each slice

• CLK ‐ Delay Locked Loop (DLL)

9/2/2018

Page 29: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Xilinx Spartan‐6 Digilent Atlys BoardXilinx Spartan 6 Digilent Atlys Board

FPGA

ButtonLEDsButton

Switches9/2/2018

Page 30: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Special FPGA functionsSpecial FPGA functions

• Internal SRAMInternal SRAM• Embedded Multipliers and DSP blocks

• Embedded logic analyzer• Embedded CPUsEmbedded CPUs• High speed I/O (~10GHz)• DDR/DDRII/DDRIII SDRAMDDR/DDRII/DDRIII SDRAM interfaces

• PLLsPLLs

9/2/2018

Page 31: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

ComparisonComparison

9/2/2018

Page 32: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

UsagesUsages

• Digital designs where ASIC is not commercialDigital designs  where ASIC is not commercial• Reconfigurable systems

d bl• Upgradeable systems• ASIC prototyping and emulation• Education

9/2/2018

Page 33: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA ManufacturersFPGA Manufacturers

• XilinxXilinx• Altera

i• Lattice• Actel

We will work with Xilinx FPGAs : Next Semester 

9/2/2018

Page 34: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

FPGA and ASIC D i FlDesign Flow

9/2/2018

Page 35: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

IC Design Process

Idea T t d

DesignFabrica‐

Testing Packaging

Idea Layout Die Tested Die

Design tion Testing Packaging 

SpecificationImplementationModelModelSynthesisVerification & SimulationVerification & Simulation 

9/2/2018

Page 36: Lect16 Programmable Logic and Hardware Programming ... · Lect16 Programmable Logic and Hardware Programming (VerilogHDL) CS221: Di it lDigital DiDesign Dr. A. Sahu Dept of Comp

Hardware/Software Design FlowHardware/Software Design Flow

HW SWHWSpecification 

SWSpecification 

Synthesis

Bi

Compilation

Layout  Binary Code 

Fabrication 

IC9/2/2018