What is the role of the Control Unit (CU)
-coordinates all activities of the CPU
-directs flow of data between the CPU and other devices
-accepts the next instruction, decodes it, handles its execution, and stores the resulting data back in memory or registers
-Sends memory read and write requests to main memory on the control bus,
What is the role of the program counter (PC)
-Holds the address of the next instruction to be executed. This could be:
-> next instruction in a sequence of instructions
-> address to jump to if the current instruction is a command to jump or branch - this would be copied from the CIR (current instruction register)
-close relationship with MAR - at start of a new FDE cycle, the address held in PC is copied to the MAR
What is the role of the memory data register (MAR)
-Holds the address of the memory location from which data or an instruction is to be fetched or to which data is to be written
-sends the addresses to memory down the address bus
What is the role of the memory data register (MDR)
-Used to temporarily store the data which is read from or written to memory
-Sometimes known as memory buffer register (MBR) & nicknamed 'gateway to the processor'
-all data to & from memory must travel down the data bus & pass through the MDR
What is the role of the current instruction register (CIR)
-holds the current instruction being executed
-contents of the MDR are copied to CIR if it is an instruction
-contains the opcode and operand(s) of the current instruction
what is an instruction made up of
-instruction = opcode + operand(s)
-e.g. a machine language instruction to load the contents of location 1000 into the ALU may look something like:
LDA 1000
What is the purpose of the accumulator (ACC)
-one of many general purpose registers modern CPUs have
-data or information is often stored in them
-CPU may have many general purpose registers for storing temporary data and instructions whilst calculations are being carried out
-(generally) more general purpose registers mean the CPU can run faster
What is the purpose of the ALU (arithmetic logic unit)
-Performs arithmetic and logical operations, on data
-Arithmetic operations include: add, subtract, multiply, divide (* and / are abstractions)
-Bitwise shift operations left and right
-Boolean logic operations: comparisons (<, >, =), AND, OR, NOT, XOR, NAND etc.
-Often uses general purpose registers to temporarily hold results of calculations, e.g. ACC
Buses
-consist of a series of connectors (like etchings) that transfer signals between internal components
-typically consist of 8, 16, 32, or 64 lines
-each wire/line represents 1 bit of information
System bus
-consists of 3 separate buses carrying control signals, addresses, and data
-address bus: carries memory addresses that identify where the data is being read from or written to. Unidirectional
-data bus: carries the binary 1s and 0s that make up the actual information being transmitted around the CPU/computer. Bidirectional
-control bus: carries command & control signals to and from every other component of the CPU/computer. Bidirectional
Types of control signals
-memory read: causes data from addressed location in RAM to be placed on the data bus
-memory write: causes data on the data bus to be written into the addressed location in RAM
-bus request: indicates that a device is requesting use of the data bus
-bus grant: indicates that the CPU has granted access to the data bus
-system clock: used to synchronise operations
Relation to assembly
-although computers use binary (1s and 0s), humans prefer abstract languages that are easier to understand
-at a low level, computers use assembly code, a language with a direct 1 to 1 relationship with the CPU's architecture
-mnemonics are used to represent binary instructions.
Assembly mnemonics (more on this later)
ADD - add
SUB - subtract
STA - store
LDA - load
BRA - branch always
BRZ - branch if zero
BRP - branch if positive
INP - input
OUT - output
HLT - end program
DAT - data location