user3431399
user3431399

Reputation: 499

Write tclsh script to compile SV file by VCS tool

I am writing a tclsh script to compile system verilog files, how can I solve the problem below and compile all the files in tclsh script?

The command below will only compile 'mod1.sv':

exec vlogan -sverilog mod1.sv mod2.sv mod3.sv

The command below will only compile 'mod2.sv':

exec vlogan -sverilog mod2.sv mod3.sv mod1.sv

But this actually compile all the sv file in command line:

vlogan -sverilog mod2.sv mod3.sv mod1.sv

Upvotes: 0

Views: 893

Answers (1)

thgr
thgr

Reputation: 93

If you are using tcl version >= 8.5 you could as well use list expansion via {*}

exec vlogan -sverilog {*}{mod1.sv mod2.sv mod3.sv}

if you stored the file names beforehand it would be

set svFiles [list mod1.sv mod2.sv mod3.sv]
exec vlogan -sverilog {*}$svFiles

I like learning by example. If you do as well this might be helpful: Examples summarizing various methods of exec

Upvotes: 0

Related Questions