![]() |
|
|
|||||||
![]() |
VHDL - How to specify default value to a variable of unconstrained type INSIDE a VHDL procedure ? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Anyone know how to specify default value to a variable of
unconstrained type INSIDE a VHDL procedure ? For example, type t_HEADER_LENGTH_array is array (natural range<>) of integer ; -- unbounded array of integers procedure provision_EHI_RAM( variable headerLength : t_HEADER_LENGTH_array (0 to ci_NUMBERofHEADERS-1) := (14,2); ....) compiles with error: ** Error: .\rtl\gbe_wan_tb_defn_pkg.vhd(2361): Parameter default values do not conform between declarations in package header an d body: 'headerlength'. Thanks in advance ! Pankaj Pankaj |
|
|
|
|
#2 |
|
Posts: n/a
|
On 20 Aug 2004 08:41:07 -0700, (Pankaj) wrote:
>Anyone know how to specify default value to a variable of >unconstrained type >INSIDE a VHDL procedure ? >For example, > >type t_HEADER_LENGTH_array is array (natural range<>) of integer ; > -- unbounded array of integers > >procedure provision_EHI_RAM( > variable headerLength : t_HEADER_LENGTH_array (0 to >ci_NUMBERofHEADERS-1) := (14,2); >...) > >compiles with error: >** Error: .\rtl\gbe_wan_tb_defn_pkg.vhd(2361): Parameter default >values do not conform between declarations in package header an >d body: 'headerlength'. That's not a local variable of the procedure; it's an input parameter of class variable. Input parameters of variable class are, as far as I know, legal but useless. You can't change their values, because they are of mode "in", so you might as well make the parameter be of constant class, so that you can supply an expression rather than a variable as the actual parameter. If you take off the keyword "variable", and make sure that the aparameter list is *exactly* the same in both the package and package body, then it should be OK. If you want a local variable of the procedure, visible only within the procedure, that's easier: don't declare it in the parameter list, but instead declare it in the procedure body's declarative region: (package) procedure provision_EHI_RAM (...); (package body) procedure provision_EHI_RAM (...) is variable headerLength: t_HEADER_LENGTH_array....... begin ... end; Finally, I spy trouble ahead... > variable headerLength : > t_HEADER_LENGTH_array (0 to ci_NUMBERofHEADERS-1) > := (14,2); The variable initialisation will work correctly only if ci_NUMBERofHEADERS) is exactly 2. Can you be sure of this? -- Jonathan Bromley, Consultant DOULOS - Developing Design Know-how VHDL, Verilog, SystemC, Perl, Tcl/Tk, Verification, Project Services Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, BH24 1AW, UK Tel: +44 (0)1425 471223 mail: Fax: +44 (0)1425 471573 Web: http://www.doulos.com The contents of this message may contain personal views which are not the views of Doulos Ltd., unless specifically stated. Jonathan Bromley |
|
|
|
#3 |
|
Posts: n/a
|
Hi Pankaj,
You have to fix the NUMBERofHEADER here as 2 in a package entity. only then u will be able to compile the same. Anupam Garg anupam |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Eclipse - Axis2 - Java Webservices Error | amanjsingh | Software | 1 | 10-09-2007 09:03 AM |
| Need help on Modelsim VHDL syntax? ASAP:) | kaji | General Help Related Topics | 0 | 03-14-2007 10:43 PM |
| Need help on a Modelsim VHDL Syntax? ASAP:) | kaji | Software | 0 | 03-14-2007 10:43 PM |
| Need Help on a Modelsim VHDL Syntax....ASAP:) | kaji | Hardware | 0 | 03-14-2007 10:41 PM |
| Spoke to Spoke Enhanced Config (ASA-PIX) NEED HELP ASAP!! | T-Mak | Hardware | 1 | 10-27-2006 11:56 AM |