intro to fpgas - johns hopkins universityastubble/ee/fpga.pdf · 2006. 10. 11. · intro to fpgas...

27
Intro to FPGAs October 11, 2006

Upload: others

Post on 15-Aug-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Intro to FPGAs

October 11, 2006

Page 2: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Programmable Logic

Implement wide variety of logic functions inone digital chip

Gates: AND, OR, NOT Storage: Flip flop, latch Switches: Mux Larger blocks: Memory, adder

Page 3: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

History

Individual chips (esp. 7400 series TTL) ROM as lookup table 1970s: PAL – one-time field programmable, dozens

of gates 1980s: GAL – reprogrammable, hundreds of gates,

CPLD – several thousand gates, FPGA – tens ofthousand gates

1990s: CPLD/FPGA get larger, FPGAs get moreflexibility/features

Page 4: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

FPGAs Now

Some one-time programmable, some re-programmable, some in-systemprogrammable

Few thousand to few million gates Few dozen to thousand I/O pins Available with variety of power profiles,

clocking schemes, RAM blocks, DSP blocks,I/O standards

Page 5: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

FPGA vs Custom Chip (ASIC)

Advantages Shorter time to market Re-program in field Low NRE costs

Disadvantages Slower Higher power Less complex designs

Page 6: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

FPGA vs Software

Advantages Faster for logic (esp. shift operations) Faster for some atypical bit lengths Good control over timing Often more pinouts

Disadvantages Slower for math Less flexible/familiar May be more expensive

Page 7: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Getting Started with an FPGA

Pick a technology Reprogrammable? Power? Security? Speed?

Environment? Pick a manufacturer

Xilinx, Altera, Lattice, Actel Pick an evaluation board or design your own

board Pick a tool set for programming

Page 8: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

FPGA for this class

Xilinx Spartan3 XC3S1500-4FG320 1.5 Million Gates Speed: “-4” Package: Fine-pitch ball grid array, 320 pins

(221 user I/O)

Page 9: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Opal Kelly Board: XEM3010

http://www.opalkelly.com/products/xem3010/

Page 10: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Opal Kelly Board: XEM3010

http://www.opalkelly.com/products/xem3010/

Page 11: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Programming an FPGA

Think hardware! Start with a block diagram Describe the circuit, not an algorithm Schematic or VHDL (or Verilog)

Schematic: more precise VHDL: faster to write/change Most people use VHDL, but keep schematic in

mind

Page 12: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Xilinx Design Flow

http://toolbox.xilinx.com/docsan/xilinx7/help/iseguide/html/ise_fpga_design_flow_overview.htm

Page 13: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Getting Started: Create a Project

Xilinx ISE File -> New Project

Careful! ISE doesn’t like spaces Select options for target chip

Page 14: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Design Entry: VHDL

Create new source -> VHDL module Specify inputs and outputs (make sure

names match documentation) Use the “lightbulb” language templates for

help “Synthesis” constructs VHDL also has strong modeling ability, but

these won’t synthesize to a circuit so becareful

Page 15: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Synthesis

Checks code syntax Analyzes design hierarchy Produces Xilinx-specific netlist Can also view produced schematic

Many advanced options, but just leave at default fornow

Read synthesis reports! Understanding anywarnings before proceeding

Page 16: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Implementation

Translates netlists and constraints Maps the design into available resources Places and routes these resources to meet constraints Also generates timing models for more complete

simulation

*.ucf has the pin list. Add and edit the *.ucf file toreflect input and output pins before implementing.

Read the “pad report” to make sure the pins wereassigned as desired

Page 17: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Programming File

Creates a bit stream to download to the chip Use Opal Kelly Front Panel to download this

*.bit to the FPGA

Page 18: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Async vs Sync

Asynchronous logic progresses continuously Pipe analogy AND, OR, NOT…

Synchronous logic progresses on clockedges Valve analogy Flip flops

Page 19: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Flip Flop

Simple storage element Input transferred to output on clock edge Output held until next clock edge Reset to known state (usually async) Clock enable signal to enable/disable

transfers

Page 20: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Sim: Flip flops

Page 21: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

RTL Example: Flip flops

Page 22: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

VHDL Example: Flip flops

Page 23: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Sim: Counter+1 Counting Reset

Page 24: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

RTL example: Counter

Page 25: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

VHDL Example : Counter

Page 26: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

In Class Today

Make LEDs display repeating pattern Pick pattern (suggestion: binary counting) Control whether pattern is moving or not Use speed where pattern is visible. Better yet,

make it move once per second

Page 27: Intro to FPGAs - Johns Hopkins Universityastubble/ee/fpga.pdf · 2006. 10. 11. · Intro to FPGAs October 11, 2006. Programmable Logic ... VHDL also has strong modeling ability, but

Hints

Be careful with active high/low Double-check *.ucf file Use Xilinx help as needed (lightbulb)