Rocchi
Rocchi

Reputation: 26

In a TCL script how do I echo the content of a variable?

I am writing a TCL script for modelsim, and I want to compare the output value of a signal to a constant to know the circuit is working correctly. I know how to control the input signals but can't figure out how to echo the output.

Ideally I'd be able to pipe everything to a csv file, but it'd be enough to have the script return a pass/fail.

Still I need to read the value of an output (in my case it's sim:/union/outf) in a similar way to something like [$echo outf] on bash

PS. I realize the title may be misleading, because I can print the value of a variable declared inside the script. I need to print the current value of a wave output.

I'd want to save each value of 'outf' to later compare it

Upvotes: 0

Views: 4225

Answers (2)

Xavier Martin
Xavier Martin

Reputation: 21

When using Modelsim, the TCL command to echo the output is to use "examine"

examine -hex /tb/my_signal

Upvotes: 2

Donal Fellows
Donal Fellows

Reputation: 137587

The direct equivalent in Tcl of bash's echo $out is:

puts $out

Or, if the variable is an environment variable:

puts $env(out)

Upvotes: 0

Related Questions