09.05.2015 Views

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

Microcomputer Circuits and Processes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INTERPRETING<br />

THE INSTRUCTIONS<br />

The instruction 1111 (addition) is fetched from memory <strong>and</strong> is loaded<br />

into the instruction register. Instructions always go into this register.<br />

From here, they pass into the instruction decode logic. The number<br />

1111 is interpreted as an addition, so an enable signal is sent, for<br />

example, to the ALU to tell it to do an addition. The actual guts, the<br />

logic circuits inside the instruction decoder <strong>and</strong> inside the ALU, are too<br />

complex to describe here, but if you are keen, get hold of data sheets for<br />

the CD40181 or CD4057 circuits, made by RCA, <strong>and</strong> have a look at<br />

these.<br />

A SELECTION FROM SAM'S INSTRUCTION SET<br />

Here is how to write a small program for SAM to add two numbers.<br />

This program will be made up of a few simple instructions. We must use<br />

the 1111 addition instruction, but also we will need other instructions<br />

to move data in <strong>and</strong> out of memory. Begin by looking at a MOVE<br />

instruction, represented by 0010.<br />

move immediate data<br />

to reg A<br />

i<br />

what the<br />

instruction does<br />

MVIA 0010<br />

1<br />

mnemonic<br />

i<br />

op-code<br />

The 4-bit number 0010, which the instruction decoder interprets as<br />

a 'move', is called the operation-code or op-code. The abbreviation for<br />

the move, MVI A, is called the mnemonic. But what does this particular<br />

MOVE instruction do?<br />

When the CPU fetches 0010 from memory, the instruction decoder<br />

tells it that it must look at the immediately following memory location.<br />

There, it will find a 4-bit number, say 1100, which it must move into<br />

CPU register A. This is illustrated in figure 3.6.<br />

PC ~ 0 0 1 0 MVI A instruction<br />

1 1<br />

0 0 data<br />

reg A<br />

:;-1 1 1 0 01<br />

Figure 3.6<br />

MVI A instruction. The instruction 0010 causes the next number, 1100, to be moved into<br />

register A.<br />

29

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

Saved successfully!

Ooh no, something went wrong!