From VHDL to FPGA jagron@ittc.ku.edu, enno.luebbers@upb.de



Similar documents
Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Digital Design with VHDL

DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev Key Design Features. Block Diagram. Generic Parameters.

VHDL Test Bench Tutorial

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

Modeling Latches and Flip-flops

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

VHDL GUIDELINES FOR SYNTHESIS

FPGA Synthesis Example: Counter

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division

VHDL programmering H2

Digital Design with Synthesizable VHDL

Xilinx ISE. <Release Version: 10.1i> Tutorial. Department of Electrical and Computer Engineering State University of New York New Paltz

Using Xilinx ISE for VHDL Based Design

High-Level Synthesis for FPGA Designs

Hardware Implementation of the Stone Metamorphic Cipher

Quartus II Introduction for VHDL Users

Technical Note. Micron NAND Flash Controller via Xilinx Spartan -3 FPGA. Overview. TN-29-06: NAND Flash Controller on Spartan-3 Overview

Chapter 13: Verification

Digital Circuit Design Using Xilinx ISE Tools

TIn 1: Lecture 3: Lernziele. Lecture 3 The Belly of the Architect. Basic internal components of the Pointers and data storage in memory

Lab 1: Introduction to Xilinx ISE Tutorial

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

Best Practises for LabVIEW FPGA Design Flow. uk.ni.com ireland.ni.com

Altera Error Message Register Unloader IP Core User Guide

Von der Hardware zur Software in FPGAs mit Embedded Prozessoren. Alexander Hahn Senior Field Application Engineer Lattice Semiconductor

A Verilog HDL Test Bench Primer Application Note

Digital Systems Design. VGA Video Display Generation

Asynchronous & Synchronous Reset Design Techniques - Part Deux

VGA video signal generation

9/14/ :38

EC313 - VHDL State Machine Example

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Quartus II Software Design Series : Foundation. Digitale Signalverarbeitung mit FPGA. Digitale Signalverarbeitung mit FPGA (DSF) Quartus II 1

Open Flow Controller and Switch Datasheet

Modeling Registers and Counters

Introduction to the Altera Qsys System Integration Tool. 1 Introduction. For Quartus II 12.0

7a. System-on-chip design and prototyping platforms

Digital Systems Design! Lecture 1 - Introduction!!

Lab 1: Full Adder 0.0

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

HDL Simulation Framework

AES (Rijndael) IP-Cores

Getting Started with Embedded System Development using MicroBlaze processor & Spartan-3A FPGAs. MicroBlaze

System on Chip Platform Based on OpenCores for Telecommunication Applications

An Example VHDL Application for the TM-4

How To Design A Chip Layout

Building an Architecture Model Entwerfen Sie mit AxiomSys ein Kontextdiagramm, das folgendermaßen aussieht:

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

Chapter 7 Memory and Programmable Logic

Building an Embedded Processor System on a Xilinx Zync FPGA (Profiling): A Tutorial

Techniques de conception et applications sur FPGAs partiellement reconfigurables

Printed Circuit Board Design with HDL Designer

Post-Configuration Access to SPI Flash Memory with Virtex-5 FPGAs Author: Daniel Cherry

Introduction to Digital Design Using Digilent FPGA Boards Block Diagram / Verilog Examples

Sprites in Block ROM

Example-driven Interconnect Synthesis for Heterogeneous Coarse-Grain Reconfigurable Logic

Digital Design and Synthesis INTRODUCTION

Exploiting Stateful Inspection of Network Security in Reconfigurable Hardware

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

A CPLD VHDL Introduction

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

ISE In-Depth Tutorial 10.1

After opening the Programs> Xilinx ISE 8.1i > Project Navigator, you will come to this screen as start-up.

In this example the length of the vector is determined by D length and used for the index variable.

Design of Remote Laboratory dedicated to E2LP board for e-learning courses.

ISE In-Depth Tutorial. UG695 (v14.1) April 24, 2012

Agenda. Michele Taliercio, Il circuito Integrato, Novembre 2001

Vivado Design Suite Tutorial

LogiCORE IP AXI Performance Monitor v2.00.a

Design of a High Speed Communications Link Using Field Programmable Gate Arrays

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

How To Fix A 3 Bit Error In Data From A Data Point To A Bit Code (Data Point) With A Power Source (Data Source) And A Power Cell (Power Source)

FPGA. AT6000 FPGAs. Application Note AT6000 FPGAs. 3x3 Convolver with Run-Time Reconfigurable Vector Multiplier in Atmel AT6000 FPGAs.

Rotary Encoder Interface for Spartan-3E Starter Kit

Modeling a GPS Receiver Using SystemC

Clocking Wizard v5.1

SPICE auf der Überholspur. Vergleich von ISO (TR) und Automotive SPICE

Embedded Software Development and Test in 2011 using a mini- HIL approach

! " # # $ '"() * #! +, # / $0123$

2. TEACHING ENVIRONMENT AND MOTIVATION

Start Active-HDL by double clicking on the Active-HDL Icon (windows).

Sistemas Digitais I LESI - 2º ano

PCIe Core Output Products Generation (Generate Example Design)

LatticeECP3 High-Speed I/O Interface

Digital Systems. Role of the Digital Engineer

SDLC Controller. Documentation. Design File Formats. Verification

PLL Dynamic Reconfiguration Author: Karl Kurbjun and Carl Ribbing

Serial port interface for microcontroller embedded into integrated power meter

10/100 Mbps Ethernet MAC

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

Seeking Opportunities for Hardware Acceleration in Big Data Analytics

Life Cycle of a Memory Request. Ring Example: 2 requests for lock 17

The Advanced JTAG Bridge. Nathan Yawn 05/12/09

White Paper FPGA Performance Benchmarking Methodology

Transcription:

From VHDL to FPGA #1: VHDL simulation Jason Agron University of Kansas Enno Lübbers University of Paderborn jagron@ittc.ku.edu, enno.luebbers@upb.de 1

Field-Programmable Gate Arrays (FPGAs) Fine-grained reconfigurable hardware Gate-Array: regular structure of logic cells, connected through an interconnection network Configuration stored in SRAM, must be loaded on startup EPROM 2

Too much logic, too little time... Modern FPGAs provide lots of logic resources Virtex-5: up to 330,000 logic cells DSP blocks, multipliers, block RAM,... Manual design simply unmanageable 3

What is VHDL? VHDL (Very high speed integrated logic Hardware Description Language) Developed in the 1980s and 1990s as a documentation language for (digital) hardware as an alternative to complex manuals Soon logic simulators appeared to simulate (= verify the behaviour) these documents Now mainly used as a design entry language for digital logic synthesizers to generate hardware document = describe simulate = verify synthesize = generate 4

Overview VHDL as a modelling language Modules Testbenches VHDL simulation Tools Xilinx ISE ModelSim VHDL synthesis Tool Flow Hardware Spartan-3E development board Tools Xilinx ISE Xilinx impact Project work 5

VHDL modules my_module inputs i_a i_b o_c o_d outputs G_MYPARAM A module can have Ports Inputs Outputs Parameters ( generics ) This interface is described by an VHDL entity parameters entity my_module is generic ( G_MYPARAM : integer ); port ( i_a : in std_logic; i_b : in std_logic; o_c : out std_logic; o_d : out std_logic ); end my_module; 6

Functional description my_module inputs outputs The function of a module is defined By a VHDL description of the module s behaviour, or By assembling the module from other modules (which is a description of its structure) architecture behavioural of my_module is begin c <= a xor b; d <= a and b; end behavioural; This is done through a VHDL architecture 7

VHDL testbenches my_module_tb my_module i_a i_b o_c o_d?! G_MYPARAM To verify a modules operation, we need to Stimulate the module s inputs Let the module process the inputs internally Observe the outputs This is usually done by another VHDL module, the testbench 8

Introduction to the Xilinx Toolset: Project Navigator (ISE) Project Setup and Simulation 9

What is Project Navigator (ISE)? ISE is a tool that is used for Organizing design files. Running processes to implement a design. Compilation Simulation Synthesis ISE is an integrated development environment (IDE). You can create/edit sources Create tests Configure implementation parameters Optimization levels Synthesis/Simulation tools 10

Software IDE IDEs: Hardware vs. Software Sources describe programs and libraries. Testing can be done via debugging/simulation. Usually done by stepping through the code line by line. Compilation results in an executable. Hardware IDE. Sources describe entities and libraries. Blocks with I/O ports. Testing is done via debugging/simulation. Usually done by providing stimulus to input ports, and watching behavior of internal state and output ports. The result of simulation is a waveform and I/O. Compilation (synthesis) results in a bitstream, not an executable. A program for an FPGA. The description of a hardware platform. 11

How To Get Started Open up ISE. Create a new ISE project. Select File, New Project Select the proper FPGA target, language, etc. Click Next repetitively, and then click Finish. 12

Setting Up the Project Parameters Specify the location and name of the project. Specify the parameters of the project. FPGA target. Synthesis tool. Simulation tool. Etc. 13

Add HDL sources to the project. Adding Sources to the Project First, Create a subdirectory within the project for the HDL sources to be placed in (maybe called /src/hdl). Now, add the sources to the project. Select the FPGA within the Sources in Project window. Right click and select Add Source or New source. Add existing sources and new sources as needed. NOTE: Some sources can only be made visible by altering the Sources For: parameter! E.G. testbenches 14

An entity cannot be simulated! It has I/O ports What should the simulator do for inputs? It is like simulating a video game console without a game or controller. What Can Be Simulated? A testbench can be simulated! A testbench is a wrapper around an entity. It stimulates the input ports. The testbench itself has no I/O ports. It acts as a driver. It is like simulating a game being played on a video game console. 15

Select Behavioral Simulation from the Sources For: menu in the top-left. This allows the user to see: Project testbenches. Project UUTs = Units Under Test. Select the testbench that is to be simulated. The Processes menu should now have a Simulation option. Expand this option and double click on Simulate Behavioral Model. Starting a Simulation 16

Simulation Output: Waveform The output of simulation is usually a waveform. A clock-cycle accurate representation of signal behavior in the system. A simulator executes the testbench. Allowing the testbench to drive the UUT. The waveform shows the behavior of signals As input to the UUT. Within the UUT (internal signals). As output from the UUT. 17

A testbench must do the following: Instantiate a UUT. Define the component. Instantiate the component. Provide stimulus to the UUT. Input signals Clocks A testbench must not do the following: Must not have any I/O ports. I/O can be done via special print statements (screen I/O and file I/O). These are usually simulator specific. Anatomy of a Testbench 18

Anatomy of a Testbench - Clocks Purpose of a clock: Periodic signal used for synchronization. Used as a gating mechanism for storage devices Registers use a clock as a signal to store. On every clock edge store a new value. Edges can be rising, falling, or both. The clock model above is encapsulated in a process Runs in parallel with the rest of the testbench continuously. 19

Anatomy of a Testbench - Behavioral Stimulus 20

Example: Queue (FIFO) FIFO = First In First Out. Operations: Status: Enqueue (Add to queue) Dequeue (Remove from queue) Empty Full 21

Backup slides 22

Datentypen VHDL bietet spezielle Datentypen und Operatoren zur Hardwarebeschreibung z.b. std_logic als digitales Signal mit den Zuständen U : nicht initialisiert X : unbekannt 0 : logisch 0 1 : logisch 1 Z : hochohmig W : schwaches Signal (0 oder 1) L : schwaches Signal, wahrscheinlich 0 H : schwaches Signal, wahrscheinlich 1 - : Wert irrelevant (don t care) Skalare Typen Arrays integer, natural, unsigned... std_logic_vector, array of integer... Benutzerdefinierte Datenstrukturen (records) Spezielle Datentypen für die Simulation time 23

Entity VHDL-Modelle bestehen aus Modulen, sogenannten Entities ähnlich wie Klassendeklarationen beschreiben Schnittstelle der Module entity half_adder is port ( x : in std_logic; y : in std_logic; s : out std_logic; c : out std_logic ); end half_adder; -- x input -- y input -- sum output -- carry output 24

Architecture Die Implementation einer entity wird durch eine architecture definiert: architecture behavioural of half_adder is begin s <= x xor y; c <= x and y; end behavioural; Hier handelt es sich um eine sogenannte Verhaltensbeschreibung 25

Strukturbeschreibung Aus zwei Halbaddierern lässt sich ein Volladdierer zusammensetzen: entity full_adder is port ( x : in std_logic; -- x input y : in std_logic; -- y input c_in : in std_logic; -- carry input s : out std_logic; -- sum output c_out : out std_logic -- carry output ); end full_adder; architecture structural of full_adder is begin end structural; signal a, b, c : std_logic; ha1 : half_adder port map (x => x, y => y, s => a, c => b); ha2 : half_adder port map (x => a, y => c_in, s => s, c => c); c_out <= b or c; 26

Komplexe Operatoren Zum Addieren zweier Zahlen in Binärdarstellung können mehrere Volladdierer zusammengeschaltet werden VHDL kennt aber auch arithmetische Operatoren s <= a + b; s <= a * b;... Außerdem lassen sich Funktionen definieren, z.b. crc <= crc16(x); Funktionen sind immer rein kombinatorisch 27

Prozesse Grundlegendes Konstrukt zur Verhaltensbeschreibung: Register process(clk, reset) 1 input + D Q output begin if reset = 1 then output <= 0 ; elsif rising_edge(clk) then output <= input + 1; end if; clk reset clear end process; Prozesse werden ausgeführt, sobald sich eines der Signale in der sensitivity list ändert Getaktete (synchrone) Logik rising_edge(clk) clk event and clk = 1 28

Parallelität In VHDL passiert alles gleichzeitig signal a, b, c, d : std_logic; process(clk) begin input a b c d Signal-Zuweisung if rising_edge(clk) then a <= input; b <= a; c <= b; d <= c; end if; clk Register Register Register Register end process; clk 0 1 2 3 4 5 6 7 8 a b c d input(0) input(1) input(2) input(3) input(4) input(5) input(6)... X input(0) input(1) input(2) input(3) input(4) input(5)... X X input(0) input(1) input(2) input(3) input(4)... X X X input(0) input(1) input(2) input(3)... 29

Parallelität Signal-Zuweisungen erfolgen nicht-blockierend (parallel) Variablen-Zuweisungen erfolgen blockierend (sequentiell) process(clk) variable a, b, c, d : std_logic; begin end process; Variablen-Zuweisung if rising_edge(clk) then a := input; b := a; c := b; d := c; end if; process(clk) variable a, b, c, d : std_logic; begin end process; if rising_edge(clk) then d := input; end if; außerdem existieren Variablen nur innerhalb eines Prozesses 30

Demonstration 31

Demonstration reset toplevel clk delaycounter displaycounter bcd2seg 50 MHz disp dp an Dezimalpunkt Zähler auf 7-Segment- Anzeige Daten Chip Select 32

bcd2seg.vhd -- $Id$ -- -- bcd2seg.vhd: BCD to 7-segment display encoder -- -- Converts a BCD-coded signal to seven-segment-display -- -- Author : Enno Luebbers <enno.luebbers@upb.de> -- Created: 24.04.2006 -- -- Major changes: -- 24.04.2006 Enno Luebbers File created. -- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.NUMERIC_STD.ALL; entity bcd2seg is port ( i_bcd : in integer range 0 to 15; o_7seg : out std_logic_vector(6 downto 0) ); end bcd2seg; architecture behavioral of bcd2seg is -- A -- ----- -- F B -- G -- ----- -- E C -- D -- ----- type slv_array is array(0 to 15) of std_logic_vector(6 downto 0); constant conversiontable : slv_array := ( -- ABCDEFG "1111110", -- 0 "0110000", -- 1 "1101101", -- 2 "1111001", -- 3 "0110011", -- 4 "1011011", -- 5 "1011111", -- 6 "1110000", -- 7 "1111111", -- 8 "1111011", -- 9 "1110111", -- A "0011111", -- B "1001110", -- C "0111101", -- D "1001111", -- E "1000111" -- F ); begin end Behavioral; o_7seg <= conversiontable(i_bcd); 33

counter.vhd -- $Id$ -- -- counter.vhd: Counter / Generics example -- -- Provides a simple up/down counter. Parameters can -- be set through generics -- -- Author : Enno Luebbers <enno.luebbers@upb.de> -- Created: 24.04.2006 -- -- Major changes: -- 24.04.2006 Enno Luebbers File created. -- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter is generic ( G_MAX : natural := 15; -- maximum range G_INIT : natural := 15; -- initial value G_UP : boolean := true -- count up? ); port ( i_clk : in std_logic; i_reset : in std_logic; i_enable : in std_logic; o_value : out natural range 0 to G_MAX ); architecture Behavioral of counter is begin signal value : natural range 0 to G_MAX; -- check generics assert G_MAX >= G_INIT report "G_INIT greater G_MAX" severity FAILURE; count : process(i_clk, i_reset) begin if i_reset = '1' then value <= G_INIT; elsif rising_edge(i_clk) and i_enable = '1' then if G_UP then value <= value + 1; else value <= value - 1; end if; end if; end process; o_value <= value; end Behavioral; end counter; 34

toplevel.vhd -- $Id$ -- -- toplevel.vhd: VHDL tutorial top level entity -- -- Top level entity for Digilent Spartan-3 evaluation board -- -- Author : Enno Luebbers <enno.luebbers@upb.de> -- Created: 24.04.2006 -- -- Major changes: -- 24.04.2006 Enno Luebbers File created. -- library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity toplevel is port ( component counter generic ( G_MAX : natural := 15; -- maximum range G_INIT : natural := 15; -- initial value G_UP : boolean := true -- count up? ); port ( i_clk : in std_logic; i_reset : in std_logic; i_enable : in std_logic; o_value : out natural range 0 to G_MAX ); end component; constant DELAY_INIT : integer := 50000000; signal counterenable : std_logic; signal countervalue : integer range 0 to 15 := 0; signal delay : integer range 0 to DELAY_INIT-1 := DELAY_INIT-1; signal displaydata : std_logic_vector(6 downto 0); ); end toplevel; clk : in std_logic; reset : in std_logic; -- LED display disp : out std_logic_vector(6 downto 0); dp : out std_logic; an : out std_logic_vector(3 downto 0) architecture structural of toplevel is component bcd2seg port ( i_bcd : in integer range 0 to 15; o_7seg : out std_logic_vector(6 downto 0) ); end component; begin delaycounter : counter generic map ( ) port map ( ); G_MAX => DELAY_INIT-1, G_INIT => DELAY_INIT-1, G_UP => false i_clk => clk, i_reset => reset, i_enable => '1', o_value => delay 35

toplevel.vhd displaycounter : counter generic map ( ) port map ( ); encoder : bcd2seg port map ( ); G_MAX => 15, G_INIT => 0, G_UP => true i_clk => clk, i_reset => reset, i_enable => counterenable, o_value => countervalue i_bcd => countervalue, o_7seg => displaydata counterenable <= '1' when delay = 0 else '0'; disp <= NOT displaydata; dp <= '1'; an <= "1010"; -- the LED display is active-low driven end structural; 36