Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

NCSIM equivalent of WHEN command (in Modelsim)

736 views
Skip to first unread message

Srinivasan Venkataramanan

unread,
Aug 30, 2001, 12:14:10 PM8/30/01
to
Hi,
Is there an equivalent command in NCSIM to the "WHEN " simulator
command that is available in Modelsim? To put in other words, how do I
trigger a TCL proc whenever a signal changes? Say for instance if I
want to count number of "read enables" how would I do it in NCSIM. I
tried looking up in cdsdoc but in vain. Any help will be greatly
appreciated.

TIA,
Srini

P.S. Also is there a way to count "number of events" inside
Signalscan??
--
Srinivasan Venkataramanan
ASIC Design Engineer
Software & Silicon Systems India Pvt. Ltd. (An Intel company)
Bangalore, India (http://www.vlsisrini.com)


Tom Loftus

unread,
Aug 30, 2001, 5:07:19 PM8/30/01
to
Srinivasan Venkataramanan wrote:
>
> Hi,
> Is there an equivalent command in NCSIM to the "WHEN " simulator
> command that is available in Modelsim? To put in other words, how do I
> trigger a TCL proc whenever a signal changes? Say for instance if I
> want to count number of "read enables" how would I do it in NCSIM. I
> tried looking up in cdsdoc but in vain. Any help will be greatly
> appreciated.
>

I tend to do this kind of thing in my testbench, not in
my simulator command window, but looking at my documents
it looks like "stop -condition tcl_expression -execute command"
will trigger on the condition of tcl_expression and then
execute the command which could do what you want.

You'll have to work out the exact Tcl syntax, that is not
my strongpoint.

You also might try bringing up the GUI (ncsim -gui) and using
the menus and dialog boxes to setup what you want and then
look at the commands which are generated. I find that
helpful for questions like this.

Tom

Srinivasan Venkataramanan

unread,
Sep 5, 2001, 10:08:44 AM9/5/01
to
Hi,
Thanks for the reply. I too had a similar idea, here is what I
tried:

-- TCL Script -------------------

set count_pkts 0

stop -create -condition {#amIHigh.mii_rxdv === 1'b1} -execute \
{ set count_pkts [expr $count_pkts + 1]; run; }
---

This gives (after running) an error saying RUNBRK, and the help says:

ncsim/RUNBRK =
A script provided as the -EXECUTE option in a stop point was
executing and a run command was encountered. You can not
run the simulation from an -execute script.

(I also tried using "continue" in vain - which is meant for loops as I
understood). Does it mean that it is NOT possible to do this in NCSIM?
That would be a major limitation (:-


Regards,
Srini

--
Srinivasan Venkataramanan
ASIC Design Engineer
Software & Silicon Systems India Pvt. Ltd. (An Intel company)
Bangalore, India (http://www.vlsisrini.com)


"Tom Loftus" <tlo...@intrinsix.com> wrote in message
news:3B8EAB07...@intrinsix.com...
> Srinivasan Venkataramanan wrote:
> >
<SNIP>>

Steven Sharp

unread,
Sep 5, 2001, 5:55:06 PM9/5/01
to
Srinivasan Venkataramanan wrote:

> -- TCL Script -------------------
>
> set count_pkts 0
>
> stop -create -condition {#amIHigh.mii_rxdv === 1'b1} -execute \
> { set count_pkts [expr $count_pkts + 1]; run; }
> ---

I tried "help stop" from the command line, and found the option

-continue...............The simulator will not stop running after
the
stop is processed

It appears that you should add the -continue option to the stop
command and eliminate the run command. I tried this and it
worked.

Note that having the simulator stop and interpret TCL code
whenever something happens will be slower than having
your Verilog code do the same computation.

--
Steven Sharp
sh...@cadence.com

Srinivasan Venkataramanan

unread,
Sep 6, 2001, 2:10:43 AM9/6/01
to
"Steven Sharp" <sh...@cadence.com> wrote in message
news:3B969F3A...@cadence.com...

> Srinivasan Venkataramanan wrote:
>
>
> It appears that you should add the -continue option to the stop
> command and eliminate the run command. I tried this and it
> worked.
>

Thanks a lot Steven, I guess I didn't look deep into the options.

> Note that having the simulator stop and interpret TCL code
> whenever something happens will be slower than having
> your Verilog code do the same computation.
>

Understood, but it is kind of an easy way-out that I wanted to use
for the moment. BTW, can the "condition" in the stop command involve
TCL variables? i.e. can I say:

stop -create -condition {$count_pkts == 10}

i..e I want to stop when the count_pkts has reached 10? I tried it NC
doesn't seem to like it.

TIA for more hints.

Srinivasan

> --
> Steven Sharp
> sh...@cadence.com

Steven Sharp

unread,
Sep 6, 2001, 4:20:31 PM9/6/01
to
Srinivasan Venkataramanan wrote:

>
> BTW, can the "condition" in the stop command involve
> TCL variables? i.e. can I say:
>
> stop -create -condition {$count_pkts == 10}
>
> i..e I want to stop when the count_pkts has reached 10? I tried it NC
> doesn't seem to like it.
>

The help for -condition indicates that it evaluates whenever an
object changes value and the expression is true. That means an
HDL object. So the expression can contain TCL variables that
affect whether the expression is true, but changes to those
variables will not trigger evaluation. In other words, a breakpoint
on an HDL object can be conditional on a TCL variable, but you
can't break on a change to a TCL variable. It is a debugger for
the HDL code, not for TCL code. As the extended help for the
error says:

ncsim/STCDNO =
The expression given as the argument to a stop -condition
option contained no references to any object that could
trigger the stop point. The expression must contain at least
one object to trigger the stop point.

You could try to work around it by setting the condition to
-condition {#amIHigh.mii_rxdv === 1'b1 && $count_pkts == 10}
but I don't know whether it would evaluate before or after the
other breakpoint on the same object, so you might have to check
for 9 instead of 10.

The easier way to do this would be to forget about count_pkts
and use the built-in skip count capability on the stop command.

stop -condition {#amIHigh.mii_rxdv === 1'b1} -skip 9

stop -show will even show you how many times it has been
skipped so far.

The -condition, -if and -execute options give you hooks for
arbitrarily complex breakpoints, but the built-in capabilities
look flexible enough that I wouldn't expect those hooks to
be needed often.

--
Steven Sharp
sh...@cadence.com

0 new messages