+ All Categories
Home > Documents > Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate...

Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate...

Date post: 15-Jun-2018
Category:
Upload: lyliem
View: 286 times
Download: 4 times
Share this document with a friend
20
ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE Department, Rice University Page 1 Catapult C Synthesis Work Flow Tutorial ELEC 522 Advanced VLSI Design, Rice University Version 1.3 10/14/2010, Guohui Wang Introduction In this tutorial, you will go through the complete work flow of Catapult C Synthesis, including bit accurate C program simulation, HDL generation, ModelSim/ISE Simulator simulation/verification, and integration with System Generator. You will build a simple sum of square computation block using Catapult C tool. Objectives After this tutorial lab, you will be able to: Write C/C++ code in Catapult C. Compile and simulate the C/C++ code using GCC; Use Catapult C to generate HDL code; Simulate/Verify the generated HDL model in ModelSim/ISE built-in Simulator; Integrate the HDL model into System Generator design by using the Black-box block. Then simulate a complete system in System Generator. Design Description Use Catapult C Synthesis to implement a “sum of square” computation: Computation equation: c = a*a + b*b; Data type: a and b are both 16bit fixed-point numbers; c is 34bit number. Tools Used in This Lab In this lab, we will use the following tools: Mentor Graphics Catapult C Synthesis 2009a.85 GCC 4.2.2 Xilinx ISE 10.1.3 ModelSim SE6.5c Xilinx System Generator 10.1 MATLAB 2008a
Transcript
Page 1: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE Department, Rice University Page 1

Catapult C Synthesis Work Flow Tutorial

ELEC 522 Advanced VLSI Design, Rice University

Version 1.3 10/14/2010, Guohui Wang

Introduction In this tutorial, you will go through the complete work flow of Catapult C Synthesis, including bit accurate C program simulation, HDL generation, ModelSim/ISE Simulator simulation/verification, and integration with System Generator. You will build a simple sum of square computation block using Catapult C tool.

Objectives After this tutorial lab, you will be able to:

Write C/C++ code in Catapult C. Compile and simulate the C/C++ code using GCC;

Use Catapult C to generate HDL code;

Simulate/Verify the generated HDL model in ModelSim/ISE built-in Simulator;

Integrate the HDL model into System Generator design by using the Black-box block. Then simulate a complete system in System Generator.

Design Description Use Catapult C Synthesis to implement a “sum of square” computation:

Computation equation: c = a*a + b*b;

Data type: a and b are both 16bit fixed-point numbers; c is 34bit number.

Tools Used in This Lab In this lab, we will use the following tools:

Mentor Graphics Catapult C Synthesis 2009a.85

GCC 4.2.2

Xilinx ISE 10.1.3

ModelSim SE6.5c

Xilinx System Generator 10.1

MATLAB 2008a

Page 2: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE Department, Rice University Page 2

Procedure This tutorial comprises 6 primary steps:

1. Create a new Catapult project. Write C++ code in Catapult C; 2. Simulate C++ code using GCC; 3. Generate Verilog HDL code in Catapult; 4. Simulate/Verify HDL model in ModelSim/ISE-simulator; 5. Synthesize your HDL model using Xilinx ISE; 6. Use black-box to integrate the HDL model into System Generator and simulate the complete system

in System Generator.

Please notice that the goal of this document is only to show the basic tool flow. Therefore, we do not optimize our design. In your project design, you might need to go back and forth for a couple of iterations between step 1 and step 4 to optimize your design. Besides, in this simple tutorial I have not considered the interface optimization. In your project, you need to consider the interface design, for example, pointer VS non-pointer interfaces.

STEP 1: C Programming in Catapult C Synthesis Create a new folder. Start the Catapult tool on the Linux server. Then create a new project in Catapult.

Click “Set Working Directory”, in the popup dialog select the folder you just created.

In the menu, select File->New to create a new file. Type in the code below: Select File->Save as, to save this file as “example.h”.

Data type uint34 has been defined in ac_int.h: typedef ac_int<34, true> uint34;

Then create another new file, type in the following code, then save it as “example.cpp”.

#include "example.h" #pragma hls_design top int34 sumsquare(int16 a, int16 b) { int34 c = 0; c = a * a + b* b; return c; }

//Include Catapult bit accurate types #include "ac_int.h" int34 sumsquare(int16 a, int16 b);

Page 3: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC

S

C 522 Catapult

In thCatasums

From

errorsynta

Step 2: Si Then

savegene

o

t C Synthesis W

he cpp file, thapult tool thasquare( ) is d

m the task bar in your codax error in yo

imulate Cn we need toe it as “examerate some te

o In this ficompiler

#include <#include " int main( int16 int16 int34 for ( aa bb cc prcc.to_int6 } return}

Work Flow Tu

he header filat this kerneldefined.

ar, click “Setde. Otherwiour code.

C++ Codeo use GCC tomple_tb.cpp”st values, and

file, ‘//’ is usr that the stat

<stdio.h> "example.h"

() { aa = 0; bb = 0; cc = 0;

int i = 0;a = i; b = i+1; c = sumsquarintf ( "#%64());

n 0;

utorial EC

le is includedl function is

tup Design”.ise, the tool

e Using GCo simulate y

”. This is oud then print t

sed when yotement is not

"

; i < 10; i

are(aa, bb)%d: %d^2 +

E Department

d at the begithe top leve

If Catapult shows you t

CC your C++ codur testbench the calculatio

ou need to brfinished and

i++ ) {

; %d^2 = %d\

t, Rice Univer

nning. Then el design for

says “Passedthe error(s).

de. Create a in C++ lang

on results on

reak one stad will continu

\r\n", i, a

rsity

‘hls_design r the HDL m

d Analyze”, This could h

new file, typguage. Basicthe terminal

atements intoue in the next

aa.to_int()

top’ pragmamodel. Finall

it means thehelp you quic

pe the followcally, in this .

o two lines, t line.

, bb.to_int

Pag

a is used to ty, the functi

re is no syntckly debug t

wing code, atestbench, w

and it tells t

t(),//

e 3

tell ion

tax the

and we

the

Page 4: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE Department, Rice University Page 4

o Since aa, bb, cc are all Algorithmic C datatypes, they are not supported by standard printf( ) function. In order to print the values of aa and bb, you need to use a member method to_int( ) of the Class int16 to convert int16 datatype to the C++ int datatype, so that we could print the value through printf( ) function. Because cc is a 34bit number, if you convert it to the C++ int type, you will lose 2bits’ information. Therefore, you should use the member method to_int64( ) to convert int34 into C++ long long int datatype. (Please refer to the Chapter 2 in the document “Algorithmic C Datatypes”)

In order to compile the code using GCC, we need a Makefile. We could modify the Makefile from tutorial

lab2. Finally, your Makefile will look like this:

Notice that, ${MGC_HOME} is an environment variable that points to the install path of Mentor Graphics Catapult C Synthesis. This environment varialble has been set when you log in the Linux server. In the .tcshrc file under your home directory, you source several setup scripts, and one of them sets the MGC_HOME environment variable.

At the Linux prompt, use “make” command to compile the testbench code. You will get an executable file named “example”. Run the executable file, you can see the printed results.

# Makefile for example_tb.cpp CPP = /usr/bin/g++ INCLUDE = -I ${MGC_HOME}/shared/include TARGET = example OBJECTS = example.o example_tb.o ${TARGET}: ${OBJECTS} ${OBJECTS}: example.cpp example_tb.cpp example.h Makefile %.o : %.cpp ${CPP} -c ${INCLUDE} $< ${TARGET}: ${OBJECTS} ${CPP} ${OBJECTS} ${LINKARGS} -o $@ clean:

rm -rf *.o ${TARGET}

Page 5: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC

S

C 522 Catapult

It is

Step 3: G Conf

click

t C Synthesis W

clear that the

enerate Vfigure your dk Apply butto

Work Flow Tu

e simulation

Verilog Hdesign for Xion.

utorial EC

results are co

HDL Codeilinx FPGA, V

E Department

orrect. So far

e in CatapVirtex-II Pro

t, Rice Univer

r, we have fin

pult C Syno 2VP30ff896

rsity

nished the C+

nthesis 6-7, set the fr

++ code simu

frequency to

Pag

ulation.

100MHz. Th

e 5

hen

Page 6: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Sincsums

Click

clickin thto ch Here

Then

From

App

t C Synthesis W

ce you have square” func

k “Architectuk “Schedule”he Gantt charhange the arc

e, we just sim

n we pipeline

m the menu, ly & Save.

Work Flow Tu

more than ction, and che

ure constrain” to check thert. Based on tchitecture par

mply change t

e the ‘sumsqu

in Tools->Se

utorial EC

one cpp fileeck the “Top

nts” in the tae Gantt chartthe schedule rameters to o

the Design g

uare_main’ l

et options->O

E Department

e, you need Design” box

ask bar on tht. In your proresults, you

optimize your

goal from ‘are

oop.

Output->Outp

t, Rice Univer

to set one x. Then click

he left. Confioject design,might need t

r design.

ea’ to ‘latenc

put format, c

rsity

as the HLS k Apply.

figure the arc you need toto go back to

cy’.

check the box

top level fi

chitecture paro check the tio “Architectu

x for “Verilo

Pag

ile. Select “I

rameters. Thiming scheduure constraint

og”. Then cli

e 6

Int

hen ule ts”

ick

Page 7: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC

S

C 522 Catapult

Fina

resouas w

Step 4: SiIn ortestbthe tthe w

Aftethe ttestbcompbreakYou

t C Synthesis W

ally, click “Gurce usage. V

well as the crit

imulate/rder to simulbench. Howetestbench easwaveform an

er that, you wtestbench fil

bench is thaplicated testkpoints in thare allowed

Work Flow Tu

Generate RTVerilog HDLtical path.

/Verify HDlate/verify thver, the ISE sily. In this s

nd use it to sim

will generate ale and use i

at the text-bat vectors. Ahe testbench

to step over

utorial EC

L”. In the OL RTL model

DL Modehe Verilog HD

tool providestep, you wilmulate the H

a Verilog HDit to simulatased testben

Another reasoand debug thyour testben

E Department

Output Files l is generated

l in ModeDL code genes a graphic-ll use ISE to

HDL model.

DL testbenche our model

nch is muchon is that bhe testbench

nch and check

t, Rice Univer

folder, you d. You can al

elSim/ISEnerated by Cabased testben generate a t

h based on thl. The reaso

h more flexiby using a t

just like debk the value in

rsity

can check so check the

E-simulatatapult, you nch editor thtestbench wa

e testbench won why you ible so that text-based tebugging a C+n each registe

the reports f schematics f

tor could write a

hat could helaveform. The

waveform. Ystill need ayou could

estbench yo++ program er.

Pag

for timing afor your desi

a Verilog HDlp you generaen you can e

You will modia Verilog HD

generate mou could insin Visual C+

e 7

and ign

DL ate dit

ify DL ore ert

++.

Page 8: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

In th

ISE that be anwith

Moda unthe ichec

In thto sim

Startfigur

St

Crea

ISE

St

Ge

V

Tes

t C Synthesis W

his step, you w

simulator (ISallows you tn even more

hin your desig

delSim is onenified debug industry makck www.mod

his step, you mulate the H

t Xilinx ISE re below.

tep (1): 

ate a new 

E project 

tep (5): 

enerate 

Verilog 

stbench 

Work Flow Tu

will learn to

Sim) is a simo generate a fundamental

gn environme

e of the mostenvironmentke it easy todel.com/conte

will first useHDL model ar

on the Win

Step

Impo

fi

Step

Modif

Ver

Testb

utorial EC

use Xilinx IS

mulation toolsimulation tel step within ent. For more

t powerful sit for Verilogo adopt in thent/modelsim

e ISE to buildre introduced

ndows PC. C

p (2): 

ort RTL 

ile 

p (6):     

fy the 

ilog 

bench 

E Department

SE, ISE simu

s which is buestbench quiyour design

e details, ple

imulation and, VHDL and

he majority om-se-high-per

d a new projd, respectivel

Create a new

Step (

Create

testbe

wavefo

Step 

Simulate

the Ve

Testb

t, Rice Univer

ulator and Mo

uilt in the Xiickly in an inn flow with thase check htt

d verificationd SystemC. Gof process anrformance-si

ect. Then thely.

ISE project

3): 

e a 

nch 

orm 

(7):    

e using 

erilog 

ench 

rsity

odelSim to si

ilinx ISE toonteractive wayhe tight integtp://www.xil

n tools in theGood standarnd tool flowmulation-and

e methods of

t. Set the pro

Step (

Simula

using t

wavefo

imulate your

ol. It has a wy. The HDL

gration of theinx.com/tool

e CAD indusrds and platfs. For more d-debug.

f using ISim

oject configu

4): 

ate 

the 

orm 

Pag

r HDL model

waveform editsimulation c

e ISE Simulatls/isim.htm.

stry. It providform support

details, plea

and ModelS

uration like t

e 8

l.

tor can tor

des in

ase

im

the

Page 9: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Copy

creat‘mgcrtl_m

NowIf no

Righ‘exam

Click

want

t C Synthesis W

y rtl.v and rted in the prc_in_wire’, mgc_ioport.v

w your top moot, please righ

ht clickmple_rtl_tb’

k Next buttont to verify the

Work Flow Tu

rtl_mgc_ioporevious step)‘mgc_out_s

v defines the V

odule shouldht click ‘sum

.

n, then you ne top level m

utorial EC

ort.v from th). The reasonstdreg’ interVerilog mod

d be ‘sumsquamsquare’ and

, select ‘A

need to assigmodule, select

E Department

he Catapult pn why we nrfaces in o

del for these i

are’. The moselect ‘Set as

Add new sour

n the Unit Ut ‘sumsquare

t, Rice Univer

project foldeneed the rtl_mour designinterfaces.

odule with a s top module

rce’. Add a n

Under Test (Ue’, click Next

rsity

er into the Imgc_ioport.v(please ref

icon in e’.

new Test Be

UUT) for thist, then click F

SE project fv file is that fer to lab3

front of it is

ench Wavefor

s testbench. HFinish.

Pag

folder (we juwe have us

for detail

the top modu

rm. Name it

Here, since y

e 9

ust sed ls).

ule.

as

you

Page 10: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

In th

will

This‘a_rsby rsimu

Righ

waveThen(*Pl

t C Synthesis W

he ‘Initial Timsee the wave

is the testbesc_z’ and ‘b_ight clicking

ulation time.

ht click the weform as then some inputease refer to

Work Flow Tu

ming and Cloeform as belo

ench wavefor_rsc_z’. Youg the wavefoIn this exam

waveform, ine picture belot values are g the ISim Use

utorial EC

ock Wizard’,ow:

rm. The clocu might noticorm; select ‘S

mple, input 50

n the menu, sow (*). Noti

given to ‘a_rser Guide for

E Department

, just keep th

ck is already ce that the simSet the end

000 ns.

select Decimice that the msc_z’ and ‘b_the details a

t, Rice Univer

he default val

set for you. mulation timof Test Ben

mal for the damodule is re

_rsc_z’ input about using th

rsity

lue and click

You could eme is a little s

ch’. In the p

ata display foeset at the beports. Finall

he ISim GUI.

k Finish. Onc

dit the input short. We coupop-up dialo

or each inputeginning of tly, save the wI.)

Page

ce finished, y

value for ‘rsuld change thg, input a ne

t. Then edit tthe simulatio

waveform.

10

you

st’, his ew

the on.

Page 11: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

(*Plfollo

ISim In th

notic

Doub

and simu

t C Synthesis W

ease notice:owing steps w

m Simulahe source tabce under the P

ble click ‘Simthe timing a

ulator.

Work Flow Tu

: for both ISwill be differe

ation Procb, select ‘BeProcess tab,

mulate Behaalso met our

utorial EC

ISim and Moent.)

cedure: ehavior simuthere is a new

avioral Moder expectation

E Department

odelSim sim

ulation’. Selew item called

l’ to start then. By far, yo

t, Rice Univer

ulation, the

ect ‘exampled ‘Xilinx ISE

e simulation.ou have fini

rsity

procedures

e_rtl_rb’ by E Simulator’.

You can seeished simula

above are

clicking it.

e that the resation/verificat

Page

the same; t

Then you w

sults are corretion using IS

11

the

will

ect SE

Page 12: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Next

in Sobe opfile (

Fromthe t

Sele

Mod

By f

t C Synthesis W

t, you will geource tab in pen as a text(extension .v

m the menu Ftestbench as b

ct the Verilodel’, you coul

far, you have

Work Flow Tu

enerate a Verthe process tt, but it is rea

v) using a diff

File->Projectbelow. In thi

og HDL testld see the sim

finished sim

utorial EC

rilog HDL tetab. Double cad-only now.ferent name,

t->Add Sours example, tw

tbench in Somulation resu

mulation using

E Department

estbench and click ‘View . From the msuch as ‘exa

rce, add the fwo new grou

ource tab by ults for your n

g ISim. Next

t, Rice Univer

use it to runGenerated T

menu, select Fample_rtl_tb_

file ‘exampleups of input v

clicking it. new input.

t, you will lea

rsity

n the simulatiTestbench AsFile->Save as_text.v’. Now

e_rtl_tb_text.values are add

Then double

arn how to si

ion. Select ‘e HDL’, yours, save it as a

w you are allo

.v’ into the pded. Save yo

e click ‘Sim

imulate using

Page

example_rtl_tr testbench wa Verilog HDowed to edit

project. Modour changes.

mulate Behav

g ModelSim.

12

tb’ will DL it.

ify

ior

Page 13: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

MoAssuVerisame YouprojMod

Righoptio

Next

simuoptioC:\m

t C Synthesis W

odelSim Siume you havilog testbenche.

u need to setject propertdelSim*. (*N

ht click the pron to ‘Model

t, you need ulation from on ‘Model Te

modeltech_6.

Work Flow Tu

imulationve two testbh. You could

t the path oties*. You alNotice: these

roject name lSim-SE Veri

to set the paISE project

ech Simulato5c\win32. O

utorial EC

n Procedubench files nd start the Mo

of ModelSimlso need to settings need

‘xc2vp30-7filog’.

ath for Modt. Go to menor’, click the nce you finis

E Department

ure: now: one is odelSim simu

m simulatorcompile the

d to be done

ff896’, select

elSim simulanu Edit->Prebrowse buttosh, It should

t, Rice Univer

the waveforulation with e

r. Then selece HDL simuonly once for

‘Properties’

ator in ISE eferences->Ion, then selecbe like this:

rsity

rm testbencheither testben

ct ModelSimulation librar each ISE pr

in the pop-u

tool so that SE General-ct ‘modelsim

h, and the otnch, since the

m as the simaries that wroject.)

up menu. Set

you could s->Integrated

m.exe’ in the f

Page

ther is the tee method is t

mulator in twill be used

t the ‘Simulat

start ModelSTools, for t

following pa

13

ext the

the by

tor’

im the

ath :

Page 14: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Next

projewill Set t

Start

have Youthe s

Chantestbessen

t C Synthesis W

t you need toect by clickinsee ‘Compil

the “Simulato

t compiling He configured

u have finishsimulation. T

nge the ‘Soubench ‘exampntially the sa

Work Flow Tu

o compile thng its name. le HDL Simuor Path” to th

HDL simulatall the setting

ed all the coThe followin

urces for’ optple_rtl_tb’. E

ame.

utorial EC

he HDL simuIn the ‘Proculation Librahe folder whe

tion libraries gs above cor

onfigurationng steps are

tion in the ‘SEither the tex

E Department

ulation libraresses’ panel,aries’. Right ere ModelSim

by double clrrectly, the co

ns needed to almost the s

Sources’ panext testbench o

t, Rice Univer

ies for the M, expand the click it, sele

m.exe is insta

licking ‘Comompiling pro

start a Modsame as you

el to ‘Behavior the wavef

rsity

ModelSim simmenu under

ect the ‘Propalled.

mpile HDL Scess will fini

delSim simuldid in the IS

ioral Simulatform testbenc

mulation. Selthe ‘Design

perties’ optio

imulation Liish in a while

lation. Now,Sim simulat

tion’. Click ych is fine, be

Page

lect the curreUtilities’. Y

on in the men

ibraries’. If ye.

, you can staion.

your simulatiecause they a

14

ent You nu.

you

art

ion are

Page 15: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

FinasimutoolsGuid

By nhavetestbsame

t C Synthesis W

ally, double culation results that can hede for the det

now, you have also learnt bench. Theree way.

Work Flow Tu

click ‘Simulas in the Mod

elp you speetails about us

ve become fahow to gen

fore, you are

utorial EC

ate BehavioradelSim windod up your dsing the Mod

familiar with nerate and me able to des

E Department

al Model’ toows (*). Moddesign/simuladelSim GUI.)

simulating amodify the Vsign more co

t, Rice Univer

o start the ModelSim has mation process

an RTL modVerilog testbomplicated t

rsity

odelSim simmore powerfus. (*Please re

del using ISimbench from testbenches f

mulation. Youul debugging efer to the M

m and Modea graphic-bafor your own

Page

u can check tand simulati

ModelSim Us

elSim. And yased waveforn design in t

15

the ion ser

you rm the

Page 16: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC

S

C 522 Catapult

Step 5: SyIn thHDLAftea beh

Still Doub

Norm

How

Go t

The synthimpoyou Usua32’bHDL

Synt

Once

Simudelay

t C Synthesis W

ynthesis he previous stL model so ter synthesizinhavioral simu

in ISE, chanble click ‘Sy

mally, you wwever, someti

to the line wh

reason why hesizable, alortant concepneed to mod

ally, there arbX”, as showL model.

thesize your m

e you have ulation’ in thys (circuit, ro

Work Flow Tu

Your Destep, you havethat you coung the HDL mulation).

nge Source taynthesize-XS

will pass the ‘imes, you wi

hich causes th

you got thislthough they pt in Verilogify the HDL

re around 5~6wn below. De

model, and th

synthesized he ‘Source’ outing, load e

utorial EC

sign in ISe learnt how

uld get the symodel, you c

ab back to ‘IT’ in the pro

Synthesize-Xill get errors a

he error, you

s error is thacould be us

g HDL. Pleascode.

6 these kind ebug all the

hen check th

the model, panel. In poetc) so that it

E Department

SE & Post-to simulate t

ynthesis resucould also do

Implementatiocess window

XST’ step. as below:

u will notice t

at ‘X’ (“Unksed in simulase refer to the

of errors in terrors using

he synthesis r

you can staost-route simt is able to pr

t, Rice Univer

-route Simthe HDL moults for timino post-route s

ion’, then sew.

the following

known”) or ‘ation/verificae Verilog tut

the code. Ththis method

report.

art post-routmulation, your

rovide more a

rsity

mulationodel. In this sng and hardwsimulation (i

lect ‘sumsqu

g statements:

‘Z’ (“High iation (A syntorial or man

he modificatiod, and you w

te simulationr design is saccurate simu

n tep, you willware resourcn the previou

uare’ module

mpedance”) nthesizable mnual for detai

on is simple,will now get a

n by selectinsimulated wiulation result

Page

l synthesize tce informatious step you d

e in Source ta

values are nmodel is a veils.). Therefo

, just removea synthesizab

ng ‘Post-Rouith all kinds ts to you.

16

the on. did

ab.

not ery

ore,

e “| ble

ute of

Page 17: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Post

Let u

Betwthat coulwave Simi

t C Synthesis W

-route simula

us look at thi

ween the clocis because thd compare theform closely

ilarly, you co

Work Flow Tu

ation result is

is waveform

ck rising edghe post-routehe post-routey.

ould also run

utorial EC

s shown belo

more closely

ge and the che simulation e simulation

the post-rou

E Department

ow:

y:

hanging poinmodel alrearesult with

ute simulation

t, Rice Univer

nt of out_rsc_ady counts ththe behavior

n in ModelSi

rsity

_z (from 0 tohe latency ofral simulatio

im. The meth

o 5), there isf the actual dn result by z

hod is the sam

Page

s a 4ns latencdata path. Yzooming in t

me as in Step

17

cy, You

the

p 4.

Page 18: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE Department, Rice University Page 18

Step 6: Integrate HDL Model into System Generator In this step, you will integrate the HDL model into System Generator by using the Black-Box block. Then you could verify your design in a System Generator project.

At first, you need to create a skeleton file, which contains the Verilog HDL module with only module definition and interface declaration. This skeleton will tell System Generator Black Box block the basic information of you HDL model, so that System Generator will generate a configuration file for your HDL Black Box automatically. Once you have the configuration file for your Black Box, you need to replace the skeleton file with your synthesizable Verilog HDL file from Step 5.

Create a new folder for the System Generator project. Create a new skeleton file, and name it as ‘rtl.v’ (*Notice: the name should be the same as your RTL model.). Copy your RTL model definition into this file (Please just copy the module definition; in other words, there is only an empty module with interface definition but doing nothing). In our example, the definition of the RTL model is shown as below:

Add an input ‘ce’ (clock enable signal) in the model, your code should look like this:

Clock and clock enable ports in black box HDL must appear as pairs . Each clock name (respectively, clock enable name) must contain the substring clk, for example my_clk_1 and my_ce_1. (Please refer to System Generator User Guide, Chapter 4: Importing HDL Modules.)

Run MATLAB. Create a new System Generator model in the same folder with your empty module definition file. Add a ‘Black Box’ from the Simulink Library Browser. In the pop-up dialog, select the empty module ‘rtl.v’. System Generator will generate a Black Box block for you.

module sumsquare ( a_rsc_z, b_rsc_z, sumsquare_out_rsc_z, clk, ce, rst ); input [15:0] a_rsc_z; input [15:0] b_rsc_z; output [33:0] sumsquare_out_rsc_z; input clk; input ce; input rst; endmodule

module sumsquare ( a_rsc_z, b_rsc_z, sumsquare_out_rsc_z, clk, rst ); input [15:0] a_rsc_z; input [15:0] b_rsc_z; output [33:0] sumsquare_out_rsc_z; input clk; input rst; endmodule

Page 19: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

Now

Copycodemod

Doub

Nowuse t

Crea

t C Synthesis W

w, you are clo

y your synthe in ‘rtl_mgcdule of your d

ble click the

w you have suthis Black Bo

ate a complet

Work Flow Tu

ose to finishe

hesizable HDc_ioport.v’ todesign, since

black box bl

uccessfully mox just as you

te System Ge

utorial EC

ed. There

DL model ‘rtlo the end ofclock enable

lock, select ‘I

made a Blacku use other S

enerator syste

E Department

are only a fe

l.v’ into this f ‘rtl.v’. Reme is expected

ISE simulato

k Box for ourSimulink bloc

em, and simu

t, Rice Univer

w more steps

folder, replamember to ad

by System G

or’ for simula

r Catapult decks.

ulate it:

rsity

s left.

ace the emptydd the ‘ce’ iGenerator.

ation mode.

sign. It is rea

y module filinput port fo

ady for simul

Page

e. Copy all tor the top lev

lation. You c

19

the vel

can

Page 20: Catapult C Synthesis Work Flow Tutorialgw2/pdf/Technical_notes_Catapult_work...Using GC o simulate y. This is ou ... ELEC 522 Catapult C Synthesis Work Flow Tutorial ECE ... the Class

ELECC 522 Catapult

We c

Cong

For tproje

t C Synthesis W

could also ge

gratulations!

the next stepect and simul

Work Flow Tu

et the resourc

By now, you

, you could glate your new

utorial EC

ce estimation

u have finish

go back to Caw model.

E Department

n from System

hed the comp

atapult, try to

t, Rice Univer

m Generator:

plete work flo

o change the

rsity

ow of Catapu

architecture

ult.

constraints f

Page

for the Catap

20

ult


Recommended