Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Viewing variables within process scoped procedures (Modelsim)

Reply
Thread Tools

Viewing variables within process scoped procedures (Modelsim)

 
 
Mark
Guest
Posts: n/a
 
      11-08-2004
I am trying to debug a design that uses procedures and impure
functions defined with the scope of a process. The problem I have is
in viewing these in a sensible manner.

The only way I have found is to set a breakpoint within the procedure,
at this point, the variables become visible inside the 'variables'
window, where they can then be logged.

If I try to save this view as a '.do' file and subsequently load it
into modelsim on another run, the scope has been lost and I'm required
to set up a breakpoint again etc. etc.

Is there a way around this where the deeper variables (procedure and
function scope) can be logged in a decent manner?

Thanks for any help you can give with this.

Mark
 
Reply With Quote
 
 
 
 
mike_treseler
Guest
Posts: n/a
 
      11-08-2004
The key is to put labels on all processes.
Otherwise modelsim tracks processes by line number.
Here's an example .tcl (.do) file

add wave /test_this/*
;# top level testbench signals
add wave /test_this/uut_1/*
;# top level entity signals
add wave /test_this/uut_1/get_data/*
;# variables in the process get_data
add wave /test_this/uut_1/put_data/*
;# variables in the process put_data

Note that these waves are the "end of process" values.
To see a loop variable changes during a process,
you have to trace code.

Good luck.
-- Mike Treseler

 
Reply With Quote
 
 
 
 
Mark
Guest
Posts: n/a
 
      11-09-2004
Hi Mike,

Thanks for your reply.

I am already able to view the variables in the base scope of the
process (all processes are already named), the problem is viewing the
variables in the scope of each of the procedures.

For (a very contrived) example:

signal reduced : std_logic;
signal lala : std_logic_vector(3 downto 0);
signal foo : std_logic;

DemoProcess : process (lala, foo)
--
procedure OrReduce (
) is
variable Temp : std_logic;
begin
for i in 0 to 3 loop
Temp := Temp or lala(I);
end loop;
reduced <= Temp;
end procedure OrReduce;
--
variable topScopeVar : std_logic;
begin
topScopeVar := '0';
if foo = '1' then
topScopeVar := '1';
end if;
OrReduce;
end process DemoProcess;

Tha variable 'topScopeVar' is visible in the variables window (@
/test_this/uut_1/DemoProcess/* as would be expected), but the variable
'Temp' and procedure 'OrReduce' aren't. That is, until a breakpoint is
set within the procedure 'OrReduce'.

Now, as they are viewable once I have set and fired a breakpoint, it
stands to reason that they should be traceable before this point.

Hope that expands a bit more on what I meant.

Thanks,

Mark

"mike_treseler" <tres@fl_ke.com> wrote in message news:< alkaboutprogramming.com>...
> The key is to put labels on all processes.
> Otherwise modelsim tracks processes by line number.
> Here's an example .tcl (.do) file
>
> add wave /test_this/*
> ;# top level testbench signals
> add wave /test_this/uut_1/*
> ;# top level entity signals
> add wave /test_this/uut_1/get_data/*
> ;# variables in the process get_data
> add wave /test_this/uut_1/put_data/*
> ;# variables in the process put_data
>
> Note that these waves are the "end of process" values.
> To see a loop variable changes during a process,
> you have to trace code.
>
> Good luck.
> -- Mike Treseler

 
Reply With Quote
 
Allan Herriman
Guest
Posts: n/a
 
      11-09-2004
On 9 Nov 2004 01:43:32 -0800, (Mark) wrote:

>Hi Mike,
>
>Thanks for your reply.
>
>I am already able to view the variables in the base scope of the
>process (all processes are already named), the problem is viewing the
>variables in the scope of each of the procedures.
>
>For (a very contrived) example:


[snippage]

>Now, as they are viewable once I have set and fired a breakpoint, it
>stands to reason that they should be traceable before this point.


This thread might help:
http://groups.google.com/groups?thre...news.dfncis.de

Regards,
Allan
 
Reply With Quote
 
mike_treseler
Guest
Posts: n/a
 
      11-09-2004
OK Mark, I see what you're saying.

Procedure variables are not stable objects
like signals or process variables.
They get popped off the stack each time
the procedure exits. You can't set up
an ADD WAVE in advance because the target object
does not exist until the first call to
the procedure. In the case of packaged
procedures there can be more than one
calling process sharing the same procedure variable.

Maybe you want to pass a process variable
to your procedure. Or just trace code if need be.

-- 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
Initial values of File scoped and Block level variables Madhav C Programming 27 01-16-2006 03:29 AM
Initial values of File scoped and Block level variables Madhav C Programming 4 01-08-2006 01:44 PM
Kernel#load and locally scoped variables John Ruby 1 07-09-2004 08:11 PM
Lexically scoped variables Eric Sunshine Ruby 6 12-26-2003 10:55 AM
block scoped variables Andy Fish Java 3 08-16-2003 02:51 PM



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