Conditional compilation in VHDL

A

avishay

Hello all,
I'm designing a testbench that should work on a real device (i.e.
synthesizable). When working that way, it receives clock and reset from
and external source. However, when I simulate it (I use Modelsim) I
have to generate clock and reset myself, using unsynthesizable code. My
question is whether there is a way to make a single source file compile
differently in the synthesizer (I use Quartus) and in the simulator.
Thanks for any help

Avishay Orpaz
 
A

ALuPin

avishay said:
Hello all,
I'm designing a testbench that should work on a real device (i.e.
synthesizable). When working that way, it receives clock and reset from
and external source. However, when I simulate it (I use Modelsim) I
have to generate clock and reset myself, using unsynthesizable code. My
question is whether there is a way to make a single source file compile
differently in the synthesizer (I use Quartus) and in the simulator.
Thanks for any help

Avishay Orpaz

Why not use a different testbench u2 (not synthesizable) to test
your design i1 + synthesizable "testbench" u1 ?

i1 and u1 could have one top level file t1 in which i1 and u1 are
instantiated and conncected.

t1 could then be instantiated in u2.

Rgds
André
 
N

Neo

just create a clock and reset generation module and connect it to your
top level for simulation.
 
M

Mike Treseler

avishay said:
question is whether there is a way to make a single source file compile
differently in the synthesizer (I use Quartus) and in the simulator.

Not without using a separate preprocessor step.
Standard practice is to put the sim testbench
in a separate file, say test_mydesign.vhd.
The testbench instances my_design
in the file my_design.vhd


-- Mike Treseler
 
A

Andy Peters

avishay said:
Hello all,
I'm designing a testbench that should work on a real device (i.e.
synthesizable). When working that way, it receives clock and reset from
and external source. However, when I simulate it (I use Modelsim) I
have to generate clock and reset myself, using unsynthesizable code. My
question is whether there is a way to make a single source file compile
differently in the synthesizer (I use Quartus) and in the simulator.
Thanks for any help

Create a top-level testbench generic called SYNTHSIM that's 1 if you're
creating the synthesizable version and 0 if doing functional (ModelSim
testbench) simulation. Put the clock and reset instances/logic in a
generate block that generates that logic if SYNTHSIM = 0.

=-a
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top