# Multi-Rail

The misunderstanding
NCL is dual-rail and substituting dual rail for binary signals just doubles the area and the power.

The understanding
NCL is a general multi-value/multi-rail logic. Multi-rail representation can eliminate the continual decoding, encoding and comparing of many binary encoded variables.

The value of multi-rail
To illustrate the usefulness of multi-rail representation  we will continue with the case statement example used in the steering discussion which left off with the steering circuit shown below .

case of (A)
0: B <= X+ Y;
1: B <= C+ W;
2: B <= D+ Z;
default: B <= 0;
endcase

The case variable A has been assumed to be binary encoded and in need of decoding, comparison and guarding for unspecified values with the default case(A binary encoded A could = 3). If we make A a three rail variable all of this goes away. The comparisons with their True and False rails are not needed. Each rail of A directly enables its flow as shown below.

When A = 0 the 0 rail of A reads X and Y which flows to B as below.

When A = 1 the 1 rail of A reads Y and C which flows to B as below.

When A = 2 the 2 rail of A reads Z and D which flows to B as below.

There is no possibility of A being other than 0, 1 or 2 and no need of a default case.

Tallying the activity of the circuit we add it to the activity table.

With the multi-rail steer variable each value of A requires 3 enables, 1 alu op and one OR. This remains constant with scale as the activity of the other circuits increase as shown in the extrapolation to 10 cases with a 10 rail case variable shown below.

With multi-rail steering the worst case delay path through the case is 2 enables, one alu op and one OR for 4 delay stages. The worst case delay for the NCL steering is 2 reads, 10 compares one alu op and one OR for 14 delay stages. The worst case delay for the CBL selecting is 1 read, 10 MUXes one alu op  for 12 delay stages. The average and worst case activity for CBL and multi-rail steering is 36 and 5 respectively. We double the 5 to 10 to account for the null wavefront and it is still less than 1/3 the CBL activity. The multi-rail steering is faster than the CBL even with the null wavefront. And it appears to be smaller than the CBL.

This is a simple example but the principles of steering only necessary activity through a background of quiescent emptiness and using multi-rail representation to avoid constant decoding, re-encoding and  testing of value is clear and compelling and scales with complexity.

The multi-rail state machine
For example, a multi-rail state machine variable is much more efficient than a binary encoded state machine variable. In the CBL model the state variable is sent every clock tick to every cone which tests the value. With an NCL multi-rail state variable each state rail goes only to the cones it enables for its state. All the other cones remain quiescent. Only relevant cones are enabled and only relevant paths flow within each cone . The state variable fan-out and the state value testing by each cone goes away.

The NCL multi-rail state variable is faster, smaller and thriftier with power than the CBL binary counterpart. CBL clock gating is limited in granularity and requires more logic rather than less logic and still requires the state variable fan-out and testing.

Steering and multi-rail representation scales up and delivers advantage at the system level.

Numeric multi-rail representation
Multi-rail representation can also provide advantages for numeric representation. Any numeric radix can be represented with multi-rail. It is not limited to dual-rail. See LDD chapter 9.

a four-rail  quaternary number is represented with the same quantity of rails as the dual-rail  number but requires half the switching activity. While only two rails of the quaternary representation switch four rails of the binary representation will switch.  Adding two quaternary numbers requires more logic than adding the equivalent binary number but the switching activity is less.

Multi-rail interaction
It is not just the data paths that can be multi-rail. Multi-rail variables can interact directly. The following NCL circuit adds a binary variable to a trinary variable (3 rail) and produces a quaternary (4 rail) sum.

Non-numeric multi-rail
Multi-rail variables can represent non-numeric data. A three rail variable called thing could have the values animal, vegetable, mineral. A four-rail variable called family could have the values mother, father, son, daughter.