131 Week 4 - Instruction Set Architecture Flashcards
Instruction set architecture
A set of commands that a processor can understand and execute - the interface between the hardware and software.
Reduced instruction set architecture (RISC)
Small number of instructions with a common operand format.
Most instructions operate on registers
Typically take 1 clock cycle to execute.
Fetch decode execute cycle
A constantly repeating cycle within the CPU of fetching, decoding them executing instructions.
Registers
Very fast bits of memory within the CPU that are used as holding areas for data being worked on inside the CPU.
Arithmetic and logic instructions are often designed to only work on registers.
General purpose register
Registers used by the arithmetic and logic instructions which do not have a fixed purpose
Specific purpose register
Registers which have a single fixed purpose e.g., program counter
Program counter (PC)
Special purpose register that acts as a pointer to the next instruction to be executed.
How is PC changed
Either incremented by default during FDE cycle or can be explicitly changed using control transfer instructions to point it to a specific address.
Handling subroutines
Before executing the subroutine, processor notes the value of PC - the return address.
Processor jumps to the start of the subroutine and runs it
At the end of the subroutine processor retrieves return address and continues execution from there.
Call stack
The call stack allows execution of nested subroutines by pushing and popping return addresses of subroutines to the stack when they are called and when they have finished executing.