I am debugging a VHDL block which has a "for loop" inside a
procedure. Within each iteration of the for loop, a variable is
conditionally assigned. For troubleshooting the design, I am
interested in viewing the value of the variable at specific locations
of the process. Since the variable is re-assigned subsequently within
the process, the variable has changed state multiple times in zero
time. I realize this rules out any viewing in a wave window.
process(clk,reset)
variable a;
variable b;
begin
if rising_edge(clk) then
for i in 0 to 7 loop
if condition1 then
a := x(i);
end if;
b := a;
if condition2 then
a := x(i+1);
end if;
end for;
end if
end process;
Here is a simple example. Please do not recommend a different coding
style, as this is merely an attempt to illustrate the problem. Let's
say I want to lok at the value of a (or i, for that matter) at the end
of the first if statement. I do not want to see it after the process
completes. I would be happy if I could insert a line of code similar
to the report command, that could display the value of a variable at
the time of execution.
Any suggestions?
Brett
|
|
0
|
|
|
|
Reply
|
brett.chaveriat (1)
|
2/18/2010 9:50:15 PM |
|
On Thu, 18 Feb 2010 13:50:15 -0800 (PST)
rwdfan <brett.chaveriat@gmail.com> wrote:
> I am debugging a VHDL block which has a "for loop" inside a
> procedure. Within each iteration of the for loop, a variable is
> conditionally assigned. For troubleshooting the design, I am
> interested in viewing the value of the variable at specific locations
> of the process. Since the variable is re-assigned subsequently within
> the process, the variable has changed state multiple times in zero
> time. I realize this rules out any viewing in a wave window.
>
> process(clk,reset)
> variable a;
> variable b;
> begin
> if rising_edge(clk) then
> for i in 0 to 7 loop
> if condition1 then
> a := x(i);
> end if;
> b := a;
> if condition2 then
> a := x(i+1);
> end if;
> end for;
> end if
> end process;
>
> Here is a simple example. Please do not recommend a different coding
> style, as this is merely an attempt to illustrate the problem. Let's
> say I want to lok at the value of a (or i, for that matter) at the end
> of the first if statement. I do not want to see it after the process
> completes. I would be happy if I could insert a line of code similar
> to the report command, that could display the value of a variable at
> the time of execution.
>
> Any suggestions?
> Brett
>
Set a breakpoint and single step it.
--
Rob Gaddi, Highland Technology
Email address is currently out of order
|
|
0
|
|
|
|
Reply
|
Rob
|
2/18/2010 10:23:02 PM
|
|
rwdfan wrote:
> I am debugging a VHDL block which has a "for loop" inside a
> procedure. Within each iteration of the for loop, a variable is
> conditionally assigned. For troubleshooting the design, I am
> interested in viewing the value of the variable at specific locations
> of the process. Since the variable is re-assigned subsequently within
> the process, the variable has changed state multiple times in zero
> time. I realize this rules out any viewing in a wave window.
Not true.
If I name the process, I can add it by name with an "add wave" command.
However, only the final value is shown on the wave.
> I would be happy if I could insert a line of code similar
> to the report command, that could display the value of a variable at
> the time of execution.
You can do exactly that in simulation.
> Any suggestions?
With modelsim, I just say STEP at the command line,
and watch the variables as the code comes into scope.
-- Mike Treseler
|
|
0
|
|
|
|
Reply
|
Mike
|
2/18/2010 10:46:29 PM
|
|
On 18 Feb., 22:50, rwdfan <brett.chaver...@gmail.com> wrote:
> I am debugging a VHDL block which has a "for loop" inside a
> procedure. =A0Within each iteration of the for loop, a variable is
> conditionally assigned. =A0For troubleshooting the design, I am
> interested in viewing the value of the variable at specific locations
> of the process. =A0Since the variable is re-assigned subsequently within
> the process, the variable has changed state multiple times in zero
> time. =A0I realize this rules out any viewing in a wave window.
>
> process(clk,reset)
> variable a;
> variable b;
> begin
> =A0 =A0 if rising_edge(clk) then
> =A0 =A0 =A0 =A0 for i in 0 to 7 loop
> =A0 =A0 =A0 =A0 =A0 =A0 if condition1 =A0then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 a =A0:=3D =A0x(i);
> =A0 =A0 =A0 =A0 =A0 =A0 end if;
> =A0 =A0 =A0 =A0 =A0 =A0 b =A0:=3D =A0a;
> =A0 =A0 =A0 =A0 =A0 =A0 if condition2 =A0then
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 a =A0:=3D =A0x(i+1);
> =A0 =A0 =A0 =A0 =A0 =A0 end if;
> =A0 =A0 =A0 =A0 end for;
> =A0 =A0 end if
> end process;
>
> Here is a simple example. =A0Please do not recommend a different coding
> style, as this is merely an attempt to illustrate the problem. =A0Let's
> say I want to lok at the value of a (or i, for that matter) at the end
> of the first if statement. =A0I do not want to see it after the process
> completes. =A0I would be happy if I could insert a line of code similar
> to the report command, that could display the value of a variable at
> the time of execution.
>
> Any suggestions?
> Brett
Hi,
with Modelsim you also have the option to use the LIST view.
This can be expanded to show each delta cycle, and the changes of a
value in a loop should cause delta cycles.
So you should be able to see the behavior of your variable there.
Have a nice simulation
Eilert
|
|
0
|
|
|
|
Reply
|
backhus
|
2/19/2010 7:45:34 AM
|
|
backhus wrote:
> On 18 Feb., 22:50, rwdfan <brett.chaver...@gmail.com> wrote:
>> I am debugging a VHDL block which has a "for loop" inside a
>> procedure. Within each iteration of the for loop, a variable is
>> conditionally assigned. For troubleshooting the design, I am
>> interested in viewing the value of the variable at specific locations
>> of the process. Since the variable is re-assigned subsequently within
>> the process, the variable has changed state multiple times in zero
>> time. I realize this rules out any viewing in a wave window.
>>
>> process(clk,reset)
>> variable a;
>> variable b;
>> begin
>> if rising_edge(clk) then
>> for i in 0 to 7 loop
>> if condition1 then
>> a := x(i);
>> end if;
>> b := a;
>> if condition2 then
>> a := x(i+1);
>> end if;
>> end for;
>> end if
>> end process;
>>
>> Here is a simple example. Please do not recommend a different coding
>> style, as this is merely an attempt to illustrate the problem. Let's
>> say I want to lok at the value of a (or i, for that matter) at the end
>> of the first if statement. I do not want to see it after the process
>> completes. I would be happy if I could insert a line of code similar
>> to the report command, that could display the value of a variable at
>> the time of execution.
>>
>> Any suggestions?
>> Brett
>
> Hi,
> with Modelsim you also have the option to use the LIST view.
> This can be expanded to show each delta cycle, and the changes of a
> value in a loop should cause delta cycles.
> So you should be able to see the behavior of your variable there.
>
> Have a nice simulation
> Eilert
As others say, setting breakpoints is very convenient.
If your variable is of a scalar type (for instance INTEGER), you can do
report INTEGER'IMAGE(a);
If it's a more complex type, you can write to standard output, e.g.
write(L, s);
writeline(OUTPUT, L);
regards
Alan
P.S. VHDL 2008 adds implicit to_string functions for one dimensional
arrays of character literals, but for earlier versions you could use
ieee.std_logic_textio to write out standard logic vectors.
--
Alan Fitch
Senior Consultant
Doulos � Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * Perl * Tcl/Tk * Project
Services
Doulos Ltd. Church Hatch, 22 Marketing Place, Ringwood, Hampshire, BH24
1AW, UK
Tel: + 44 (0)1425 471223 Email: alan.fitch@doulos.com
Fax: +44 (0)1425 471573 http://www.doulos.com
------------------------------------------------------------------------
This message may contain personal views which are not the views of
Doulos, unless specifically stated.
|
|
0
|
|
|
|
Reply
|
Alan
|
2/19/2010 10:31:23 AM
|
|
On Thu, 18 Feb 2010 23:45:34 -0800 (PST), backhus wrote:
>with Modelsim you also have the option to use the LIST view.
>This can be expanded to show each delta cycle, and the changes of a
>value in a loop should cause delta cycles.
Really? If that's true, then VHDL is far too much like
Verilog for my taste :-)
--
Jonathan Bromley
|
|
0
|
|
|
|
Reply
|
Jonathan
|
2/19/2010 10:43:13 AM
|
|
"backhus" <goouse99@googlemail.com> wrote in message
news:25cd1a09-6b67-40ac-99fa-31e793c23470@q16g2000yqq.googlegroups.com...
On 18 Feb., 22:50, rwdfan <brett.chaver...@gmail.com> wrote:
<snip>
>
>Hi,
>with Modelsim you also have the option to use the LIST view.
>This can be expanded to show each delta cycle, and the changes of a
>value in a loop should cause delta cycles.
Just a side note, the waveform window is much easier for looking at Delta
cycles, this is supported in 6.5x and later.
Hans
www.ht-lab.com
>So you should be able to see the behavior of your variable there.
>
>Have a nice simulation
> Eilert
|
|
0
|
|
|
|
Reply
|
HT
|
2/19/2010 3:59:14 PM
|
|
>I am debugging a VHDL block which has a "for loop" inside a
> procedure. Within each iteration of the for loop, a variable is
> conditionally assigned. For troubleshooting the design, I am
> interested in viewing the value of the variable at specific locations
> of the process. Since the variable is re-assigned subsequently within
> the process, the variable has changed state multiple times in zero
> time. I realize this rules out any viewing in a wave window.
I assume this is a ModelSim issue.
Just set up a signal to mirror all variables.
Use two or more signals to take care of your
zero time issue. Perhaps put a flag signal
in each of your if statements. You should be
able to see anything reasonable.
Brad Smallridge
AiVision
|
|
0
|
|
|
|
Reply
|
Brad
|
2/22/2010 2:17:46 AM
|
|
On Feb 19, 1:45=A0am, backhus <goous...@googlemail.com> wrote:
>
> This can be expanded to show each delta cycle, and the changes of a
> value in a loop should cause delta cycles.
> So you should be able to see the behavior of your variable there.
Jonathan eluded to this, but here's another hint:
Delta cycles occur at suspensions of processes. Thus the iterations of
a loop in a process (so long as the loop does not contain a wait
statement) do not generate delta cycles.
I suppose you could insert "wait for 0 ns;" inside the loop, and it
would generate delta cycles for each loop iteration.
Like Mike and others, I use breakpoints, single-stepping, etc., or I
use a report/assert statement.
Andy
|
|
0
|
|
|
|
Reply
|
Andy
|
2/22/2010 2:49:34 PM
|
|
|
8 Replies
558 Views
(page loaded in 0.13 seconds)
|