Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with breakpoints in Tcl under Modelsim (shorter version)

Status
Not open for further replies.

jcbaraza

Programmer
Oct 27, 2015
2
ES
Hi again,

This is a short version of my previous post, so you can ignore that and just answer to this one.

I intend to make a Tcl macro running under Modelsim which is able to control a HDL model simulation by setting time-based breakpoints (that is, to stop at given simulation times) and condition-based breakpoints (for instance, when a rising edge on a signal occurs). Depending on the type of breakpoint hit, some tasks are performed that affect the model simulation, but this is not the important issue.

Having a look to Tcl manual, `when` sentence seems to be more suitable than `bp` to set the breakpoints that I want to implement. From the manual, `enablebp` should work with both `bp` and `when` breakpoints, but it doesn't at all! Perhaps am I doing something wrong?

In a file named "Breakpoints" I have defined a set of `when`-type "breakpoints":

Code:
[COLOR=#204A87]set when_id_list [list]
set bp_time 320001

when -id 1 "\$now == $bp_time" {
  lappend when_id_list 1
  stop
}

when -id 2 {/.../scrubbing_int'event and /.../scrubbing_int = '0'} {
  lappend when_id_list 2
  stop
}

...

disablebp
enablebp 1[/color]

`When` #1 sets a time-based breakpoint, and `when` #2 and subsequent set condition-based breakpoints. At the beginning, only time-based should be active. However, I've added a `echo [bp]` sentence after `enablebp 1`, and no breakpoints nor whens are enabled. This is my first problem. Am I doing anything wrong?

Later, there is a macro that intends to manage a model simulation performing several actions at different time instants (specified by "bp_time" variable, defined in "Breakpoints") and when breakpoint conditions occur. When this macro receives actions to carry out for a condition-based breakpoint, it enables it (by running `enablebp $when_id`), where "when_id" is a variable containing the id of the when condition to be checked. Like in previous case, nothing happens actually (I've inserted `echo [bp]` again after `enablebp $when_id`, and no breakpoints are active, not even the #1.

When this macro ends, an error appears when it tries to disable all the condition-based breakpoints (whens) activated in the call (by executing `disablebp $when_id`, where "when_id" contains every when id). Obviously, if no breakpoints are enabled, no breakpoints can be disabled.

I've tried to replace when ids with labels (`when -label when1 ...`, ..., `enablebp when1`, `enablebp $when_label`, `disablebp $when_label`), but nothing changes.

I've been unable to find examples of use of breakpoints (and when) in Tcl macros, and the Tcl manual is ambiguous about how bp and when breakpoints are distinguished, given that they can share id numbers (that is to say, it is possible to define `bp ... -id 1 ...`, and a `when ... -id 1 ...`), so I don't understand what is wrong with my code. Any idea?

Best regards,

Juan-Carlos

P.S. Of course, if I should write or upload the full code, don't hesitate to ask.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top