IP cores. V. Angelov

Similar documents
EECS150 - Digital Design Lecture 16 - Memory

Hardware Design with VHDL Design Example: BRAM ECE 443

EECS150 - Digital Design Lecture 16 Memory 1

CDA 4253 FGPA System Design Xilinx FPGA Memories. Hao Zheng Comp Sci & Eng USF

Basic FPGA Architecture Xilinx, Inc. All Rights Reserved

Programmable Logic. Simple Programmable Logic Devices

VHDL: Modeling RAM and Register Files. Textbook Chapters: 6.6.1, 8.7, 8.8, 9.5.2, 11.2

Field Programmable Gate Array

Lecture 7. Standard ICs FPGA (Field Programmable Gate Array) VHDL (Very-high-speed integrated circuits. Hardware Description Language)

Review: Timing. EECS Components and Design Techniques for Digital Systems. Lec 13 Storage: Regs, SRAM, ROM. Outline.

ECE 545 Lecture 12. FPGA Embedded Resources 12/8/11. Resources. Recommended reading. Use of Embedded FPGA Resources in SHA-3 Candidates

ECE 545 Lecture 12. FPGA Resources. George Mason University

EE178 Lecture Module 2. Eric Crabill SJSU / Xilinx Fall 2007

The Virtex FPGA and Introduction to design techniques

MAX 10. Memory Modules

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 15 Memories

Chapter 2. Cyclone II Architecture

Today. Comments about assignment Max 1/T (skew = 0) Max clock skew? Comments about assignment 3 ASICs and Programmable logic Others courses

ECE 699: Lecture 9. Programmable Logic Memories

Parameterizable LocalLink FIFO Author: Wen Ying Wei, Dai Huang

ECE 448 Lecture 13. FPGA Memories. George Mason University

Run Pac-man Game Based on 8086/8088 FPGA IP Core. Authors: Kevin Xie, Michael Ye, Winston Zhu Last update: 1 st, August, 2007

LogiCORE IP Block Memory Generator v6.1

ECE 545: Lecture 11. Programmable Logic Memories

ECE 545: Lecture 11. Programmable Logic Memories. Recommended reading. Memory Types. Memory Types. Memory Types specific to Xilinx FPGAs

Digital System Construction

Field Programmable Gate Array (FPGA) Devices

Intelop. *As new IP blocks become available, please contact the factory for the latest updated info.

Intel Cyclone 10 LP Core Fabric and General Purpose I/Os Handbook

High-Performance Integer Factoring with Reconfigurable Devices

ECE 545 Lecture 17 RAM. George Mason University

FPGA for Complex System Implementation. National Chiao Tung University Chun-Jen Tsai 04/14/2011

Digital Integrated Circuits

COVER SHEET: Total: Regrade Info: 2 (6 points) 3 (8 points) 4 (10 points) 8 (12 points) 6 (6 points) 7 (6 points) 9 (30 points) 10 (4 points)

INTRODUCTION TO VHDL ADVANCED COMPUTER ARCHITECTURES. Slides by: Pedro Tomás. Additional reading: - ARQUITECTURAS AVANÇADAS DE COMPUTADORES (AAC)

Basic FPGA Architectures. Actel FPGAs. PLD Technologies: Antifuse. 3 Digital Systems Implementation Programmable Logic Devices

Guidelines to Migrating Spartan Designs to Cyclone Designs

HDL Coding Style Xilinx, Inc. All Rights Reserved

Using ProASIC PLUS RAM as Multipliers

In our case Dr. Johnson is setting the best practices

Altera FLEX 8000 Block Diagram

Laboratory Exercise 8

CDA 4253 FPGA System Design Op7miza7on Techniques. Hao Zheng Comp S ci & Eng Univ of South Florida

FPGA briefing Part II FPGA development DMW: FPGA development DMW:

FPGA RAM (C1) Young Won Lim 5/13/16

Summary. Introduction. Application Note: Virtex, Virtex-E, Spartan-IIE, Spartan-3, Virtex-II, Virtex-II Pro. XAPP152 (v2.1) September 17, 2003

Introduction to Field Programmable Gate Arrays

LogiCORE IP Block Memory Generator v7.1

ProASIC3/E SRAM/FIFO Blocks

CPE 626 Advanced VLSI Design Lecture 6: VHDL Synthesis. Register File: An Example. Register File: An Example (cont d) Aleksandar Milenkovic

Channel FIFO (CFIFO) (v1.00a)

TSEA44 - Design for FPGAs

CS211 Digital Systems/Lab. Introduction to VHDL. Hyotaek Shim, Computer Architecture Laboratory

Control and Datapath 8

Section I. Cyclone II Device Family Data Sheet

Spartan-6 FPGA Block RAM Resources

ORCA Series 4 Quad-Port Embedded Block RAM

VHDL for Modeling - Module 10

Optimal Management of System Clock Networks

Section I. Cyclone FPGA Family Data Sheet

Section I. Cyclone II Device Family Data Sheet

FPGA 101. Field programmable gate arrays in action

COVER SHEET: Total: Regrade Info: 5 (5 points) 2 (8 points) 6 (10 points) 7b (13 points) 7c (13 points) 7d (13 points)

EECS 151/251A Spring 2019 Digital Design and Integrated Circuits. Instructor: John Wawrzynek. Lecture 18 EE141

On-Chip Memory Implementations

ALTERA FPGAs Architecture & Design

FPGA Technology and Industry Experience

Problem Set 10 Solutions

ECEU530. Project Presentations. ECE U530 Digital Hardware Synthesis. Rest of Semester. Memory Structures

Introduction to the syshsi Block ispxpga and ispgdx2

PINE TRAINING ACADEMY

Section I. Cyclone FPGA Family Data Sheet

Upper Level Protocols (ULP) Mapping. Common Services. Signaling Protocol. Transmission Protocol (Physical Coding) Physical Interface (PI)

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

Digital System Design Lecture 7: Altera FPGAs. Amir Masoud Gharehbaghi

Sequential Logic - Module 5

FPGAs in a Nutshell - Introduction to Embedded Systems-

Spartan-6 Libraries Guide for HDL Designs. UG615 (v 14.1) April 24, 2012

Digital Design Laboratory Lecture 2

Summary of FPGA & VHDL

L2: FPGA HARDWARE : ADVANCED DIGITAL DESIGN PROJECT FALL 2015 BRANDON LUCIA

Section I. Cyclone FPGA Family Data Sheet

ECE 545 Lecture 12. Datapath vs. Controller. Structure of a Typical Digital System Data Inputs. Required reading. Design of Controllers

Section I. Arria GX Device Data Sheet

FIELD PROGRAMMABLE GATE ARRAYS (FPGAS)

Lecture 11 Memories in Xilinx FPGAs

Sign here to give permission for your test to be returned in class, where others might see your score:

CARDBUS INTERFACE USER MANUAL

V1 - VHDL Language. FPGA Programming with VHDL and Simulation (through the training Xilinx, Lattice or Actel FPGA are targeted) Objectives

VHDL And Synthesis Review

NIOS CPU Based Embedded Computer System on Programmable Chip

ENGG3380: Computer Organization and Design Lab4: Buses and Peripheral Devices

Advanced FPGA Design. Jan Pospíšil, CERN BE-BI-BP ISOTDAQ 2018, Vienna

Design Recommendations User Guide

MAX 10 FPGA Device Overview

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs

The Optimization of a Design Using VHDL Concepts

Stratix. Introduction. Features... Programmable Logic Device Family. Preliminary Information

S2C K7 Prodigy Logic Module Series

NIOS II Pixel Display

Transcription:

IP cores V. Angelov VHDL-FPGA@PI 2013 1

IP cores Soft IP cores Hard IP cores ROM, RAM, FIFO RISC CPU DSP - Multiplier SerDes Flash memory (boot, user) PCI, PCIe JTAG V. Angelov VHDL-FPGA@PI 2013 2

Soft IP cores Nobody wants to invent the bicycle again Modules, which are widely used, are available for different technologies, not always for free One such module can have many parameters and a special software (Wizard/Generator) to set them properly Each module should come with a reference design and a testbench in VHDL/Verilog The source code is typically not available, or is just a question of price In general the usage of IP cores saves time and money, but for small companies and small productions can be too expensive OpenCores is an alternative V. Angelov VHDL-FPGA@PI 2013 3

Typical soft IP cores PCI master-target, 32/64 bit, PCIe Ethernet, UART μp, μc (incl. old ones), RISC CPUs Interface to DRAM, SSRAM DSP: CORDIC, DDS, FFT, Filters VME, USB, CAN, I2C, SPI, SD card encryption / decryption V. Angelov VHDL-FPGA@PI 2013 4

RAM in FPGA distributed embedded Xilinx and Lattice have the option to use the LUTs (but not all in the chip) as 16x1 or 32x1 RAM (the so called distributed RAM) small RAM blocks can be created by combining many such LUTs and MUXes (implemented in other LUTs) not good for large RAM blocks bad performance, routing and logic resources can be read asynchronously! The alternative is to use embedded RAM blocks typically asynchronous reading is not supported! the blocks are of fixed size V. Angelov VHDL-FPGA@PI 2013 5

RAM in FPGA embedded blocks Direct link interconnect to adjacent LAB C4 Interconnects Direct link interconnect from adjacent LAB 16 dataout M4K RAM 16 Block 16 M4K RAM Block Local Interconnect Region Byte enable Clocks address Control Signals datain LAB Row Clocks Cyclone II M4K RAM 6 R4 Interconnects Direct link interconnect to adjacent LAB Direct link interconnect from adjacent LAB 4K 1 2K 2 1K 4 512 8 512 9 256 16 256 18 128 32 128 36 The width can be different at the input and at the output Dual port mode FIFO mode up to 250 MHz V. Angelov VHDL-FPGA@PI 2013 6

RAM in FPGA how to use it in VHDL In order to use RAM in FPGAs either generate it using a specific tool from the FPGA vendor (Core Generator, MegaWizard) instantiate directly the corresponding primitives (but if you need to change frequently the size of the memory this is not very practical) describe it in VHDL following the expected style, otherwise it will be not implemented as block RAM check the report after the compilation! this is very nice, as the design remains easily portable to other technologies! V. Angelov VHDL-FPGA@PI 2013 7

Single port RAM in FPGA... USE IEEE.std_logic_unsigned.ALL; entity ssram is generic (Na : Positive := 8; Nd : Positive := 16; async_rd : Boolean port(clk : in std_logic; we : in std_logic; addr : in std_logic_vector(na-1 downto 0); din : in std_logic_vector(nd-1 downto 0); dout : out std_logic_vector(nd-1 downto 0) ); end ssram; architecture a of ssram is type t_mem_data is array(0 to 2**addr'length - 1) of std_logic_vector(dout'range); signal mem_data : t_mem_data; signal raddri, addri : integer range 0 to 2**addr'length - 1; begin addri <= conv_integer(addr); ram: process(clk) begin if clk'event and clk='1' then raddri <= addri; := false); RAM 256 x 16 x if we = '1' then addr(7:0) mem_data(addri) <= din; end if; Note that asynchronous reading is end if; not available in the RAM blocks end process; ar: if async_rd generate dout <= mem_data( addri); end generate; sr: if not async_rd generate dout <= mem_data(raddri); end generate; end; V. Angelov VHDL-FPGA@PI 2013 8 we clk din(15:0) WEA ENA RSTA CLKA ADDRA(7:0) DIA(15:0) WEB ENB RSTB CLKB ADDRB(L:R) DIB(L:R) DOA(15:0) DOB(L:R) dout(15:0)

Dual port RAM in FPGA entity dp_sram is generic (Na : Positive := 8; Nd : positive := 16); port( waddr : in std_logic_vector(na-1 downto 0); raddr : in std_logic_vector(na-1 downto 0); signal raddri : integer range 0 to 2**raddr'length - 1; signal waddri : integer range 0 to 2**waddr'length - 1; begin waddri <= conv_integer(waddr); ram: process(clk) begin if clk'event and clk='1' then raddri <= conv_integer(raddr); if we = '1' then mem_data(waddri) <= din; end if; end if; end process; dout <= mem_data(raddri); end; we clk din(15:0) raddr(7:0) Two independent address ports (write/read) with common clock WEA ENA RSTA CLKA WEB ENB RSTB CLKB RAM 256 x 16 256 x 16 ADDRA(7:0) DIA(15:0) ADDRB(7:0) DIB(L:R) DOA(L:R) DOB(15:0) dout(15:0) waddr(7:0) V. Angelov VHDL-FPGA@PI 2013 9

Dual port dual clock RAM in FPGA entity dc_dp_sram is generic (Na : Positive := 8; Nd : positive := 16); port(wclk : in std_logic; rclk : in std_logic; begin waddri <= conv_integer(waddr); ram: process(wclk) begin if wclk'event and wclk='1' then if we = '1' then mem_data(waddri) <= din; end if; end if; end process; process(rclk) begin if rclk'event and rclk='1' then raddri <= conv_integer(raddr); end if; end process; dout <= mem_data(raddri); end; Two independent address ports (write/read) with different clocks we clk din(15:0) raddr(7:0) waddr(7:0) WEA ENA RSTA CLKA WEB ENB RSTB CLKB RAM 256 x 16 256 x 16 ADDRA(7:0) DIA(15:0) ADDRB(7:0) DIB(L:R) DOA(L:R) DOB(15:0) dout(15:0) V. Angelov VHDL-FPGA@PI 2013 10

Waveforms of RAM in FPGA Common signals CLK WE WADDR XX A0 A1 A2 A3 A4 DIN XX D0 D1 D2 D3 D4 Single Port RAM SP_ADDR XX A0 A1 A2 A3 A4 A0 A1 A2 A3 A4 DOUT_AS XX D0 XX D1 XX D2 XX D3 XX D4 XX D0 D1 D2 D3 D4 Dual Port RAM read CLK asynchr. read RADDR_DP XX A0 A1 A2 A3 A0 A1 A2 A3 A4 DOUT_DP XX D0 D1 D2 D3 XX D0 D1 D2 D3 D4 Dual Clock RAM read synchr. read, t CO RCLK RADDR_DC XX A0 A1 A2 A3 A4 DOUT_DC XX D0 D1 D2 D3 D4 t CO V. Angelov VHDL-FPGA@PI 2013 11

FIFO First In First Out Used as derandomizing buffer between devices with different speed data resynchronization between different clock domains Single clock and dual clock Consists of a dual port memory, write pointer, read pointer and control logic V. Angelov VHDL-FPGA@PI 2013 12

Single clock FIFO(1) dual port memory wrreq din write pointer clk din we waddr dout raddr dout clr ena clk q counter clr ena clk q counter read pointer sclr rdreq control logic word counter up/down full empty If the reading is synchronous, the output data will have 1 clock delay V. Angelov VHDL-FPGA@PI 2013 13

Single clock FIFO(2) ENTITY sc_fifo is generic (Na : Integer := 4; Nd : Integer := 8); PORT ( din : in std_logic_vector(nd-1 downto 0); wrreq : in std_logic; rdreq : in std_logic; clk : in std_logic; sclr : in std_logic; dout : out std_logic_vector(nd-1 downto 0); full : out std_logic; empty : out std_logic); end sc_fifo; signal almost_full : std_logic_vector(na-1 downto 0); signal almost_empty : std_logic_vector(na-1 downto 0); signal wpointer : std_logic_vector(na-1 downto 0); signal rpointer : std_logic_vector(na-1 downto 0); signal nwords : std_logic_vector(na-1 downto 0); signal fifo_cmd : std_logic_vector( 1 downto 0); signal fifo_status : std_logic_vector( 1 downto 0); signal fifo_full : std_logic; signal fifo_empty : std_logic; begin almost_full <= (0 => '0', others => '1'); almost_empty <= (0 => '1', others => '0'); fifo_cmd <= wrreq & rdreq; fifo_status <= fifo_full & fifo_empty; process(clk) begin if clk'event and clk='1' then if sclr = '1' then wpointer <= (others => '0'); rpointer <= (others => '0'); nwords <= (others => '0'); fifo_full <= '0'; fifo_empty <= '1'; else case fifo_cmd is when "10" => -- write if fifo_full='0' then wpointer <= wpointer+1; if nwords = almost_full then fifo_full <= '1'; end if; nwords <= nwords +1; fifo_empty <= '0'; end if; when "01" => -- read if fifo_empty='0' then rpointer <= rpointer+1; if nwords = almost_empty then fifo_empty <= '1'; end if; nwords <= nwords -1; fifo_full <= '0'; end if; V. Angelov VHDL-FPGA@PI 2013 14

Single clock FIFO(3) when "11" => -- write & read case fifo_status is when "00" => -- not full, not empty wpointer <= wpointer+1; rpointer <= rpointer+1; when "10" => -- full, not empty nwords <= nwords -1; fifo_full <= '0'; when "01" => -- not full, empty nwords <= nwords +1; fifo_empty <= '0'; when others => NULL; -- impossible!!! end case; when "00" => NULL; when others => wpointer rpointer end case; end if; end if; end process; nwords fifo_full <= '-'; fifo_empty <= '-'; <= (others => '-'); <= (others => '-'); <= (others => '-'); dual port single clock memory dpr: dp_sram generic map( Na => Na, Nd => Nd) PORT map( din => din, waddr => wpointer, raddr => rpointer, we => wrreq, clk => clk, dout => dout); empty <= fifo_empty; full <= fifo_full; Writing to a full FIFO and reading from an empty FIFO should NEVER happen! Implementing some special logic to treat these cases in the FIFO is not very reasonable (either some input data will be lost or some wrong data will be read), as it will slow down its normal operation! V. Angelov VHDL-FPGA@PI 2013 15

Single clock FIFO(4) Simulation of the sc_fifo. The valid signal in the testbench is just the registered rdreq. Writing to a full and reading from an empty are NOT tested! clk sclr wrreq din XX 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D rdreq dout XX 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 05 0D 06 valid full empty wpointer X 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 rpointer X 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 nwords X 0 1 2 3 4 5 6 7 8 7 8 7 6 5 4 3 2 1 0 1 0 V. Angelov VHDL-FPGA@PI 2013 16

Data resynchronization with dual clock FIFO optional register valid_in data_in clk_in GCNTi E Q C Gray counter decoder E A Y0 Y1 Y2 Y3 dual port RAM write address D Q E C D Q E C D Q E C D Q E C 4:1 mux REG D Q C GCNTq E C Q D Q D Q C Gray counter read address comp A B A=B valid_out data_out clk_out write dreg0..3 read For more details see the VHDL code in resync_sdr.vhd clk_in clk_out V. Angelov VHDL-FPGA@PI 2013 17

Data resynchronization simulation CLK_IN domain clk_in clear_n_in valid_in data_in D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD gray_cnt X 0 1 3 2 0 1 3 2 0 1 3 2 0 dreg(0) XX D1 D5 D9 dreg(1) XX D2 D6 DA dreg(3) XX D3 D7 DB dreg(2) XX D4 D8 DC CLK_OUT domain clk_out clear_n_out new_cnt X 0 1 3 2 0 1 3 2 0 1 3 2 old_cnt X 0 1 3 2 0 1 3 2 0 1 3 valid_i data_o_i XX D1 D2 D3 D4 D5 D2 D6 D7 D8 D9 DA DB valid_out data_out XX D1 D2 D3 D4 D5 D6 D7 D8 D9 DA V. Angelov VHDL-FPGA@PI 2013 18

FPGA Multiplier blocks Data A Data B D signa (1) signb (1) aclr clock ena ENA D CLRN ENA CLRN Q Q Input Register D ENA CLRN Q Output Register Embedded Multiplier Block Cyclone II Multiplier Typically two possible configurations: 2 x (9 x 9 18) or 18 x 18 36 Optional registers at the input/output Data Out All 4 combinations of the integer types (signed/unsigned) Basic element to implement digital filters and DSP Size and performance without/with using multiplier blocks: Size f MAX [MHz] LE f MAX [MHz] MultBlocks(9x9) 9 x 9 144 122 260 1 18 x 18 90 426 260 2 V. Angelov VHDL-FPGA@PI 2013 19

FPGA additional hard coded modules Multi-Gigabit serializer / deserializer PMA Analog Section PCS Digital Section FPGA Fabric Deserializer Clock Recovery Unit n (1) Word Aligner XAUI Lane Deskew Rate Matcher 8B/10B Decoder Byte Deserializer Phase Compensation FIFO Buffer m (2) Reference Clock Receiver PLL Reference Clock Transmitter PLL n Serializer (1) 8B/10B Encoder Byte Serializer Phase Compensation FIFO Buffer m (2) V. Angelov VHDL-FPGA@PI 2013 20

FPGA other modules CPU cores PowerPC in Xilinx Virtex 4 / 5 Internal FLASH memory, for FPGA booting and to initialize RAM blocks, as well as for data which should be not lost after power down Actel Fusion, ProASIC and IGLOO, LatticeXP2, Xilinx Spartan 3AN V. Angelov VHDL-FPGA@PI 2013 21

JTAG CPLD core JTAG master Connectivity test on the PCB Control of all I/O cells For the inputs: - read the signal coming to the pin - set the signal to the core FPGA core ASIC core For the outputs: - Read the signal from the core - set the signal to the pin Programming of CPLD/FPGA, test of ASIC V. Angelov VHDL-FPGA@PI 2013 22