Hardware Reference
In-Depth Information
Instruction bnz next (machine code 70 02)
Step 1
The value in the PC (0x000C) is placed on the program memory address bus with a request
to read the contents of that location.
Step 2
The 8-bit value at the location 0x000C is the instruction opcode 0x70. At the end of this
read cycle, the PC is incremented to 0x000D. The program memory returns the opcode
byte 0x70 to the CPU.
Step 3
The processor recognizes that this is a conditional branch instruction and it needs to fetch
the branch offset from the program. So it places the PC value (0x000D) on the program
memory address bus with a read request. At the end of this read cycle, the processor
increments the PC to 0x000E.
Step 4
The program memory returns the branch offset 0x02 to the CPU (held in IR). The
CPU checks the contents of accumulator A to determine whether the branch should
be taken. Let's assume that A contains zero and the branch is not taken. The PC
remains at 0x000E. If A contains a nonzero value, the next instruction will be
skipped.
Instruction inc 0x20 (machine code 05 20)
Step 1
The value in the PC (0x000E) is placed on the program memory address bus with a request
to read the contents of that location.
Step 2
The 8-bit value at the location 0x000E is the instruction opcode 0x05. At the end of this
read cycle, the PC is incremented to 0x000F. The program memory returns the opcode
byte 0x05 to the CPU.
Step 3
The processor recognizes that it needs to increment a data memory location; this requires
it to fetch an 8-bit address from the program memory.
Step 4
The processor places the value in the PC on the program memory address bus with a read
request. At the end of the read cycle, the PC is incremented to 0x0010 and the value 0x20 is
returned to the CPU and is placed in the IR register.
Step 5
The processor places the value 0x20 on the data memory address bus with a request to
read the contents of that location. The data memory returns the value of that memory
location at the end of the read cycle, which will be placed in the MDR.
Step 6
The processor adds 1 to the MDR.
Step 7
The processor places the contents on the data memory data bus and places the value
0x0020 on the data memory address bus, and indicates this is a write cycle. At the
end of the cycle, the value in the MDR is written into the data memory location
at 0x20.
Search WWH ::




Custom Search