Information Technology Reference
In-Depth Information
3.10.1 The Register Set
A CPU is a sequential circuit that repeatedly reads and executes an instruction from its memory
in what is known as the fetch-and-execute cycle. (See Sections
3.4
and
3.10.2
.) A machine-
language program is a set of instructions drawn from the instruction set of the CPU. In our
simple CPU each instruction consists of two parts, an
opcode
and an
address
,asshown
schematically below.
1
4
5
16
Opcode
Address
Since our computer has eleven instructions, we use a 4-bit opcode, a length sufficient to
represent all of them. Twelve bits remain in the 16-bit word, providing addresses for 4,096
16-bit words in a random-access memory.
We let our CPU have eight special registers: the 16-bit
accumulator
(AC), the 12-bit
program counter
(PC), the 4-bit
opcode register
(OPC), the 12-bit
memory address register
(MAR), the 16-bit
memory data register
(MDR), the 16-bit
input register
(INR), the 16-
bit
output register
(denoted OUTR), and the
halt register
(HLT). These registers are shown
schematically together with the random-access memory in Fig.
3.31
.
The program counter PC contains the address from which the next instruction will be
fetched. Normally this is the address following the address of the current instruction. However,
if some condition is true, such as that the contents of the accumulator AC are zero, the program
might place a new address in the PC and jump to this new address. The memory address
register MAR contains the address used by the random-access memory to fetch a word. The
memory data register MDR contains the word fetched from the memory. The halt register
HLT contains the value 0 if the CPU is halted and otherwise contains 1.
1
1
HLT
Random-Access
Memory Unit
4096 16-bit words
1
12
1
12
PC
MAR
1
16
1
16
OUTR
MDR
1
16
1
4
AC
OPC
1
16
INR
ALU
Figure 3.31
Basic registers of the simple CPU and the paths connecting them. Also shown
is the arithmetic logic unit (ALU) containing circuits for
AND
, addition, shifting, and Boolean
complement.
Search WWH ::
Custom Search