Prior Page     Next Page     This Chapter    Prior Chapter    Next Chapter




Central Processor Registers

The Central Processing Unit, CPU, has several registers which can be visualized in terms of the following diagram.





The CPU performs operations on data, like adding two values together, or finding the exclusive-or of two 32-bit quantities. Generally the CPU uses the values from a general purpose register and another from memory to create a result which is always put into a register. Register data is immediately available for operations. Access to memory is somewhat slower.

A register, like memory, contains undifferentiated bits. That is, bits in memory are not integers or characters or pictures. The CPU doesn't know nor care what kind of bits they are. To make a program do what you want you need to perform operations on data that are consistent with the meaning of the bits. As a programmer you choose the meaning. This is why the registers are called general purpose registers.

The other register in the Hermes CPU is the 2 word (64-bit) Status register, Sr. It contains two words, in the first word is a 4 bit field which holds the condition code, called the CCr. The second word is a 32-bit field which holds the address of the next instruction to execute, it called the Nr. Program branching occurs because an instruction modifies the Nr register. The Hermes CPU increments the Nr register by adding 6 (the length of the current instruction) before it executes any instruction. This makes Nr point at the next machine instruction to execute. This is why it it called the Next register.

The first word of the status register contains the condition code, called the CCr, a 4-bit field, the condition code gives information about the result of the previous instruction. Most CPU instructions set a bit in CCr depending on the type of the instruction and the characteristics of the result. The following table defines what bit is set based on the type of instruction.


The 4-bit condition code is:


Later, when instructions are defined, the second field of each instruction definition will give a code to indicate the condition code type (X,C,A,L).  This tells how the instruction will modify the condition code.  An X in this field indicates the instruction does not change the condition code.








Prior Page     Next Page     This Chapter    Prior Chapter    Next Chapter


Copyright © 1995 R. Uzgalis. All rights reserved.
Contact: buz@cs.aukuni.ac.nz