Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
20639 Discussions

tcl commands in Altera Modelsim

Altera_Forum
Honored Contributor II
3,984 Views

Hi all! 

 

I am using Altera Modelsim, which is tcl-based. I use the GUI. 

 

In the console, when I type the command puts "a" I get not output: 

 

ModelSim> set a 1 

# 1 

ModelSim> echo $a 

# 1  

ModelSim> puts $a 

ModelSim> puts "a" 

ModelSim>  

 

Can anyone explain that? 

 

Thx
0 Kudos
13 Replies
Altera_Forum
Honored Contributor II
1,469 Views

on the other hand, each time a "set" command is executed, there is a trace in the console with the value 

Why is that?
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

puts will put messages into the host OS's console window (i see this on linux). i'm not sure where they'd go if you are using Windows. 

 

echo prints to the ModelSim transcript window as you've seen.
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

correct. 

Is there a way to redirect the host OS's console into ModelSim's console?
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

you'd have to find a tcl channelid for the ModelSim console. i'm not sure if there is one.

0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

OK. Thanks!

0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

I have encountered the same problem, were you able to find a solution?

0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

I encountered this issue a long time ago. If you compare "echo" vs "puts" on a Linux version of modelsim, you will see "puts" output going to the terminal that launches the Modelsim process, whereas "echo" prints to the Modelsim console output. 

 

I never bothered to figure out how to redirect puts, I just used echo in my scripts :) 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

I would do the same but I have a lot of automated simulations and thus many files to change. Apart from that I also take input using gets and I assume I will run in to some problems there.

0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

 

--- Quote Start ---  

I would do the same but I have a lot of automated simulations and thus many files to change. Apart from that I also take input using gets and I assume I will run in to some problems there. 

--- Quote End ---  

 

Yeah, I'd agree that there is a pretty good chance that you'll run into trouble there. 

 

Chances are Mentor have been asked this question in the past. If you have a Mentor Site ID and service contract, just file a service request. If you do not, ask me, and I'll file one ... since I am interested in the answer :) 

 

Cheers, 

Dave
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

Hello Dave,  

As I have neither a Mentor ID nor a service contract I would greatly appreciate if you would ask them. 

[edit] 

For now I launch Modelsim from the command line executing vsimk 

intelFPGA_lite/16.1/modelsim_ase/linux/vsimk  

gets gets input from the terminal so I can use it but I need to use the terminal and transcript at the same time. 

[/edit]
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

When you start vsim, try to use the "-gui" option, like "vsim -gui"

0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

 

--- Quote Start ---  

When you start vsim, try to use the "-gui" option, like "vsim -gui" 

--- Quote End ---  

 

 

That is indeed the solution for me, thanks.
0 Kudos
Altera_Forum
Honored Contributor II
1,469 Views

I just tried this under Windows 7 with Quartus 15.0 Modelsim 10.3d. I started a NIOS II IDE shell first, used 'which vsim' to confirm I was going to run the correct version of Modelsim, and then ran 'vsim', without the -gui option. The Modelsim GUI console output was: 

ModelSim> puts "Hello!" ModelSim> echo "Hello!"# Hello!  

The first "Hello!" was printed on the NIOS II IDE shell command-line. 

 

Adding the -gui option redirects the output to the GUI console. 

 

Thanks for posting your solution, it works great! :) 

 

Cheers, 

Dave
0 Kudos
Reply