UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
253 Views
Registered: ‎06-28-2016

initial value for constant declaration is not constant

Jump to solution

Hi,

I've been trying to run xsim with vunit's library. One of the library files (logger_pkg-body.vhd) uses the following constant declaration:

constant p_default_logger : logger_t := get_logger("default");

where get_logger is an impure function defined in the same file. I get an error for this line saying that:

ERROR: [VRFC 10-932] initial value for constant declaration is not constant [/home/haggai/workspace/vunit/vunit/vhdl/logging/src/logger_pkg-body.vhd:1040]

I'm not sure whether that's legal VHDL in general, but I found this reference, which also used this pattern.

Is there maybe a command line argument that would cause xsim to accept this declaration?

0 Kudos
1 Solution

Accepted Solutions
Scholar richardhead
Scholar
154 Views
Registered: ‎08-01-2012

Re: initial value for constant declaration is not constant

Jump to solution

@drjohnsmith 

impure functions are pretty common. They are required when you access an object declared external to the function. So if you want to write to the console using a function, you will need to declare it impure as OUTPUT is a file declared in the std.textio package. If you ever learn protected types, most of your functions inside them will be impure as you will be accessing variables local to the protected type.

They are used more in simulation, not so much (if at all) in synthesis (but I have seen it required).

VUNIT is a CI package. It is a library of functions that allow reporting with the controller and test definitions written in Python.

@haggaie 

XSIM has choked on vunit because xsim is pretty rubbish. It is a false error - there is nothing wrong with that constant declaration. It is xsim at fault.

I suggest using a simulator that has been updated in the last 10 years. Maybe the open source GHDL, or perhaps the free version of modelsim you can get from intel.

View solution in original post

Tags (1)
5 Replies
Scholar drjohnsmith
Scholar
244 Views
Registered: ‎07-09-2009

Re: initial value for constant declaration is not constant

Jump to solution
I can safely say I have never used impure in VHDL,
( I normaly try to keep things simple, to help the tools )

but do you need to map the constant as impure as well ?

<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Adventurer
Adventurer
184 Views
Registered: ‎06-28-2016

Re: initial value for constant declaration is not constant

Jump to solution

You mean I should declare the constant as impure? I don't think that's supported in VHDL. Only functions can be declared pure/impure.

0 Kudos
Scholar drjohnsmith
Scholar
168 Views
Registered: ‎07-09-2009

Re: initial value for constant declaration is not constant

Jump to solution
I did say I dont use impure,
never found a reason or it,
its use seems very much against the VHDL ethos,

hence the suggestion,

I'd love to know in more detail what are you trying to do that needs you to use an impure ?
<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos
Scholar richardhead
Scholar
155 Views
Registered: ‎08-01-2012

Re: initial value for constant declaration is not constant

Jump to solution

@drjohnsmith 

impure functions are pretty common. They are required when you access an object declared external to the function. So if you want to write to the console using a function, you will need to declare it impure as OUTPUT is a file declared in the std.textio package. If you ever learn protected types, most of your functions inside them will be impure as you will be accessing variables local to the protected type.

They are used more in simulation, not so much (if at all) in synthesis (but I have seen it required).

VUNIT is a CI package. It is a library of functions that allow reporting with the controller and test definitions written in Python.

@haggaie 

XSIM has choked on vunit because xsim is pretty rubbish. It is a false error - there is nothing wrong with that constant declaration. It is xsim at fault.

I suggest using a simulator that has been updated in the last 10 years. Maybe the open source GHDL, or perhaps the free version of modelsim you can get from intel.

View solution in original post

Tags (1)
Adventurer
Adventurer
126 Views
Registered: ‎06-28-2016

Re: initial value for constant declaration is not constant

Jump to solution

Thanks, Richard.

I want to try other simulators eventually, but I have some existing code that is already  wanted working in xsim, which I wanted try using vunit's harness.

0 Kudos