Assigning VHDL values from the command-line?

M

Mark McDougall

Hi,

I'm wondering if there's any way of passing the value of a constant to a
VHDL file from the command-line/project file under Quartus?

I have a constant in a package body that is hard-coded.
eg. constant myConstant : std_logic_vector(7 downto 0) := X"01";

What I'd _like_ to be able to do is something that is often done in
software...
eg. constant myConstant : std_logic_vector(7 downto 0) := $magic$;
....and then build with...
quartus_sh build.bat magic=2
....or there-abouts.

Is this at all possible?

I've read that you can do similar in Quartus with Verilog macros...

Regards,
 
D

David R Brooks

Mark said:
Hi,

I'm wondering if there's any way of passing the value of a constant to a
VHDL file from the command-line/project file under Quartus?

I have a constant in a package body that is hard-coded.
eg. constant myConstant : std_logic_vector(7 downto 0) := X"01";

What I'd _like_ to be able to do is something that is often done in
software...
eg. constant myConstant : std_logic_vector(7 downto 0) := $magic$;
....and then build with...
quartus_sh build.bat magic=2
....or there-abouts.

Is this at all possible?

I've read that you can do similar in Quartus with Verilog macros...
I don't know Quartus, but Modelsim (pretty much the standard tool) can
do this in VHDL, using generics.
Define "magic" as a generic (with a default value), then override the
default on the command line.
 
A

Andy

Hi,

I'm wondering if there's any way of passing the value of a constant to a
VHDL file from the command-line/project file under Quartus?

I have a constant in a package body that is hard-coded.
eg. constant myConstant : std_logic_vector(7 downto 0) := X"01";

What I'd _like_ to be able to do is something that is often done in
software...
eg. constant myConstant : std_logic_vector(7 downto 0) := $magic$;
...and then build with...
quartus_sh build.bat magic=2
...or there-abouts.

Is this at all possible?

I've read that you can do similar in Quartus with Verilog macros...

Regards,

--
Mark McDougall, Engineer
Virtual Logic Pty Ltd, <http://www.vl.com.au>
21-25 King St, Rockdale, 2216
Ph: +612-9599-3255 Fax: +612-9599-3266

I'm not aware of any tools that will let you override a constant
declaration, but many will allow you to override the default
assignment of a top level generic. In the next version of VHDL,
generics on packages are also allowed, so you could have a top level
generic on a module drive the generic assignment in the package
"instantiation".

I know most simulators, and the synplify synthesis tool allow
overriding generics via command line options.

Andy
 
M

Mark McDougall

Andy said:
I'm not aware of any tools that will let you override a constant
declaration, but many will allow you to override the default
assignment of a top level generic. In the next version of VHDL,
generics on packages are also allowed, so you could have a top level
generic on a module drive the generic assignment in the package
"instantiation".

Technically, I'm not 'overriding' the constant, but sucking it in from the
command-line. Regardless, it would appear I'm SOL atm...

Thanks for your input!
Regards,
 
T

Tricky

It can definately be done with generics. Ive used a TCL script to run
a test bench in all possible configurations before.
 

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,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top