Skip to main content
\(\newcommand{\doubler}[1]{2#1} \newcommand{\binary}{\texttt} \newcommand{\hex}{\texttt} \newcommand{\octal}{\texttt} \newcommand{\prog}{\texttt} \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section8.3CPU Interaction with Memory

The connections between the CPU and Memory are shown in Figure 1.2.1 in Section 1.2. In this section we discuss how the CPU interacts with memory. The I/O system will be discussed in subsequent chapters.

As an example of how data can be stored in memory, let us imagine that we have some data in one of the CPU registers. Storing this data in memory is effected by setting the states of a group of bits in memory to match those in the CPU register. The control unit can be programmed to do this by

  1. placing the memory address on the address bus,

  2. placing a copy of the register bit states on the data bus, and then

  3. placing a “write” signal on the control bus.

For example, if the eight bits in memory at address \(\hex{0x7efff5e4}\) are in the state: \begin{equation*}\hex{0x7efff5e4: b7}\end{equation*}the r0 register in the CPU is in the state: \begin{equation*}\hex{0x4a97a5cd}\end{equation*}and the control unit is programmed to store one byte from r0 at location \(\hex{0x7efff5e4}\text{,}\) the control unit then

  1. places \(\hex{0x7efff5e4}\) on the address bus,

  2. places \(\hex{0xcd}\) on the data bus, and then

  3. places a “write” signal on the control bus.

This causes the bits at memory location \(\hex{0x7efff5e4}\) to be changed to the state: \begin{equation*}\hex{0x7efff5e4: cd}\end{equation*} Important! When the state of any bit in memory or in a register is changed, any previous state of us states are lost forever. There is no way to “undo” this state change or to determine how the bit got in its current state.