Chapter 5 & 6
Chapter 5 & 6
o Von Neumann realized data & programs are indistinguishable and can, therefore, use the
same memory.
Registers: smallest unit of storage of microprocessor; allows fast data transfer between other
registers
o Used to temporarily store data values which have been read from memory or some
processed result
Program Counter (PC): holds the address of the next instruction to be fetched
Memory Data Register (MDR): holds data value fetched from memory
Memory Address Register (MAR): Holds the address of the memory cell of the program
which is to be accessed
Accumulator (ACC): holds all values that are processed by arithmetic & logical operations.
Current Instruction Register (CIR): Once program instruction is fetched, it is stored in CIR
Status Register: holds results of comparisons to decide later for action, intermediate and
o Arithmetic and Logic Unit (ALU): part of the processor that processes instructions which
o Control Unit (CU): part of the CPU that fetches instructions from memory, decodes them &
synchronizes operations before sending signals to the computer’s memory, ALU and I/O
o Immediate Access Store (IAS): memory unit that the processor can directly access
o System Clock: a timing device connected to a processor that synchronises all components.
Buses
o set of parallel wires that allow the transfer of data between components in a computer
system
Data bus: bidirectional bus that carries data instructions between processor, memory, and
I/O devices.
Address bus: unidirectional bus that carries the address of the main memory location or
input/output device about to be used, from processor to memory address register (MAR)
o Control bus
Bidirectional
used to transmit control signals from the control unit to ensure access/use of data & address
o Clock Speed
number of pulses the clock sends out in a given time interval, which determines the number
If the clock speed is increased, then the execution time for instructions decreases. Hence,
However, there is a limit on clock speed since the heat generated by higher clock speeds
o Bus Width
Increasing bus width increases the number of bits transferred simultaneously, increasing
o Cache Memory
Commonly used instructions are stored in the cache memory area of the CPU.
If the cache memory size is increased, more commonly executed instructions can be stored,
and the need for the CPU to wait for instructions to be loaded reduces. Hence, the CPU
o Number of Cores
Most CPU chips are multi-core — have more than one core (essentially a processor)
computer performance.
Ports
o Hardware which provides a physical interface between a device with CPU and a peripheral
device
o Peripheral (I/O) devices cannot be directly connected to the CPU, hence connected through
ports.
o Universal Serial Bus (USB): Can connect both input and output devices to the processor
Can only connect output devices (e.g. LCD) to the processor through a HDMI port
By Ms Payal Gupta
HDMI cables transmit high-bandwidth and high-resolution video & audio streams through
HDMI ports
Can only connect output devices (e.g. second monitor/display) to the processor through a
VGA port
VGA ports allow only the transmission of video streams but not audio components
o Fetch stage
PC is incremented
o Decode stage: The opcode and operand parts of instruction are identified
o Execute stage: Instructions executed by the control unit sending control signals
MAR ← [PC]
PC ← [PC] + 1
MDR ← [[MAR]]
CIR ← [MDR]
Decode
Execute
Return to start
Double square brackets: CPU is getting value stored at the address in the register
Interrupts
o The processor checks the interrupt register for interrupt at the end of the F-E cycle for the
current instruction
o If the interrupt flag is set in the interrupt register, the interrupt source is detected
All contents of registers of the running process are saved on the stack
Once ISR is completed, the processor restores the registers’ contents from the stack, and
Assembly Language
Assembly language: low-level programming language with instructions made up of an op
Machine code: code written in binary that uses the processor’s basic machine operations
instruction (source code) translates into exactly one machine code instruction (object code)
Symbolic addressing
Assembler
o Software that changes assembly language into machine code for the processor to
understand
By Ms Payal Gupta
o The assembler replaces all mnemonics and labels with their respective binary values (that
o Assembler converts mnemonic source code into machine code in one sweep of program
Symbol table created to enter symbolic addresses and labels into specific addresses
Addressing
Data Movement
Arithmetic
Operations
By Ms Payal Gupta
Comparing
Conditional Jumps
Unconditional
Jumps
I/O Data
Ending
B denotes a binary number, e.g. B01001010 & denotes a hexadecimal number, e.g.
&4A
Modes of Addressing
o Indirect Addressing: The address to be used is at given address. Load contents of this
o Relative addressing: next instruction to be carried out is an offset number of locations away,
relative to address of current instruction held in PC; allows for relocatable code
o Conditional jump: has a condition that will be checked (like using an IF statements)
specified
Bit Manipulation
Binary numbers can be multiplied or divided by shifting
Arithmetic shift: Used to carry out multiplication and division of signed integers represented
by bits in the accumulator by ensuring that the sign-bit (usually the MSB) is the same after
the shift.
Cyclic shift: the bit that is removed from one end by the shift is added to the other end.
Bit Masking
By Ms Payal Gupta
Masking: an operation that defines which bits you want to keep and which bits you want to
clear.
Matching: an operation that allows the accumulator to compare the value it contains to the
Mask the content of the register with a mask pattern which has 0 in the ‘mask out’ positions
Set the result with the match pattern by using the AND command with a direct address.
Mask the content of the register with a mask pattern which has 0 in the ‘mask out’ positions
Compare the result with the match pattern by using the CMP command or by “Checking the
pattern”.
The final ‘non-zero’ result confirms the patterns are not the same else vice versa.