09.05.2015 Views

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3<br />

RUNNING A SIMPLE<br />

PROGRAM<br />

In Chapter 2 we saW how a CPU, memory, <strong>and</strong> input-output devices<br />

communicated with each other using bussed data <strong>and</strong> address signals,<br />

RD, WR, <strong>and</strong> ALE signals, all of which did the right thing at the right<br />

time to make the system work. Now these data movements <strong>and</strong> their<br />

controlling signals do not happen by magic; it is the job of the computer<br />

program, written by you. In this chapter we shall see how a simple<br />

program, stored in memory, is able to make a simple computer run. The<br />

computer is a hypothetical4-bit machine called SAM (Simple Although<br />

Meaningful). SAM employs most of the ideas discussed in Chapter 2,<br />

although it is a bit simpler.<br />

SAM'S<br />

HARDWARE<br />

SAM has a 4-bit multiplexed (shared) address-data bus, <strong>and</strong> the usual<br />

RD, WR, <strong>and</strong> ALE signals. It is connected to memory only, there is no<br />

input-output device in use at the moment, so we can forget about the<br />

MilO signal. The memory is also simple, just one board, so we do not<br />

have to worry about decoding. SAM is shown in figure 3.1.<br />

RD<br />

WR<br />

ALE<br />

CPU<br />

,<br />

memory<br />

K<br />

"<br />

"<br />

4-bit shared bus )<br />

v<br />

Figure 3.1<br />

SAM.<br />

What is inside the CPU? This is shown in figure 3.2. You can see a<br />

number of registers, which are simple 4-bit memories used to hold<br />

4-bit binary numbers. These communicate with the 4-bit bus via the<br />

usual tristate buffers. The registers are: reg A, reg B, the accumulator, the<br />

program counter, <strong>and</strong> the instruction register. They all have very specific<br />

jobs to do; for example, the accumulator holds all results of maths-type<br />

operations. The purposes of the other registers will be revealed as you<br />

read on. There are two other important units on the CPU chip; the<br />

AL U or arithmetic logic unit, which does what it says: arithmetic <strong>and</strong><br />

logic jobs, like adding, subtracting, ANDing, <strong>and</strong> ORing. Then there<br />

are the clock <strong>and</strong> timing, <strong>and</strong> the instruction register circuits. These<br />

circuits provide the RD, WR, ALE signals <strong>and</strong> also signals to enable the<br />

register buffers.<br />

26

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!