# Esim startup file. This defines procedures that might be useful to those # running esim. The useful procedures are: # # sigtrace # Prints out a message like "400 : clk = X" whenever clk changes. # showbin # showhex # Add a display for to the graphic window. This command # is only available if you start esim with the -tk option (in other # words, 'esim -tk' # # The rest of the procedures are support procedures for those listed here. # If you want to add default commands, please keep in mind that you can't # use a routine until *after* it has been defined - in other words, add # your own commands at the *end* of this file. Another option would be # to copy this file to someplace else (say, esim.tcl) and include the # following line at the top of your .esimrc (obviously, leave out the #; # everything following one is a comment): # source [glob "~user/cmsc411/esim.tcl"] # where you substitute the actual location of the esim.tcl file for what # is between quotes above. # # $Id$ proc sigtrace {sig} { global Esim trace variable Esim($sig) w printvar esim trace $sig } proc printvar {nm sig op} { global Esim set t [esim curtime] puts "$t : $sig = $Esim($sig)" } proc showbin {sig} { showsig -binary $sig } proc showhex {sig} { showsig -hex $sig } proc showsig {radix sig} { global Esim if {! [info exists Esim(_vframe)]} { frame .vf pack .vf label .vf.lcurtime -text "Time:" label .vf.tcurtime -textvariable Esim(_curtime) label .vf.levents -text "Events pending:" label .vf.tevents -textvariable Esim(_pending) grid .vf.levents .vf.tevents -sticky w grid .vf.lcurtime .vf.tcurtime -sticky w set Esim(_vframe) .vf } catch {esim trace $radix $sig} set f $Esim(_vframe) if [info exists Esim($sig)] { regsub -all {\.} $sig {___} tsig label $f.n$tsig -text $sig label $f.v$tsig -textvariable Esim($sig) grid $f.n$tsig $f.v$tsig grid $f.n$tsig -sticky w grid $f.v$tsig -sticky w } else { puts "showsig $sig: $sig not found" } } proc unshow {sig} { global Esim catch { set f $Esim(_vframe) destroy $f.v$sig destroy $f.n$sig } }