Review: circuit to forward registers data to input of ALU
 

Previously, we have studied this circuit:

Circuit enable the CPU to fetch the correct registers into the ALU inputs (to prepare for computation)

Review: circuit to forward registers data to input of ALU

Previously, we studied this solution:

I will present a better (more efficient) solution to forward registers to the ALU inputs using tri-state-buffers

Review: circuit to forward registers data to input of ALU

I will limit the discussion to forwarding 1 bit from the registers to the ALU:

Because you can use the same technique to forward the other bits !

Forwarding the register values to the ALU using tri-state-buffers
 

The MUX solution to forward 1 bit from registers to the ALU is as follows:

The signals o3,o2,o1,o0 are the (1 bit) outputs from registers  

Forwarding the register values to the ALU using tri-state-buffers
 

Let's start afresh with the input signals:

We must select one of the signals o3,o2,o1,o0 for the ALU input  

Forwarding the register values to the ALU using tri-state-buffers
 

If we connect o0 to the ALU input (like this):

Then output o0 can be forwarded to the ALU input (in fact: is always forwarded...)  

Forwarding the register values to the ALU using tri-state-buffers
 

If we connect o1 to the ALU input (like this):

Then output o1 can be forwarded to the ALU input (in fact: is always forwarded...)  

Forwarding the register values to the ALU using tri-state-buffers
 

However, if we connect both o0 and o1 to the ALU input (like this):

Then outputs o0 and o1 are connected together (and it is forbidden -- it causes a short-circuit !)  

Forwarding the register values to the ALU using tri-state-buffers
 

Solution: use tri-state-buffers to control the making/breaking of these connections:

The only thing remaining is: control the making of the connections !

Forwarding the register values to the ALU using tri-state-buffers
 

We can use a decoder to "translate" the selection signals:

We can use the decoder outputs to selectively connect the register outputs !

Forwarding the register values to the ALU using tri-state-buffers
 

The complete solution is:

The decoder (circuit) will turn exactly 1 tri-state-buffer on and prevents multiple outputs being connected together !!

Forwarding the register values to the ALU using tri-state-buffers
 

Example: if selection signals = 00, the decoder will only activate the lower tri-state-buffer:

I will now apply this solution to forward registers (4 bits each) to the ALU inputs...

Review: circuit to forward registers data to input of ALU

Previously, we used this solution:

I will now present a (better) solution that uses tri-state-buffers

Review: circuit to forward registers data to input of ALU

The solution using tri-state-buffers is as follows:

The decoder will active all tri-state-buffers of (exactly) 1 register which will connect to the ALU input

Review: circuit to forward registers data to input of ALU

I have redrawn the solution without explaining inline text:

DEMO: /home/cs355001/demo/circuits/reg-TSB-alu and reg-TSB-alu2

Comparing the tri-state-buffer solution vs. the mux solution - # gates as circuit cost
 

Consider the solution that uses multiplexors:

It uses 2×N multiplexors = 2×N ×N gates; where N = # bits in a register

Comparing the tri-state-buffer solution vs. the mux solution - # gates as circuit cost
 

Consider the solution that uses tri-state-buffers: (tri-state-buffer is a basic gate)

It uses 2 decoders + 2×N tri-state-buffers = 2 ×N + 2×N gates; where N = # bits in a register