Signals describe the connections (control lines and busses) between hardwired components. One can think of a signal as the hardware equivalent of a variable.
These signal declarations defines a signals of width 1 (1 wire):
Signal x; Signal x1(1);
This declaration defines a signal x of width 1 (1 wire) that will be displayed on the screen using the name "x". Typically, the display name is kept short to avoid screen clutter.
Signal x(1,"x"):
This declaration defines a bus b of width 32.
Signal b(32);
SIM provides a short-hand alternative to create and name a signal:
Sig (x,3)is equivalent to Signal x(3,"x");
Another signal definition allows for initialization. In this case, signal m has a width == 6 and an initial value == hex 26 (100110)
Signal m(6,0x26);
One and Zero
There are two hard-coded signals named One and Zero that can be
used when appropriate.
Do not use these as outputs; see the SIM bug list
Signal Decomposition
One bus signal can be referenced using C++ array reference syntax:
PC[2] references PC bit 2
Signal Composition
Signals can be composed into busses for connections to components.
For example, assume there is a bus:
Signal s(5,"s");
The following types of signal composition can be used:
s[2] make a signal of width 1 using s[2] s[2],s[4] make a signal of width 2 using s[2] and s[4] s[2]-s[4] make a signal of width 3 using s[2], s[3], s[4] 3*s[0],s[4] make a signal of width 4 using s[0], s[0], s[0], s[4] 5*Zero,One,2*Zero make a signal of width 8 that contains 00000100 2