What is a bus

  • Memory cells and registers are constructed with memory circuits - such as D-flipflops

  • Bus = a set of wires used to connect memory circuits (e.g.: D-flipflops) to allow data in one memory circuit to be transferred to another

  • Sample connection:

                

Uni-directional buses

A uni-directional bus contains wires that are only used to transfer data in one specific direction

 

Example:

 

 

Notice that no 2 outputs are connected together
Therefore, a uni-directional bus can be constructed without the use/help of any special circuits

Bi-directional buses
 

A bi-directional bus contains wires that are used to transfer data in any direction

  • A bi-directional bus is more complex to build because we must be careful to:

      • Do not connect different outputs with each other !!

  • I will first use an example to show you that:

      • Different outputs will be connected together if you use the same bus (= wire) to transfer data in any directions

Bi-directional buses
 

Let's try to construct a bi-directional (data) bus for 1 bit transfer:

The design can easily generalized into a data bus for N bits

Bi-directional buses
 

We connect the output of Dff 1 and the input of Dff 2 onto the data bus wire:

Now we can transfer the data (value) stored in Dff 1 to Dff 2 (by clocking Dff 2)

Bi-directional buses
 

We connect the output of Dff 2 and the input of Dff 1 onto the data bus wire:

Now we can transfer the data (value) stored in Dff 2 to Dff 1 (by clocking Dff 1)

Bi-directional buses
 

Situation:

Will this work ???

Bi-directional buses
 

Unfortunately NO:

The outputs connected together will cause a short-circuit...

Background information: Resistance
 

  • Resistance = the ability of a material to conduct electricity

  • Conductors (such as metals have low resistence

  • Insolators (such as rubber) have high resistance

  • There are circuits whose resistance can change under user control !!

    One such circuit is the Tri-state-buffer:

                 

    • A tri-state-buffer is basically a electronic device where its resistance can be changed using an electrical (input) signal

The tri-state-buffer circuit

The tri-state-buffer circuit

When control=1, the tri-state-buffer will connect the input to the output:

In this situation: control=1 and the input=0 and output=0 (= input)

The tri-state-buffer circuit

When control=1, the tri-state-buffer will connect the input to the output:

In this situation: control=1 and the input=1 and output=1 (= input)

The tri-state-buffer circuit

When control=0, the tri-state-buffer will disconnect the input to the output:

In this situation: control=0 and the input=0 and output=UNKNOWN (orange)

The tri-state-buffer circuit

When control=0, the tri-state-buffer will disconnect the input to the output:

In this situation: control=0 and the input=1 and output=UNKNOWN (orange)

Using tri-state-buffers to construct a bi-directional bus
 

We have the follow design for an unsuccessful bi-directional bus:

The problem is: the outputs are connected together

We can fix this problem using tri-state-buffers (that provides controlled connection !)

Using tri-state-buffers to construct a bi-directional bus
 

Bi-directional bus using tri-state-buffers:

We make sure that the tri-state-buffers are never ACTIVE at the same time !!

(Then at most one of the outputs will be connected to the data bus wire !!!)
DEMO: /home/cs355001/demo/circuits/bi-dir-bus

How the CPU activates the tri-state-buffers
 

The CPU emits a "R/W" controls signal on the control bus:

When the CPU wants to read data from memory, it sends out: R/W=1

When the CPU wants to write data to memory, it sends out: R/W=1

How the CPU activates the tri-state-buffers
 

The CPU can control the direction of data transfer with this simple circuit:

R/W=1 indicates a READ operation (CPU gets data from memory)
R/W=0 indicates a WRITE operation (CPU stores data to memory)

How the CPU activates the tri-state-buffers
 

What happens in a READ operation:

R/W=1 indicates a READ operation (CPU gets data from memory)

The settings of the tri-state-buffers enables data from memory to be copied into a register in the CPU

How the CPU activates the tri-state-buffers
 

What happens in a WRITE operation:

R/W=0 indicates a WRITE operation (CPU writes data to memory)

The settings of the tri-state-buffers enables data from a register in the CPU to be copied into memory