S
server
Guest
message unavailable
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi,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