defenselasas.blogg.se

Modelsim do file
Modelsim do file










modelsim do file

modelsim do file

By default the TranscriptFile variable in modelsim.ini is set to transcript. If either PrefMain(file) in modelsim.tcl, or TranscriptFile in modelsim.ini file is set, then the transcript output is logged to the specified file. The execution of the further statements/commands never happens.Variable settings determine the filename used for saving the Main window transcript. If the first when statement doesn't trigger then the execution doesn't proceed further. Using 'when' command of Tcl to wait on an event and executing the branch statement is not possible because of Tcl's sequential execution. Based on the signal event going high, a particular branch should get selected in the do file. Use vsim command's generic argument switch (-G) to pass a generic to the design (The design is in VHDL.) This generic value can be used in the top level test-bench to create an event by turning high one of the signal meant only for this purpose. Since ModelSim uses Tcl for its command language, the do file can have simulation-specific commands as well as Tcl commands which can include graphic interface features, and a general programming interface for building up complex command procedures. Once the ModelSim launches and loads the design, this file will be executed as "do " automatically. do extension), and this file can be passed as an argument to vsim command with -do switch option. All the commands that can be run on a ModelSim command prompt can be saved in a macro file (usually named with. If neither of the the generics are passed, then no branch gets selected, which is the required case.ĭo file is basically a script file for modelsim to automate tasks like repetitive simulations for debugging purposes. Each branch contains different set of commands to be run in prior to run -all command. The result of lsearch if successful in finding the string is the index of the argument list, argv, and -1 if it fails in finding the string. TX_CATEGORY and RX_CATEGORY were defined as generics of boolean type in the top level TB file and the do file searched for either of these strings for the branch selection. The do file searched for this prior defined generic parameter (in top level TB) within the argument list ( argv ) and then select the branch for execution. If a testcase was part of a category then this info was passed as a generic parameter (with -G switch option) of vsim command. Also if no category is passed then no branch is to be selected but run as normal. So the do file needed to know the category of the testcase and based on this info selects the branch (if-else) for execution. The info can be passed as a generic option of vsim command (-G switch option), which can then be searched for in the do file if the info is known in prior.įor my requirement, the do file had to execute different set of commands according to the category of testcase to be executed. Now it became simple to pass the info to do file. This is why argc and argv displayed the results as detailed above. So it is vsim script that reads the do file and executes the commands within it. (It can be assumed that the contents of do file gets appended to vsim script at the end). The script vsim doesn't consider the do file as a separate script file but as a part of vsim script itself. The do file passed as - do switch option is taken to be as an argument passed. Since ModelSim uses Tcl as its command language, vsim invocation too is like running a tcl script with its switch options as command line arguments. Instead of displaying argc as 3 and test1 and test2 as the arguments, it showed 21 as the argc and echoed the arguments of entire vsim command! Where test1 and test2 are arguments passed on to the do file.

#Modelsim do file code#

But instead I saw the vsim arguments echoed on the screen.Įcho "No of command line arguments passed are: $argc"Īdding the above lines of code in the do file (run_def.do) and then passing this file as a - do switch option to vsim command as, argn"īut when tried with this logic, the arguments passed were not passed on to the file. So by passing the info as arguments to the do file while invoking vsim command, info can be passed on to the do file. Then we can use Tcl's global variables argc and argv to access these arguments inside the tcl file. Since do file is nothing but a Tcl file (ModelSim uses Tcl as its command language), info as arguments can be passed from the command line. The first thing that I thought was it is possible by using command line arguments.

modelsim do file

I came across a query on the possibility of passing info to modelsim's do file.












Modelsim do file