.do files... why?

Alright, I've got to fess up. I'm lost as to the point of .do files. They seem to suffer through all of Tcl's wacky syntax, but with the added benefit of not giving you access to the standard Tcl commands.

Am I missing something here? Or is the entire point of the exercise that Tcl is considered to be intimidating, whereas a proprietary macro language is not?

Rob Gaddi, Highland Technology -- www.highlandtechnology.com 
Email address domain is currently out of order.  See above to fix.
Reply to
Rob Gaddi
Loading thread data ...

If you're talking about Modelsim - I was under the impression that they were one in the same. We seem to name our modelsim scripts haphazardly - some .tcl, some .do

Perhaps .tcl is intended for pure tcl, and .do is intended for "tcl" plus modelsim builtins? I dunno. Never given it too much thought...


Reply to
Mark Curry

Yes, Tcl and do files are the same with the exception of some error (onerror/onbreak) and breakpoint handling.


formatting link

Or is the entire point of the exercise

Reply to

There is no difference between a .do and a .tcl file, in the sense that Modelsim doesn't really care what the filename is. Modelsim uses the one Tcl interpreter for everything. (BTW, you should have access to all of Tcl's wacky commands, albeit possibly an older version of Tcl.)

What matters is how you call it:

source filename vs do filename

There are a few differences that I have discovered in my scripting travels:

- error (onerror/onbreak) and breakpoint handling (as mentioned in Hans' post).

- [info script] returns a null string in a do script whereas it does the normal thing (returning info about the script) when "sourced".

The last point matters if you are writing "location idependent" code, e.g.

# converts a path relative to the script being run into an absolute one. proc file_rel2abs {path} { if { [ string length [ info script ] ] > 0 } { return [file normalize [file join [file dirname [info script]] $path ] ] } else { error "use source rather than do" } }

Regards, Allan

Reply to
Allan Herriman

Mentor's .do file syntax predates tcl.

I first used .do files on Apollo workstations running Mentor V6 simulators (Quicksim IIRC) in the mid-late 80's.

ModelTech then adopted a similar (if not identical) command file syntax when they launched the low-budget V-System(?), well before they were acquired by Mentor.


Reply to
Brian Davis

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.