FPGA Tutorial - Indico

2y ago
95 Views
4 Downloads
3.88 MB
50 Pages
Last View : 1m ago
Last Download : 3m ago
Upload by : Karl Gosselin
Transcription

FPGA tutorialLecture 2Monday 07.09.2015 – 16:00Jochen Steinmann

st1 Project – Summary Start VIVADO First knowledge about Verilog –module–datatypes & levels–logical operatorsconnect inputs with outputs–using combinatorical logic –assignconstraint file (XDC)

st1 Project – Solution There are always multiple ways how to realisea FPGA – ProjectMany solutions can be synthesized in thesame way and result in the same configuration

st1 Project – Solutionmodule simple top(input [15:0] sw,output [15:0] led);simple logic log1(sw, led);endmodulemodule simple logic(input [15:0] switch,output [15:0] LED);assign LED switch;endmoduleYou can also skip the submodule!

nd2 Project – doing LogicNow we want to do some logic–LED0 SW0 & SW1 AND–LED1 SW0 SW1 OR–LED2 SW0 SW1 XOR–LED3 LED0 NOTjust change simple logic.v and keep the top module fromExercise1!LED4 – LED15 SW4 – SW15Hint: merge single Bits to a Bus!

nd2 Project – Solutionmodule simple logic(input [7:0] switch,output [7:0] LED);without joining all together to a bus again.assign LED[0] switch[0] & switch[1];assign LED[1] switch[0] switch[1];assign LED[2] switch[0] switch[1];assign LED[3] LED[0];assign LED[15:4] switch[15:4];endmoduleAlternative: Same Functionassign LED {switch[15:4] , (switch[0] & switch[1]), switch[0] switch[1], switch[0] switch[1]};

Simulation Very useful to test Design–can also display “inner” signals

Add new Source

leave empty

Content of Testbench Filedummy modulesometimes also called:stimuluscreate a registerdelay 100 time unitsset SW0 to 1for the BND01 example:module tp BND01();reg [15:0] sw;wire [15:0] led;Module under Testfor normal, we should create a wire for LED0!When you use a BUS you have to create a wirefor the signal!initial begin#100;sw 'hFFFF;#100;sw 'b0;endBND01 dut(sw, led);endmodule

Start Simulationsimulate just the Verilog file, without FPGAcan simulate the timing on theFPGA chip. You can observethe gate delay times etc.takes a lot of time

Zoom to fit

undefinedlogic 1logic 0

Clock

Clock – Why? Until now only “Glue Logic”–simple logic only–output action is related to input–This “mode” is used for trigger generation: trg (A & B) (A & C)–But if we want to introduce timing, e.g. dead-time after atrigger we need to react on something but not the input CLOCK

Use of Clock We want to let the FPGA doing thing for us–Memory storage RAM need a clock to refresh–Digital communication to other electronics or PCDelays–compensate cable length–artificial dead times Trigger VetoMeasurements of the time between two events:–Drift velocity measurement in a TPC–Time of Flight measurements to distinguish particles

Clock Requirements Requirements:–stable frequency–stable phase to other clocks–stable signal–reproducible low temperature dependencylow dependency on environmentMost FPGAs do not have an internal clock generator!Need external reference Clock generator

Clock generation Driven LC / RC resonator–huge tolerances–not very stable–no high frequenciesTuned Voltage Controlled Oscillator–can be easily tuned by a voltage

CrystalsFrequencies up to 200 MHzHC49 InsideOscillatorMany different housings

Temperaturesensor ? Precise Oscillators–keep Temperature constant–is used for high precisionclock sourcesT const. f const.

other clock sources resonator made from single gates:FeedbackNot very stable2nsDifficult to compute83 MHz3

More speed . higher frequency!

Stable high speed clock. Crystals and Oscillatorsare only available up to 200MHz!What if we need 1GHz ?All you need is a Voltage Controlled Oscillatorand a slower reference clock!Frequency Multiplication!

Howto? Constraints for Multiplication– After n Periods the phase must be the same!Possible for integer steps only!–for fractional Multiplication a divider has to be used! Example: 100 MHz 3 / 2 * 66,6 MHzOutputInputmultiply by 3 and divide by 2

Phase Locked Loop (PLL) Comparison of the phase with a referenceoscillator:–Output up to GHz possible1MHzDivider is equal to MultiplierOptional: Lowpass, Smooting100MHz

Function IReferenceDivider OutputControl VoltageIn PhaseNo Regulationmaximal regulationOff Phase

Function IIFrequency to lowControl-voltage higherFrequency to highControl-voltage lower

Function III & FPGA PLL is stable operating, when the outputvoltage is stable. (u3 0)There are so called Lock-In detectorsavailable, which are able to detect this case.FPGAs have build in PLL blocks, which can beused to create a stable clock.–mainly used to derived secondary (slower) clocks

External PLLs tunable over a wide frequency rangeup to 12.4 GHz

Clock in Experiments Stability is observed by a slower “referenceClock” and a counter–Possible reference clock sources GPS many GPS modules supply a 1 PPS pulseAtomic Clocks DCF77Rubidium Clock Generators which can also supply anyMaster Clock signal

GPS as Reference Often used in experiments–OPERA–T2KPrecise clock output by– Rubidium Reference Clock 10MHzHuge accuracy and precisionHelpful, when timestamps should bematched over large distances.

Clock inside FPGA Routing of clock inside the FPGA is a challengefor VIVADORequirements:–small clock delay –phase must match signal at every point inside the FPGAmost modules latch their data on rising or falling edgeThere is a special high speed net inside theFPGA, which is only used for clock distribution

FPGA Clocking ChallengeVirtex -7 2000T– 2.000.000 Logic Cells– 6.800.000.000 Transistors(Switching Freq 3.8GHz)– DSP48E1 Slices with 741MHz global clock– 12.5Gb/s Serial Transceivers– 1066MHz Fmax Analog PLLsThe internal PLL can not cover all requirements.This fact has to be considered and calculated beforethe PCB design is done.Applications:PCIe GEN3 Jitter 1psSDR Jitter 300 fsDDR3 Memory Jitter 150psLargest Problem: Jitter

Clock-Distribution in FPGAClock Management TileGigabit Serial Transceiver

Clock routing in FPGA very complex topic–for our applications it is sufficientto trust VIVADO–we want to concentrate onthe function and logic inside!For those, who are interested in /user guides/ug472 7Series Clocking.pdf

Clock Domain Crossing Sometimes it is necessary to transfer databetween different clock domains.–special requirements on the design–Use of storage elements: FlipFlopsFiFos (auch LiFo, FiLo)RAM, .

Gated Clock If the clock is switched of for non used areas /modules, power can be saved.Clock switching must be done via special clockgates.Never use a single AND-gate to switch offthe clock.If you need to use a gated clock, always havea look at the RTL and check for rightimplementation.

Why is clock gating problematic? When a simple clock gate is switched on–– it is not done synchronous to the main clockVery short pulses might appear GlitchRuntime delays inside the gate–a phase difference between input and output

Some more If high speed frequencies are used, one has tothink a bit about the design and how it shouldbe realised.Data should be transferred on a defined edgeof the clock (posedge or negedge)

Digital effects I Jitter– Variation of a constant clock in time domainGlitch–Change of output due to timing issuesQ A and B and NOT Ccauses additional run timeFPGAs will synthese this simple equation without a glitchbecause all three signals are send into one LUT42

Verilog Parameter Many Code Snippets can be re-used for otherapplicationsBut often the needs are slightly different–need to use 10 instead of 8 Bit–uses another clock frequency–wants a different output valueVerilog code can be parameterized!

Verilog Parameter inside module–output reg [DW-1:0] cnt –parameter DW 8; define a parameter called 'DW'inside upper module–counter cnt(sw0, btnD, led); –instantiate moduledefparam cnt.DW 16; use parameter to define data width of cntnow the output reg cnt is 16 bit wideParameters are set during synthesis!

rd3 Project - counting Verilog can do math!– need a busFirst use Addition ( ) and Subtraction (-)–need a register with 16-bit (assigned to LEDs)–need a Clock input (assigned to Button)–always @(posedge button)Exercise:Create a counter with 16-bit output, which should count on pressing a button!

rd3 Project Counter–CLKClock input–DIRUp / Down–ENenable–RSTReset (synchronous)will be executed on next clock event–VAL16bit wide register for counting value

HowTo Synchronise to Clock? sequential logic Verilog:initial begin// init all your stuff hereendalways @(posedge CLK) begin// logic is triggered on rising edgeend

Doing Math in Verilog It is possible to add 1 to a bus–mybus mybus 'b1;–mybus mybus – 'b1;If you write 1 instead of 'b1 you get a warning,because 1 is threated as a 32bit number!When reaching the maximum value the valuewill flip to 0 again.–reg [1:0] mybus 0, 1, 2, 3, 0, 1, 2, .

If – Verilog How to use if ?if ( condition ) begin// do somethingendelse begin// do something otherend You might also see:myval condition ? 42 : 21; similar to C/C

Hands-On

Clock inside FPGA Routing of clock inside the FPGA is a challenge for VIVADO Requirements: – small clock delay at every point inside the FPGA – phase must match signal most modules latch their data on rising or falling edge There is a special hi

Related Documents:

In this thesis, FPGA-based simulation and implementation of direct torque control (DTC) of induction motors are studied. DTC is simulated on an FPGA as well as a personal computer. Results prove the FPGA-based simulation to be 12 times faster. Also an experimental setup of DTC is implemented using both FPGA and dSPACE. The FPGA-based design .

FPGA ASIC Trend ASIC NRE Parameter FPGA ASIC Clock frequency Power consumption Form factor Reconfiguration Design security Redesign risk (weighted) Time to market NRE Total Cost FPGA vs. ASIC ü ü ü ü ü ü ü ü FPGA Domain ASIC Domain - 11 - 18.05.2012 The Case for FPGAs - FPGA vs. ASIC FPGAs can't beat ASICs when it comes to Low power

Step 1: Replace ASIC RAMs to FPGA RAMs (using CORE Gen. tool) Step 2: ASIC PLLs to FPGA DCM & PLLs (using architecture wizard), also use BUFG/IBUFG for global routing. Step 3: Convert SERDES (Using Chipsync wizard) Step 4: Convert DSP resources to FPGA DSP resources (using FPGA Core gen.)

ASIC vs. FPGA ASIC Performance Range FPGA ormance Time ormance Planning Deployment Superiority Depends Development First Use Time mance ASIC Superiority FPGA Superiority Under heavy change First Use Requirement lock to decommission is over a decade (as long as Azure itself has existed)

Getting Started with FPGA Advantage Tutorial, Software Version 5.1 1 7 August 2001 Getting Started with FPGA Advantage Welcome to FPGA Advantage This simple tutorial presents the comple te design flow for a sample design from HDL text import using, HDL2Graphics, HDL generation, simulation through to synthesis in approximately 30 minutes.

14 2 FPGA Architectures: An Overview Fig. 2.5 Overview of mesh-based FPGA architecture [22] 2.4.1 Island-Style Routing Architecture Figure2.5 shows a traditional island-style FPGA architecture (also termed as mesh-based FPGA architecture). This is the most common

5.2 Inspection of Structural Adder Using Schematic and fpga editor 5.2.1 Schematics and FPGA layout Now let’s take a look at how the Verilog you wrote mapped to the primitive components on the FPGA. Three levels

A Reader’s Guide to Contemporary Literary Theoryis a classic introduction to the ever-evolving field of modern literary theory, now expanded and updated in its fifth edition. This book presents the full range of positions and movements in contemporary literary theory. It organises the theories into clearly defined sections and presents them in an accessible and lucid style. Students are .