+ All Categories
Home > Documents > VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use...

VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use...

Date post: 18-Mar-2018
Category:
Upload: dinhthu
View: 229 times
Download: 3 times
Share this document with a friend
46
Jim Duckworth, WPI Embedded Microprocessors 1 Embedded Microprocessors Module 12
Transcript
Page 1: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors1

Embedded Microprocessors

Module 12

Page 2: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors2

Topics

• Microcontrollers versus FPGAS

– What is the best for your application?

• Debugging embedded designs

– Chipscope Pro and Agilent FPGA Dynamic Probe

– Use VHDL models of system components (e.g. SDRAM)

• Xilinx Virtex-4, Virtex-5

– DSPslices, Ethernet MAC, integrated processors

• Adding Microcontrollers to FPGAs

– Picoblaze, Microblaze, Power PC

• Adding DSP functions to FPGAs

– Xilinx System Generator for Simulink

• Lessons learned and pitfalls to be avoided

Page 3: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors3

Microcontrollers versus FPGAs

• Microcontrollers

– Execute compiled programs written in ‘C’ or Assembler

• Program may be on the micro or in external flash memory

• Micro fetches instructions, decodes, manipulates data or I/O

– Sequential execution

• Requires multiple clock cycles for most operations

– Can be easily optimized for battery powered operations

• Only wake up in response to external interrupts

– Limited I/O of standard logic

• FPGAs

– ‘Sea of gates’ can be configured for any required logic

– Very good for high-speed parallel data processing (e.g. networks)

– Lots of I/O – versatile logic interface (LVDS etc)

– Can be easily partitioned into different functional blocks

– Not appropriate for simple control applications (not vending machine!)

Page 4: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors4

Digital Controller Board – Virtex II FPGA

SDRAM

Config

PROMLVDS

Interface

FPGA

Ethernet Transceiver

Page 5: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors5

FPGA Functional Blocks

Page 6: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors6

DDR SDRAM Controller – 128 byte writes

Page 7: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors7

Start of Write Cycle

Page 8: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors8

Start of ROW read cycle (2048 bytes)

Page 9: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors9

Part of SDRAM Initialization Sequence

Page 10: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors10

Virtex 4

$1,000

(25 off)

9604,320K98,304

96 DSP

slices

12,2885MXC4VLX100

29,504

9,312

1,920

CLB

flip-flops

<$9376648K3,6881.6MXC3S1600E

$30 1-

off

232360K1,164500KXC3S500E

<$210872K240100KXC3S100E

Price

(250K)

User

IO

Block

Ram (bits)

CLBs

(4 slices)

Syste

m

Gates

Device

Page 11: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors11

PPL Transceiver – Based on Virtex 4

Page 12: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors12

Transceiver Box

Page 13: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors13

Page 14: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors14

Page 15: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors15

Debugging Embedded Designs

• VHDL models of standard devices

– Micron models of all SDRAM devices – simulates behavior

• Xilinx ChipScope Pro

– Poor man’s logic analyzer!

– Connected and analyzed through JTAG port

– See on-line introduction (with CoreGen)

• Agilent FPGA Dynamic Probe

– Interfaces through special core inside FPGA

Page 16: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors16

Embedded Software Tools

CPU

Logic Design Tools

I/O

FPGA

Memory

Logic Design Tools

FPGA +

Memory + IP +

High Speed IO

(4K & Virtex)

Embedded Software Tools

CPU

Inte

gra

tio

n o

f F

un

ctio

ns

Inte

gra

tio

n o

f F

un

ctio

ns

TimeTime

Logic Design Tools

Embedded Software Tools

Logic + Memory

+ IP +

Processors +

RocketIO

(Virtex-II Pro)

Programmable Systems

usher in a new era of system

design integration

possibilities

Programmable Systems

usher in a new era of system

design integration

possibilities

Integration in System Design

Page 17: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors17

Embedded Processors

• Soft core processors – use on any FPGA

– Picoblaze 8-bit microcontroller

• Programmed in assembler

• Very useful for replacing complex state machines

– Microblaze 32-bit microcontroller

• Use Xilinx EDK – base system builder

• Program in ‘C’

• Hard Processor cores

– IBM Power PC 405 32/64-bit Processor

• 16 KB data cache and 16 KB instruction cache

• On Virtex II Pro and Virtex-4 devices

• Can add and mix multiple processors!

– Need to be familiar with micros (as well as logic design)

Page 18: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors18

Xilinx - Embedded Processing

Page 19: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors19

Picoblaze 8-bit microcontroller

Page 20: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors20

Picoblaze 8-bit microcontroller

Page 21: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors21

Picoblaze overview

Page 22: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors22

Picoblaze User Guide

Page 23: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors23

Picoblaze Block diagram

Page 24: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors24

Micro versus Logic

Page 25: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors25

Picoblaze connected to ROM

Page 26: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors26

Processor and ROM

Page 27: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors27

Adding Inputs (UART example)

Page 28: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors28

UART Transmit (assembler example)

Page 29: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors29

Simple Picoblaze Project

Page 30: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors30

Picoblaze resources – very low!

Page 31: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors31

KCPSM3 with ROM and UARTS

Page 32: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors32

Creating the ROM – using pBLAZE IDE

Page 33: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors33

Simulating the picoblaze code

Page 34: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors34

VHDL template to create ROM

-- Ken Chapman (Xilinx Ltd) October 2002

-- This is the VHDL template file for the KCPSM assembler.

-- Adapted for pBlazIDE by Henk van Kampen, www.mediatronix.com, March 2003

-- It is used to configure a Virtex(E, II) and Spartan-II(E, 3) block RAM to act as

-- a single port program ROM.

-- This VHDL file is not valid as input directly into a synthesis or simulation tool.

-- The assembler will read this template and insert the data required to complete the

-- definition of program ROM and write it out to a new '.vhd' file as specified by the

-- '.psm' file being assembled.

-- The assembler identifies all text enclosed by {} characters, and replaces these

-- character strings. All templates should include these {} character strings for

-- the assembler to work correctly.

-- The next line is used to determine where the template actually starts and must exist.

{begin template}

library IEEE ;

use IEEE.STD_LOGIC_1164.all ;

use IEEE.STD_LOGIC_ARITH.all ;

use IEEE.STD_LOGIC_UNSIGNED.all ;

library unisim ;

use unisim.vcomponents.all ;

entity {name} is

port (

clk : in std_logic ;

address : in std_logic_vector( 9 downto 0 ) ;

instruction : out std_logic_vector( 17 downto 0 )

) ;

Page 35: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors35

Simulating the whole design

Page 36: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors36

Microblaze 32-bit Soft Processor

Page 37: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors37

Microblaze Overview

Page 38: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors38

MicroBlaze-based Embedded Design

Flexible Soft IPMicroBlaze32-Bit RISC Core

UART10/100

E-Net

On-Chip

Peripheral

Off-ChipMemory

FLASH/SRAM

LocalLink™

FIFO Channels

0,1…….32

Custom

FunctionsCustom

Functions

BRAMLocal Memory

BusD-Cache

BRAM

I-Cache

BRAM

ConfigurableSizes

Arb

ite

r

Processor Local Bus

Instruction Data

PLBBus

Bridge

PowerPC

405 Core

Dedicated Hard IP

Arb

ite

r

Processor Local Bus

Instruction Data

PLBBus

Bridge

Bus

Bridge

PowerPC

405 Core

Dedicated Hard IP

PowerPC

405 Core

Dedicated Hard IP

PowerPC

405 Core

Dedicated Hard IPPossible in

Virtex-II Pro

Hi-SpeedPeripheral

GB E-Net

e.g.Memory

Controller

Hi-SpeedPeripheralHi-Speed

PeripheralGB

E-NetGB

E-Net

e.g.Memory

Controller

e.g.Memory

Controller

Arb

iter OPB

On-Chip Peripheral Bus

Page 39: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors39

Embedded DevelopmentTool Flow Overview

Data2MEM

Bitstream

Compiler/Linker

(Simulator)

C Code

Debugger

Standard Embedded SWDevelopment Flow

CPU code in on-chip memory

?

CPU code in off-chip memory

Download to Board & FPGA

Object Code

Standard FPGA HWDevelopment Flow

Synthesizer

Place & Route

Simulator

VHDL/Verilog

?

Download to FPGA

Page 40: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors40

EDK (Xilinx Platform Studio)

Page 41: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors41

Base System Builder

Page 42: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors42

Configuring Processor and I/O

Page 43: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors43

Microblaze Hardware Block Diagram

Page 44: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors44

Microblaze Software – C Program

Page 45: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors45

PowerPC405 Core

Dedicated Hard IP

Flexible Soft IP

RocketIO

PowerPC-based Embedded Design

Full system customization to meet performance, functionality, and cost goals

DCR Bus

UART GPIOOn-Chip

PeripheralHi-SpeedPeripheral

GB E-Net

e.g.Memory

Controller

Arb

iter

On-Chip Peripheral Bus

OPB

Arb

iter

Processor Local Bus

Instruction Data

PLB

DSOCM

BRAM

ISOCM

BRAM

Off-ChipMemory

ZBT SSRAMDDR SDRAM

SDRAM

Bus

Bridge

IBM CoreConnect™

on-chip bus standard

PLB, OPB, and DCR

Page 46: VHDL micros a - Worcester Polytechnic Instituteusers.wpi.edu/~rjduck/VHDL micros.pdf · – Use VHDL models of system components ... (as well as logic design) Jim Duckworth, ... •

Jim Duckworth, WPI Embedded Microprocessors46

Lessons Learned and Pitfalls to be Avoided

• Do we start with VHDL for synthesis or modeling?

• How do we understand timing behavior?

• VHDL is not a programming language

• Where have my signals or ports gone?

• How do I debug my design?

• Use std_logic types for all ports

• Make a test bench as soon as possible

• How do I debug my embedded microprocessor?

• How do I keep track of all the acronyms?


Recommended