1.1.1 - Structure and function of the processor Flashcards
What is the ALU?
The ALU is responsible for performing arithmetic calculations and logical operations like:
+-*/
logical bitwise operations like AND OR NOT and XOR
comparisons between values
binary shifts
What does the control unit do?
The control unit organises the sequence in which programmes are executed, followed by decoding the instructions.
This means the control unit is responsible for directing the operations of all the other components of the processor.
What tasks does the control unit do?
- It uses control signals to enable data to be read from and written to main memory.
- It uses control signals to determine what operation the ALU will carry out.
- It decodes every instruction the processor will execute to determine what needs to be done.
- It organise the sequence of micro-operations that need to be performed in order to carry out an instruction.
What does the system clock do?
The clock generates pulses by emitting a signal that oscillates between a low (0) and high (state).
It synchronises the operations of the processor components.
Every operation of the CPU requires a number of clock cycles to complete, specific to each processor.
What is a register and what does it provide?
A register is a location of computer memory within the processor that provides extremely fast access, therefore preventing bottlenecks.
What is the use of a general purpose register?
Having to access the main memory can slow down the execution of instructions. Therefore, the processor uses registers to temporarily store and access the results of operations.
What does the program counter do?
It holds the address of the next instruction to be executed by the processor.
When does the program counter change?
It is incremented by one during the fetch phase of the FDE cycle. Instructions which change the flow of control, like branches, also change the PC value.
What does the CIR do?
The CIR stores the most recently fetched instruction that is waiting to be decoded and executed.
What is the status register used for?
Used to store information about the result of the last instruction that the ALU executed.
Each bit within the status register acts as a flag to indicate if an error or exception has occurred within the process, or to enable or disable interrupts to be raised.
What is an error or exception?
An error or exception is when the result of a calculation requires further action. For example, it signifies if the result of a calculation is negative or zero, or if a calculation produced an overflow or/and a carry.
What is an interrupt?
An interrupt is an event outside of the program process which requires the attention of the processor. For example, indicating a hardware malfunction.
What does the MAR do?
Temporarily holds the address of the memory location (in main memory) that the processor needs to access, either to read from (i.e. load data) or write (i.e. store data) to.
What does the Memory Buffer Register/ Memory Data Register do?
It temporarily holds the data (data values or instructions) that are read from or written to the main memory.
What does the accumulator do?
Stores the result of any calculation processed by the ALU.
The processor accesses other general purpose registers where temporary values are stored while calculations are completed. Any result resides in the accumulator.
What must happen before a fetch decode execute cycle can take place?
The program instructions must have been translated into machine code
The program instructions must have been loaded (from secondary storage) into the main memory (RAM) or provided by the input or output devices by the I/O controllers.
What happens during the first part of the Fetch stage?
1) The PC keeps the address of the next instruction to be executed. It’s contents are copied to the MAR, which passes it on to the address bus.
2) The CU then instructs a memory read operation to allow the contents of the memory location to be transferred to the processor. The instruction that is stored there is transferred by the data bus from main memory to the processor and saved in the MBR/MDR.
What happens during the second part of the Fetch stage?
3) Simultaneously, the ALU increments the contents of the PC by one to point to the address of the next instruction that needs to be fetched.
4) The contents of the MBR are copied to the CIR, in order to keep the instruction safe so the MBR can be used during the execute stage to store additional data needed.
What happens during the Decode stage?
The control unit decodes the instruction kept in the CIR, involving splitting the instruction into operand and opcode to determine:
- what type of instruction needs to be carried out.
- if additional data is required from memory
- where this data is kept in memory
What happens during the Execute stage?
The instruction is executed. The exact sequence of operations depends on the type of instruction being executed.
If the program requires a non-sequential instruction to be executed, like if the current instruction is a branch, the address of the next instruction to be executed is determined and loaded to the PC.
How does a processor read and write from/to memory?
- If a processor needs to read a memory location, it sends a “read request” via the control bus, along with the address via the address bus. These happen in the same clock cycle.
- Depending on how long it takes to access the memory, the processor then receives the contents via the data bus after a number of clock cycles.
- If a processor needs to write to a memory location, it sends a “write request” via the control bus, along with the data bus containing the data to be stored and the address bus with the memory location address.