TCL library

The TCL components allows you to have a component who's behavior is defined by a TCL script.

######### REDS console
######### TCL generic

TCL script specification

The TCL script is launched by a Logisim into a wrapper.

Wrapper API

The wrapper serves an API that is compatible with the Questasim/Modelsim API to run simulations. Only a few functions are proposed:

examine <signal>
Gets a buffered signal value. The returned value is a string with the binary value of the signal.
<signal> the signal name. If it has a path to the signal (for Questasim), the path will be ignore (eg. /top_sim/component2/Signal_2_i will become Signal_2_i.
Single bit read (eg. examine Signal_2_i(3)) is not supported.

force <signal> <value>
Set a buffered signal value.
<signal> the signal name. If it has a path to the signal (for Questasim), the path will be ignore (eg. /top_sim/component2/Signal_2_i will become Signal_2_i.
<value> string of the binary value. If the string is incomplete (MSB missing) it will be completed by X (eg. 10100 set to a 8 bits signal becomes XXX10100).

run
Request a single simulation step to Logisim.

Wrapper callback

At each simulation step, the wrapper calls a refresh {} callback. You may usually put the code necessary to read the inputs, compute the output, refresh the GUI and set the outputs in this wrapper.

The refresh callback is not allowed to contain the run function call. If you do so, you will create en infinite loop, as the run function makes a simulation step that will call the refresh callback.

refresh {} {
# Read inputs with examine function
# Compute some values
# Refresh the UI
# Set the outputs with force function
}

Back to Library Reference