Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problems with breakpoints in Tcl under Modelsim (shorter version)

Problems with breakpoints in Tcl under Modelsim (shorter version)

Problems with breakpoints in Tcl under Modelsim (shorter version)

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 --> Tcl

set when_id_list [list]
set bp_time 320001

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

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


enablebp 1 

`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,


P.S. Of course, if I should write or upload the full code, don't hesitate to ask.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close