Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Conditional compilation in VHDL?

630 views
Skip to first unread message

Ganesan

unread,
Dec 24, 2002, 9:12:57 AM12/24/02
to
Hi,

Does anything exist in VHDL equivalent to verilog conditional
compilation directive ( `ifdef .... `else .... `endif )

Thanks,
Ganesan

Egbert Molenkamp

unread,
Dec 24, 2002, 11:51:10 AM12/24/02
to
Maybe de FAQ can help you
http://www.vhdl.org/vi/comp.lang.vhdl/FAQ1.html#cond_compile

Egbert Molenkamp

"Ganesan" <gane...@yahoo.co.in> schreef in bericht
news:2c529f55.02122...@posting.google.com...

Domagoj

unread,
Dec 29, 2002, 10:04:48 AM12/29/02
to
Hi Ganesan,

In addition, you might want to consider using tcl/perl scripts for more
complex
simulation system configuration. You can also parse vhdl/verilog files and
configure
them using such scripts.

regards,

--
Domagoj Babic
domagoj (et) engineer.com

"Ganesan" <gane...@yahoo.co.in> wrote in message
news:2c529f55.02122...@posting.google.com...

Ralf Hildebrandt

unread,
Dec 29, 2002, 12:02:01 PM12/29/02
to
Hi Ganesan!


> Does anything exist in VHDL equivalent to verilog conditional
> compilation directive ( `ifdef .... `else .... `endif )

Just use constants.

Ralf

Clyde R. Shappee

unread,
Jan 2, 2003, 8:56:13 PM1/2/03
to
This does not work in Synplify.... It required a signal.

So I made a signal for the if statement and a constant for use in the if
statement.

Clyde

Ralf Hildebrandt

unread,
Jan 3, 2003, 3:19:11 AM1/3/03
to
Hi Clyde!

[quote repaired]


>>>Does anything exist in VHDL equivalent to verilog conditional
>>>compilation directive ( `ifdef .... `else .... `endif )
>>Just use constants.

> This does not work in Synplify.... It required a signal.

This a plain VHDL - this should work everywhere.

define a constant:

constant switchA : integer:=1; -- 1 enabled / 0 disabled


Feed this constant through an entitiy to a lower component:

entity compA is
generic(
switchA : integer:=1 );
port( -- and so on...
);
end compA;


Instantiate this component in the top component (where the constat is
defined).

Within compA use the constant:


process(in1,in2)
begin
if (switchA=1) then
out1<=in1 AND in2;
else out1<=in1;
end if;
end process;


As you can see - the constant defines, if and AND-gate is inferred or a
simple wire is taken.


With the uses of constants if have written a several extras for a
microcontroller, that all can be disabled, if one changes the constant.

Hint: If you synthesize just compA to test the synthesized components
within the behavioral top-component, you have to change the default
value of the constant within the entity AND where the constant is
defined in the top-component.


Your synthesis tool will warn you, that an expression is never reached.
(In my examle: the else-statement.)

Ralf

jeevan DJ

unread,
Aug 18, 2022, 10:30:57 AM8/18/22
to
Hi,
Can anyone say how to address schemes and write a byte code?
0 new messages