Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Variables in procedures (packages)

Reply
Thread Tools

Variables in procedures (packages)

 
 
ALuPin@web.de
Guest
Posts: n/a
 
      06-20-2008
Hi newsgroup,

I have variables used in a procedure defined in a package. A process
in a testbench module is calling that
procedure.
When marking the package in Modelsim and opening the "Locals" window I
do not see any variables.

Is there some way to make them visible ?

Rgds,
Andre
 
Reply With Quote
 
 
 
 
Andy
Guest
Posts: n/a
 
      06-20-2008
On Jun 20, 3:21 am, "ALu...@web.de" <ALu...@web.de> wrote:
> Hi newsgroup,
>
> I have variables used in a procedure defined in a package. A process
> in a testbench module is calling that
> procedure.
> When marking the package in Modelsim and opening the "Locals" window I
> do not see any variables.
>
> Is there some way to make them visible ?
>
> Rgds,
> Andre


I'm not sure about this, but I believe that if you go through the
package, then there is no scope to associate with the procedure. You
need to drive down through the procedure call in your code to get into
the procedure body, so that the simulator knows for which instance you
need the local variables.

Andy
 
Reply With Quote
 
 
 
 
Mike Treseler
Guest
Posts: n/a
 
      06-20-2008

> On Jun 20, 3:21 am, "ALu...@web.de" <ALu...@web.de> wrote:


>> I have variables used in a procedure defined in a package. A process
>> in a testbench module is calling that
>> procedure.


Andy wrote:
> I'm not sure about this, but I believe that if you go through the
> package, then there is no scope to associate with the procedure. You
> need to drive down through the procedure call in your code to get into
> the procedure body, so that the simulator knows for which instance you
> need the local variables.


Yes. There are two parts to the solution.
One is an "add wave" command for each calling process.
Two is to trace code through the procedure
because that is the only time variable
local to the procedure are visible.

Note that procedures *declared* in process scope
have direct access to process variables, which
are always visible.

-- Mike Treseler
 
Reply With Quote
 
ALuPin@web.de
Guest
Posts: n/a
 
      06-23-2008
Hi,

thank you for your comments.
I think it can indeed be an advantage to use procedures declared in
the process calling them so that the variables are permanently
visible.
When declaring the procedures in a separate package the only way to
make the variables visible
is to set a breakpoint on the code line where the procedure is called
and then to step through
the code.

Rgds
Andre
 
Reply With Quote
 
rickman
Guest
Posts: n/a
 
      06-26-2008
On Jun 23, 5:53 am, "ALu...@web.de" <ALu...@web.de> wrote:
> Hi,
>
> thank you for your comments.
> I think it can indeed be an advantage to use procedures declared in
> the process calling them so that the variables are permanently
> visible.
> When declaring the procedures in a separate package the only way to
> make the variables visible
> is to set a breakpoint on the code line where the procedure is called
> and then to step through
> the code.
>
> Rgds
> Andre


This may be heresy, but another option is to make the procedures small
enough that you can debug them by eye. If you need a large procedure,
keep breaking it down into smaller procedures and functions until they
are small. I try to keep mine under 10 lines total if practical.
That is the Forth philosophy and it can work if you actually follow
it.

The trouble is that simulators are a PITA to use. They are slow,
require a lot of setup to generate the correct stimulus and can be
difficult to interpret when you are looking for the source of a bug.
It can be much better to code in ways that reduce the likelihood of
creating bugs. The last few passes on my recent design I chose to go
straight to the chip where I could use a scope on the real circuit
rather than try to drill down through the simulator. It worked pretty
well for the slow logic that takes a long time to run in the
simulator.

Rick
 
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
Put variables into member variables or function variables? tjumail@gmail.com C++ 9 03-23-2008 04:03 PM
Procedures don't have access to public Variables in ASP Bobby Howell ASP General 2 09-17-2005 07:01 PM
Viewing variables within process scoped procedures (Modelsim) Mark VHDL 4 11-09-2004 11:13 PM
Procedures, variables and their scope. Michel Bieleveld VHDL 5 10-29-2004 02:18 PM
VB.NET Retrieving Identity form MSSQL2000 without using stored procedures Taras ASP .Net 2 10-05-2003 05: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