Article image

2 min Print version

Wires and their states

The wires are the core driver of the simulator.
They connect the elements and store the state of the connection.

The states

The wires can be in any of the following states:

  • "float" this means there is no component output driving the wire, it is just floating or undefined
  • "up" a resistor (pull-up) has set the state to a high value, but can be pulled down by an active output
  • "down" simular to "up", but is has been pulled down by a resistor
  • "high" one component has activly set this to high, having another output driving the wire will result in an error
  • "low" similar to high, but an active low is driven

The connections

As previously defined, a wire can connect multiple pins of your simulator.
There has to be at least 2 connections, but there is no upper limit.
You can have visually broken wires, but internally they will be connected.
There is a lot of internal magic happening, when connecting line segments,
but for you as the user, you just use them by connecting the pins.


The processing

Upon start of a simulator step, all wires are set to "float". After this, all connected pins are queried and their output is set as the new wire state, if they are driven or pulled. If 2 or more drivers are detected, the wire will be in an error state.

A combination of pulling and driving is possible, the driving output wins.

Multiple pullings are not possible, only the first one will be used. So if you got a pull-up and a pull-down, the first connected will win.

After all connections were processed, the wire state will be set and the connected pins will get their new status set.
Finally the color for the wire will be set.

Our algorithm thinks, these articles are relevant: