Download Notes - Read
Transcript
Tcl/Tk Overview Lab 2: Using Tcl Scripts and Tk Widgets in Simulation Introduction This lab introduces you to the concept of using Tcl/Tk as an aid to simulation and debugging. The lab combines a mixture of ModelSim commands, Tk widgets and Tcl scripting. You will see that you can streamline your simulations using Tcl scripts, and you can add push button ease to your simulations using Tk. The files we will use for this lab are cordic_core_rtl.vhd and cor_it.do. The cordic_core_rtl.vhd file contains the code that takes input values from vectors x and y, performs sine and cosine calculations and adjustments on the inputs, and outputs the angle and the difference. The cor_it.do file is a scripting file that contains Tcl commands and serves as the design’s testbench. Directions Creating a Tk Button to Run a Simulation Script 1. To set up the lab, invoke ModelSim and change directory to the labs/lab2/ cordic_core directory (use the “cd” command or the File → Change Directory… menu. 2. First we will create a work library and a logical mapping to it. ModelSim> vlib work ModelSim> vmap work work 3. Next we will compile the file cordic_core_rtl.vhd using the -93 switch. ModelSim> vcom -93 cordic_core_rtl.vhd 4. Now we will load the design into the simulator memory. ModelSim> vsim cordic_core 5. Once the design is loaded into memory, we can run the Tcl script, cor_it.do. 2-24 ModelSim Advanced Debugging December 2002