The next figure should the additional wiring that is needed to
add the READ functionality to the memory circuit.
Make sure you realise that in a READ operation:
- The CPU signals the write operation to memory by setting
MEM = 1 and R/W = 0.
- The memory provides the data on the data bus (for CPU to read)
- The data is taken from the outputs of D-flipflops in the memory
by connecting the outputs of the D-flipflops to the data bus.
This connection must be made through tri-state-buffers
for the reason that we studied before (and too long to write).
The following figure show the complete wiring diagram of a memory circuit
for reading and writing.
The additional circuitry needed for reading is given in
blue:
- The output of the DECODER is used to "filter" the outputs of the
D-flipflops.
All the blue AND-gates will output ZERO,
except the row of AND-gates that has been selected by
the DECODER.
- The output of the blue OR-gates at the
bottom will then equal to the outputs of the selected row of AND-gates
(because (x OR 0 OR 0 OR 0 Or .... = x).
- The output of the OR-gates are connected through tri-state-buffers
to the data bus.
- The AND-circuit using MEM and R/W input ensures that
the tri-state-buffers are only turned on when
MEM = 1 and R/W = 1, i.e., only when the CPU wants to
READ the memory.