Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Generate state with non-static range?

Reply
Thread Tools

Generate state with non-static range?

 
 
Alex
Guest
Posts: n/a
 
      04-16-2006
Gentlemen,

I was wondering if it is possible to overcome the problem with
"generate" statement, which implies static range?

The problem occurs when it is necessary to generate an array of the size
which
is defined in some other data file. In other words the range for generate
statement
is not static. It is possible to pass these parameters as generic,
but then the problem is transferred to the upper level of hierarchy,
because component indentation
is a concurrent statement and reading parameters from the file is a
sequential process.

Perhaps someone can suggest the way to cope with this issue (apart from
generating vhdl code by some script

Thank you.

--
Alex
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      04-16-2006
Alex wrote:

> It is possible to pass these parameters as generic,
> but then the problem is transferred to the upper level of
> hierarchy, because component indentation
> is a concurrent statement and reading parameters from the file is a
> sequential process.


Generics can also be passed on the
command line from a script.

-- Mike Treseler
 
Reply With Quote
 
 
 
 
Alex
Guest
Posts: n/a
 
      04-16-2006
Mike,

Hm. But is it possible to do it only by using VHDL constructs?

It seems to be pretty useful when, for example, one need to generate ROM
depending on the size of some external data, and the left of the BRAM
block
reserve as RAM.

So far I see the only alternative solution is to run simulation from Tcl
script
via vsim -gname=val (I guess that what you have mentioned).


On Sun, 16 Apr 2006 22:24:11 +0100, Mike Treseler
<> wrote:

> Alex wrote:
>
>> It is possible to pass these parameters as generic,
>> but then the problem is transferred to the upper level of
>> hierarchy, because component indentation
>> is a concurrent statement and reading parameters from the file is
>> a sequential process.

>
> Generics can also be passed on the
> command line from a script.
>
> -- Mike Treseler




--
Alex
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      04-17-2006
Alex wrote:
> Mike,
>
> Hm. But is it possible to do it only by using VHDL constructs?


Sure.
Just package the constants as
a vhdl array or record instead of a file.

-- Mike Treseler
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      04-17-2006
I saw this once in a simulation model for a pal that read in the jedec
file and used generate statements to create the and-tree from the
fusemap.

Initialize a constant with a function call, and then within that
function, use text-io to read/process the data file and compute the
value for the constant.

Then use the constant in a generate statement.

Note that the file gets read during the elaboration phase, not the
simulation phase. However, since most synthesis tools don't separate
the phases, they still cannot support text-io, even in "elaboration".
Too bad... could be a market differentiator here... Anyone at
synplicity listening?...

For synthesis, you're stuck with having a separate app/script process
the file to create the value for the generic, which you then pass in as
a command-line parameter to the simulation/synthesis tool.

Hope this helps,

Andy

 
Reply With Quote
 
Alex
Guest
Posts: n/a
 
      04-17-2006
Yes, but this will work in case when those constants are known a priori.
What can be done when the data in stored somewhere else and need to be
read only
when the design is compiled(& simulated)?
Essentially the question can be rephrased as is it possible to perform
some modification to
a shared variable before instantiating a component?


> Alex wrote:
>> Mike,
>> Hm. But is it possible to do it only by using VHDL constructs?

>
> Sure.
> Just package the constants as
> a vhdl array or record instead of a file.
>
> -- Mike Treseler




--
Alex
 
Reply With Quote
 
Alex
Guest
Posts: n/a
 
      04-17-2006
Andy,

Haven't seen your post before answering to Mike.

So how can I do this "elaboration" stage, i.e. where can I call a
function prior
the indentation?

> I saw this once in a simulation model for a pal that read in the jedec
> file and used generate statements to create the and-tree from the
> fusemap.
>
> Initialize a constant with a function call, and then within that
> function, use text-io to read/process the data file and compute the
> value for the constant.
>
> Then use the constant in a generate statement.
>
> Note that the file gets read during the elaboration phase, not the
> simulation phase. However, since most synthesis tools don't separate
> the phases, they still cannot support text-io, even in "elaboration".
> Too bad... could be a market differentiator here... Anyone at
> synplicity listening?...
>
> For synthesis, you're stuck with having a separate app/script process
> the file to create the value for the generic, which you then pass in as
> a command-line parameter to the simulation/synthesis tool.
>
> Hope this helps,
>
> Andy
>




--
Alex
 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      04-17-2006
Alex wrote:
> Yes, but this will work in case when those constants are known a priori.
> What can be done when the data in stored somewhere else and need to be
> read only when the design is compiled(& simulated)?


One way or another that file has to be converted
into vhdl objects on the fly.
Andy's textio function call idea is a clever way
to do this directly for simulation.

For synthesis I know of no way to handle a
text file directly.
If the process generating the file is automated,
you could have it build a vhdl package file or
command line generic as the data is generated.
I would prefer to write a separate program or script to do
the conversion, and add this dependency to my Makefile.
If you can tolerate vhdl textio, a simulation testbench could
also do the text file conversion before synthesis.

-- Mike Treseler
 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      04-21-2006
Alex,

The vhdl standard calls for two levels of processing the code before
executing it, a la ada.

Analysis stage is essentially compilation.
Elaboration stage handles any deferred constant definitions, generics,
generate statements, configurations (component/entity/archietecture
bindings), etc. This would be similar to linking the code in SW.

Execution is running the simulation.

Some simulators transparently merge elaboration and execution, others
don't (Cadence NCvhdl for one).

Synthesis never executes anything, and most (all?) combine analysis and
elaboration into one step. All synthesis tools understand some parts
of your code are executed, and only the results are synthesized, such
as logic and/or arithmetic on static operands, loop indices (unrolled),
etc. Unfortunately, none go so far as to allow something as inherently
unsynthesizable as text-io, even in static situations (i.e. the
resulting hardware would not read the file, instead the file is read
during synthesis, and the results are used to synthesize the hardware).

Example:

architecture sim of my_entity is
function init() return integer is
-- do text-io here
end function;

constant gen_val : integer := init(); -- call init while initializing
constant (in elab)

begin

for i in 0 to gen_val - 1 generate
....
end generate;
end architecture;

Note that the init function could return a record or array, if one file
is used to initialize multiple constants. You'd have to declare a
constant of the array or record type, initialize it with the function
call, then declare/initialize other constants with elements of the
constant array/record.

Hope this helps,

Andy


Alex wrote:
> Andy,
>
> Haven't seen your post before answering to Mike.
>
> So how can I do this "elaboration" stage, i.e. where can I call a
> function prior
> the indentation?
>
>
> --
> Alex


 
Reply With Quote
 
Mike Treseler
Guest
Posts: n/a
 
      04-21-2006
Andy wrote:

> The vhdl standard calls for two levels of processing the code before
> executing it, a la ada.


.... lucid lecture liquidated

> Some simulators transparently merge elaboration and execution, others
> don't (Cadence NCvhdl for one).


For modelsim,
vcom -c my_entity.vhd
"analyzes" the design and flags syntax errors.

vsim -c my_entity
"elaborates" the design and finds structural errors.

vsim test_my_entity -do "run -all"
elaborates the testbench using the pre-analyzed design
brings up the GUI and executes processes until all are waiting.

> Synthesis never executes anything, and most (all?) combine analysis and
> elaboration into one step.


Leonardo has separate elaborate and analyze
commands, but they require a level-3 license.
But as all the others, it punts file declarations.

-- Mike Treseler


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to generate a user instance of SQL Server. Only an integratedconnection can generate a user instance. Harlan Messinger ASP .Net 2 03-28-2010 06:51 PM
Old program to generate skeleton of Finite State Machines Aardalath C Programming 4 01-27-2009 04:15 PM
How to generate warnings when How generate a warning when int is converted to bool or vice versa? PengYu.UT@gmail.com C++ 3 04-06-2006 11:24 PM
How to generate variable labels for same component within a generate loop Weng Tianxiang VHDL 5 02-16-2006 01:45 PM
ANN: Draw finite state machines to generate C++ code Henrik Vallgren C++ 0 06-15-2004 09:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57