Example Creating a Hot Window

2
ModelSim Technotes – www.model.com ModelSim Tcl/Tk Examples You can run this example in any of the following ways: 1. Copy the example and paste it directly into ModelSim (at the ModelSim> or VSIM> prompt). 2. Copy the example and paste it into a file called "modelsim.tcl" in the directory that ModelSim will be invoked from (ModelSim looks for a file of this name in the current directory and in the user’s home directory). 3. Copy the example and paste it into a file with any name and then use the "source" command from the ModelSim prompt to load that Tcl/Tk code. 4. Copy the example and paste it into a file with any name and then set the environment variable MODELSIM_TCL to the name of the file prior to invoking ModelSim. [Note: MODELSIM_TCL can be a ":" separated list of Tcl/Tk files to load]. 5. [Not recommended] You copy and add the example to the file "<ModelSim Install Directory>/tcl/vsim/pref.tcl". This file gets loaded every time ModelSim is invoked. Care should be taken when editing this file because every user who uses ModelSim from that directory will load the Tcl/Tk that you have added. Create a "Hot" Window of Frequently Used Buttons Place the following Tcl/Tk code into your modelsim.tcl file either in the project directory or in your home directory. Alternatively, you can set the environment variable MODELSIM_TCL to the name of the file containing: #Create a new window called "hot" toplevel .hot #Create 2 horizontal frames within the .hot window frame .hot.run frame .hot.zoom pack .hot.run .hot.zoom -side top #Create 3 run buttons in the .hot.run frame button .hot.run.b1 -text "Run 10" -command {run 10} button .hot.run.b2 -text "Run 100" -command {run 100} button .hot.run.b3 -text "Run 1000" -command {run 1000} pack .hot.run.b1 .hot.run.b2 .hot.run.b3 -side left #Create a label and 5 zoom buttons in the .hot.zoom frame label .hot.zoom.l1 -text "Zoom: "

description

eg

Transcript of Example Creating a Hot Window

Page 1: Example Creating a Hot Window

ModelSim Technotes – www.model.com ModelSim Tcl/Tk Examples

You can run this example in any of the following ways:

1. Copy the example and paste it directly into ModelSim (at the ModelSim> or VSIM> prompt).

2. Copy the example and paste it into a file called "modelsim.tcl" in the directory that ModelSim will be invoked from (ModelSim looks for a file of this name in the current directory and in the user’s home directory).

3. Copy the example and paste it into a file with any name and then use the "source" command from the ModelSim prompt to load that Tcl/Tk code.

4. Copy the example and paste it into a file with any name and then set the environment variable MODELSIM_TCL to the name of the file prior to invoking ModelSim. [Note: MODELSIM_TCL can be a ":" separated list of Tcl/Tk files to load].

5. [Not recommended] You copy and add the example to the file "<ModelSim Install Directory>/tcl/vsim/pref.tcl". This file gets loaded every time ModelSim is invoked. Care should be taken when editing this file because every user who uses ModelSim from that directory will load the Tcl/Tk that you have added.

Create a "Hot" Window of Frequently Used Buttons

Place the following Tcl/Tk code into your modelsim.tcl file either in the project directory or in your home directory. Alternatively, you can set the environment variable MODELSIM_TCL to the name of the file containing:

#Create a new window called "hot" toplevel .hot #Create 2 horizontal frames within the .hot window frame .hot.run frame .hot.zoom pack .hot.run .hot.zoom -side top #Create 3 run buttons in the .hot.run frame button .hot.run.b1 -text "Run 10" -command {run 10} button .hot.run.b2 -text "Run 100" -command {run 100} button .hot.run.b3 -text "Run 1000" -command {run 1000} pack .hot.run.b1 .hot.run.b2 .hot.run.b3 -side left #Create a label and 5 zoom buttons in the .hot.zoom frame label .hot.zoom.l1 -text "Zoom: "

Page 2: Example Creating a Hot Window

ModelSim Technotes – www.model.com pack .hot.zoom.l1 -side left button .hot.zoom.b1 -text "Full" -command \ {.wave.tree zoomfull} button .hot.zoom.b2 -text "2x" -command \ {WaveZoom .wave out 2.0} button .hot.zoom.b3 -text "4x" -command \ {WaveZoom .wave out 4.0} button .hot.zoom.b4 -text "1/2x" -command \ {WaveZoom .wave in 2.0} button .hot.zoom.b5 -text "1/4x" -command \ {WaveZoom .wave in 2.0} pack .hot.zoom.b1 .hot.zoom.b2 .hot.zoom.b3 \ .hot.zoom.b4 .hot.zoom.b5 -side left