Download CPU Design

Transcript
00-173 C06 pp3
216
10/25/00
CHAPTER 6
11:10 AM
Page 216
CPU DESIGN
In general, a CPU performs the following sequence of operations:
• Fetch cycle: Fetch an instruction from memory, then go to the decode cycle.
• Decode cycle: Decode the instruction—that is, determine which instruction has been fetched—then go to the execute cycle for that
instruction.
• Execute cycle: Execute the instruction, then go to the fetch cycle
and fetch the next instruction.
A generic state diagram is shown in Figure 6.1 on page 215. Note
that the decode cycle does not have any states. Rather, the decode
cycle is actually the multiple branches from the end of the fetch routine to each individual execute routine.
6.2
Design and Implementation of a Very Simple CPU
In this section, we specify and design a Very Simple CPU, probably the
simplest CPU you will ever encounter. This CPU isn’t very practical,
but it is not meant to be. The sole application of this CPU is to serve
as an instructional aid, to illustrate the design process without burdening the reader with too many design details. In the next section,
we design a more complex CPU, which builds on the design methods
presented here.
6.2.1 Specifications for a Very Simple CPU
To illustrate the CPU design process, consider this small and somewhat impractical CPU. It can access 64 bytes of memory, each byte being 8 bits wide. The CPU does this by outputting a 6-bit address on its
output pins A[5..0] and reading in the 8-bit value from memory on its
inputs D[7..0].
This CPU will have only one programmer-accessible register, an
8-bit accumulator labeled AC. It has only four instructions in its instruction set, as shown in Table 6.1.
Table 6.1
Instruction set for the Very Simple CPU
Instruction
Instruction Code
Operation
ADD
00AAAAAA
AND
01AAAAAA
AC←AC M[AAAAAA]
AC←AC ∧ M[AAAAAA]
JMP
10AAAAAA
GOTO AAAAAA
INC
11XXXXXX
AC←AC 1