Computer Science
Teacher: Maruf Ahmed
Chapter 3 (Hardware)
Computer Architecture and Embedded System
Von Neumann Architecture:
Von Neumann architecture was first published by John von Neumann in 1945. His computer architecture
design consists of a Control Unit, Arithmetic and Logic Unit (ALU), Memory Unit (RAM), Registers and
Inputs/Outputs.
Von Neumann architecture is based on the stored-program computer concept, where instruction data and
program data are stored in the same memory. This design is still used in most computers produced today.
Von Neumann Architecture Diagram:
Stored program concept when applied to the Von Neumann model:
• The program is stored on a secondary storage device
• Data and instructions are moved to primary memory / RAM
• Data and instructions are stored in the same memory / RAM
• Data and instructions are moved to registers to be executed
• Instructions fetched and executed one at a time in order
Central Processing Unit (CPU):
- The Central Processing Unit (CPU) is the electronic circuit responsible for the execution or
processing of all the instructions and data in a computer application
- It is also referred to as the microprocessor or processor
- The CPU is very often installed as an integrated circuit on a single microchip
- The CPU contains the Arithmetic Logic Unit (ALU), the Control Unit (CU) and a variety of registers
IC: An integrated circuit (IC), also known as a microchip or simply chip, is a set of electronic circuits,
consisting of various electronic components (such as transistors, resistors, and capacitors) and their
interconnections.
Microchip: A microchip is a generic term for a small, sealed package containing a circuit, often an IC.
Microprocessor: This refers to a CPU that is implemented on a single IC chip.
Difference between CPU and microprocessor: a microprocessor is a CPU built into a single chip, while the
CPU is the general function of processing instructions within a computer. While all CPUs are
microprocessors, not all microprocessors are CPUs. For instance, a microcontroller is a microprocessor,
but it's not a CPU because it's designed for specific embedded systems applications, not general-purpose
computing
Control Unit (CU):
- The control unit controls the operation of the computer’s ALU, memory and input/output devices,
telling them how to respond to the program instructions it has just read and interpreted from the
Page 1 of 9
memory unit.
- The control unit ensures synchronisation of data flow and program instructions throughout the
computer
- The control unit also provides the timing and control signals required by other components to
synchronize the Fetch-Decode-Execute (FDE) cycle.
- Different types of signals produces are for example, clock signals, read/write signals, interrupt
requests, and reset signals
- The control unit has Current Instruction Register, control signals, control bus, clock signals etc. in it
Functions / Purpose of the control unit (CU):
- It sends signals to other components telling them “what to do”
- It sends and receives control signals along the control bus that manage the transfer of data and
instructions within the CPU
- Reads an instruction from the contents of the memory location whose address is stored in PC
- It sends timing signals to other components to synchronize the FDE cycle
- It fetches each instruction in turn
- It manages execution of each instruction in sequence
- It decodes/interprets an instruction using an instruction set
- Controls communication between the components in the CPU
- Coordinates/synchronises the activity of other components in the CPU
Arithmetic and Logic Unit (ALU):
- This is the place in the processor where all the arithmetic and logical operations are performed.
- Arithmetic operations such as addition, subtraction, multiplication, division, shifting etc. and logical
operations such as greater than, less than, and, or, not etc.
- It has Accumulator in it
Memory Unit / Primary memory:
- The memory unit consists of Random Access Memory or RAM, also referred to as primary or main
memory.
- Unlike a hard drive or any other secondary memory (secondary memory also known as storage
devices or backing store), this memory is fast and also directly accessible by the CPU.
- This memory is known as a volatile (stores data as long as the computer is on) memory and it holds
data/instructions that are currently in use.
RAM is split into two partitions. Each partition consists of an address and its contents (both in binary
form). The address will uniquely identify every location in the memory. Loading data from permanent
memory (such as hard drive), into the faster and directly accessible temporary memory (RAM), allows the
CPU to operate much quicker.
Page 2 of 9
Let us now consider two examples of how the MAR and MDR registers can be used when carrying out a
read and write operation to and from memory:
First, consider the READ operation. We will use the memory section shown in Table 3.2. Suppose we want
to read the contents of memory location 1111 0001; the two registers are used as follows:
• the address of location 1111 0001 to be read from is first written into the MAR (memory address
register):
• a ‘read signal’ is sent to the computer memory
• the contents of memory location 1111 0001 are then put into the MDR (memory data register):
Now let us now consider the WRITE operation. Again, we will use the memory section shown in Table 3.2.
Suppose this time we want to show how the value 1001 0101 was written into memory location 1111 1101:
• the data to be stored is first written into the MDR (memory data register):
• this data has to be written into location with address: 1111 1101; so this address is now written into
the MAR:
• finally, a ‘write signal’ is sent to the computer memory and the value 10010101 will then be written
into the correct memory location.
Input and output devices:
• They are the main method of entering data into and getting data out of computer systems.
• Input devices convert external data into a form the computer can understand and can then process
(e.g. keyboards, touch screens and microphones).
• Output devices show the results of computer processing in a human understandable form (e.g.
Page 3 of 9
printers, monitors and loudspeakers).
Immediate Access Store (IAS):
- The memory area where the CPU (Central Processing Unit) directly accesses data and instructions
for processing.
- When data and instructions are loaded from backing store / secondary storage to the primary memory
then RAM is known as Immediate Access store.
- Registers are also known as immediate access store because it holds data and instructions when they
are loaded from main memory and are waiting to be processed.
System buses / Buses:
- System buses are used in computers as parallel transmission components; each wire in the bus
transmits one bit of data. There are three common buses used in the Von Neumann architecture
known as: address bus, data bus and control bus.
- Buses are used as communication pathways between components. These are the means by which
data is transmitted from one part of a computer to another, connecting all major internal components
to the CPU and memory.
Type of bus Description of bus Data/signal direction
Unidirectional; (bits can travel in one
• Carries/transports an address of the next item to
direction only) because the
be fetched
microprocessor addresses a specific
• Carries the addresses of data (but not the data)
Address Bus memory location and is designed to
between the processor and memory
carry addresses from the processor to
• Transmits / carries addresses between other components, not the other way
components in the CPU around.
• Carries/transports data that is currently being Bi-directional; (allowing data to be
processed /that will be / has been processed sent in both directions along
• Carries data between the processor, the memory the bus) data can travel in both
unit and the input/output devices directions because the Microprocessor
Data Bus
• Transmits / carries data between components in can read data from memory or write
the CPU data to the memory)
• Is used to exchange data between processor,
memory and input/output devices
• Carries/transports signals such as control signal, Bi-directional (signals travel in both
timing signal, read/write signal, interrupt signal directions. It is responsible for both
etc. issuing commands from the CPU and
• Carries timing signals to other components to receiving responses or signals from
Control Bus other components, like memory or I/O
synchronise the FDE cycle
• Carries control signals/commands from the CPU devices)
in order to control and coordinate all the
activities within the computer
Word / Word size:
- A number of bits that can be handled as a unit by the computer system.
- A word is a group of bits which can be regarded as a single unit, for example, 16-bit, 32-bit or 64-bit
word lengths are the most common.
Cache memory:
- Cache memory is a small amount of memory which is a part of the CPU - closer to the CPU than
RAM.
- It is used to temporarily hold instructions and data that the CPU is likely to reuse frequently.
- The CPU control unit automatically checks cache for instructions before requesting data from RAM.
These saves fetching the instructions and data repeatedly from RAM – a relatively slow process
which might otherwise keep the CPU waiting.
- Transferring data to and from cache takes less time than transferring to and from RAM.
System Clock / CPU clock:
- System clock is used to produce timing signals on the control bus to ensure that the synchronisation
takes place between the components.
Page 4 of 9
- The system clock generates regular electronic pulses, or ticks, that set the operating pace of
components of the system unit.
The roles carried out by System clock / purpose of the system clock:
• The system clock generates the timing signals and synchronise operations by creating timing signals
• the system clock synchronises all the components on the motherboard
• keeps track of the date and time / timestamp files to process operations in the correct order /
sequence
Clock speed:
- The maximum number of FDE cycles/instructions a CPU can perform/process/execute in a second
- The system clock defines the clock cycle that synchronises all computer operations
- The pace of the system clock, called the clock speed, is measured by the number of ticks per second.
Current personal computer processors have clock speeds in the gigahertz range. Giga is a prefix that stands
for billion, and a hertz is one cycle per second. Thus, one gigahertz (GHz) equals one billion ticks of the
system clock per second.
Scenario based question:
The computer has a Control Unit (CU), system clock and control bus.
Explain how the CU, system clock and control bus operate to transfer data between the components of the
computer system.
• The system clock gives out timing signals which are sent on the control bus to synchronise the other
system components
• The Control Unit initiates data transfer by generating signals that are sent on the control bus to other
components
State what is meant by a 3.5GHz processor
- It can run 3.5 billion FE cycles each second // it can execute 3.5 billion instructions each second
Overclocking (increasing the clock speed beyond its factory-defined settings):
The clock speed can be changed by accessing the BIOS (Basic Input/Output System) and altering the
settings. However, using a clock speed higher than the computer was designed for can lead to problems, for
example:
• execution of instructions outside design limits can lead to seriously unsynchronised operations (i.e.
an instruction is unable to complete in time before the next one is due to be executed) – the computer
would frequently crash and become unstable
• overclocking can lead to serious overheating of the CPU again leading to unreliable performance.
Registers:
- Registers are high speed but very small temporary storage areas in the CPU
- They hold data or address or instructions temporarily when they are being processed
- All data must be stored in a register before it can be processed
Role of a register in a CPU:
- To store / hold data / address / instruction temporarily
- Holds data or instructions temporarily when they are being processed
The following five registers are used for completing an instruction cycle or FDE cycle.
Short form of
Full form Function
the register
Contains the address of the next instruction to be
PC Program Counter
fetched/processed/executed
Stores addresses of next instruction/data to be fetched or
MAR Memory Address Register
where data is to be written to
• Stores data/instruction that is in use from address in
MAR
Memory Data Register / • Stores data that has been fetched/to be written to
MDR (MBR)
Memory Buffer Register memory. It acts as a temporary buffer for data during
memory read and write operations within the fetch-
decode-execute cycle
Current Instruction • Contains the current instruction during processing
CIR
Register • Stores the current instruction being decoded and
Page 5 of 9
executed
• Holds intermediate (interim) arithmetic and logic results
during ALU calculations
ACC Accumulator
• Holds data temporarily that is currently being used in
ALU calculations
Instruction cycle / Fetch-Decode-Execute (FDE) Cycle:
- The fetch-decode-execute cycle is the basic operation (instruction) cycle of a computer. During the
fetch-decode-execute cycle, the computer retrieves a program instruction from its memory. It then
establishes and carries out the actions that are required for that instruction.
- The cycle of fetching, decoding and executing an instruction is continually repeated by the CPU
whilst the computer is turned on.
F-D-E (Fetch-Decode-Execute) cycle:
• The PC contains the address of the memory location that has the next instruction which has to be
fetched
• This address is then copied from the PC to the MAR via the address bus
• The value in the PC is then incremented by 1 so that it now points to the next instruction which has
to be fetched
• The contents (instruction) at the memory location (address) contained in MAR are then copied into
the MDR via data bus
• The contents (instruction) in the MDR is then copied and placed into the CIR via data bus
• The processor’s instruction set is used to decode the instruction
• The processor executes the instruction by sending out signals (via control bus) to the various
components of the computer
Scenario based question:
The laptop has a central processing unit (CPU) that performs the fetch–decode–execute cycle.
The CPU has several components, including the memory data register (MDR) and the arithmetic logic unit
(ALU).
Describe how the MDR and the ALU are used in the fetch–decode–execute cycle.
• Data fetched from RAM is stored in the MDR
• Data from MDR is sent to ALU to be executed
• ALU performs calculation and logical operations on data
• ALU has a built-in register, Accumulator where it stores interim results of calculations
• After calculations, ALU sends data to MDR
• Data is sent from MDR to be written to RAM
Instruction sets:
- A list of machine code commands that can be processed by the CPU
- Every different type of computer/chip has its own set of machine code instructions. Instruction sets
are the low-level language instructions that instruct the CPU how to carry out an operation.
- The structure of assembly language and machine code instructions is the same.
- Each instruction has an opcode that identifies the operation to be carried out by the CPU. Most
instructions also have an operand that identifies data which needs to be acted on or it can refer to a
register in the memory.
Page 6 of 9
Machine code instruction: A binary code with a defined number of bits that comprises an opcode and,
most often, one operand. Machine code consists of a sequence of instructions.
Opcode: Defines the action associated with the instruction
Operand: Defines any data needed by the instruction. An instruction may have zero or up to 3 operands
Improving CPU performance:
There are some key factors about CPU architecture that affect its performance:
• number of cores (processing units)
• cache memory size
• clock speed
• bus width
• RAM capacity
Increase number of cores:
• One core is made up of an ALU, a control unit and the registers
• Each core processes one instruction per clock pulse
• More/multiple cores mean that sequences of instructions can be split between them and so more than
one instruction is executed per clock pulse // more sequences of instructions can be run at the same
time
• More cores decrease the time taken to complete task
Purpose of a core in a CPU:
- to carry out a fetch-decode-execute cycle
- to process an instruction
Purpose of a dual core in a CPU:
- It can process two instructions simultaneously (where suitable) thus increases the performance
Effect of more cores in a CPU:
- It may increase the performance because more instructions can be processed simultaneously
Increase clock speed:
• The faster the clock speed the more FDE cycles / instructions can be processed per second
Increase cache memory:
• the higher the capacity of the cache memory, the more numbers of frequently used data can be stored
which helps fast access as the processor does not need to go to RAM for the same data again
Increase bus width:
Data bus width:
• the width of the data bus determines the number of bits that can be simultaneously transferred
• increasing the width of the data bus increases the number of bits/amount of data that can be moved at
one time (or equivalent) hence improving processing speed as fewer transfers are needed
• For example: double the width of the data bus moves 2x data per clock pulse
Address bus width:
• determines how many memory locations can be directly accessed by the processor.
• the more the bus width of the address bus the more memory location can be directly accessed.
Page 7 of 9
State the benefit of increasing the address bus width from 16 bits to 32 bits.
• Significant increase in the number of directly addressed memory locations // increases the number of
directly addressable memory locations from 216 to232
Increase RAM capacity:
• allowing more applications to reside in memory at the same time, saving disk access times
Embedded Systems:
- An embedded system is a combination of hardware and software which is designed to carry out a
specific set of functions.
- a microprocessor-based computer hardware system with software that is designed to perform a
dedicated function, either as an independent system or as a part of a large system.
- This is used to perform a dedicated function, e.g., domestic appliances such as washing machine,
microwave ovens, freezer, refrigerator, cars, security systems, lighting systems, vending machines
etc.
Characteristics of embedded system:
• Performs a single/limited/dedicated function/task
• It has a microprocessor
• It has dedicated hardware
• It runs on firmware
• It is normally built into a larger device/system
• User normally cannot reprogram
• It does not require much power
• It is cheap to manufacture
• Works automatically // works without human intervention
• It is small in size
• it does not have additional peripherals
• It is a real-time system
Important features of embedded system:
• The embedded system is built into / integrated into a larger system. For example, TV, car alarm,
washing machine etc.
• It is a combination of hardware and software designed for a specific function
• The system is not easily changed/updated by the owner
Embedded systems can be based on:
Microprocessor: integrated circuit which only has a CPU on the chip (there is no RAM, ROM or
peripherals – these need to be added)
Microcontrollers: this has a CPU in addition to some RAM and ROM and other peripherals all embedded
onto one single chip (together they carry out a specific task)
System on chips (SoC): this may contain a microcontroller as one of its components (they almost always
will include CPU, memory, input/output (I/O) ports and secondary storage on a single microchip)
Examples of the use of embedded systems:
- Motor vehicles, Set-top box, Security systems, Lighting systems, Vending machines, cars,
- Many ‘white goods’ (such as freezer, refrigerators, washing machines, microwave ovens, and so on)
Benefits of embedded system:
- they are small in size and therefore easy to fit into devices
- compared to other systems, they are relatively low cost to make
- they are usually dedicated to one task allowing simple interfaces and often no requirement for an
operating system
- they consume very little power
- they can be controlled remotely using a mobile phone, for example
- very fast reaction to changing input (operate in real time and are feedback orientated)
Drawbacks of embedded system:
• It is difficult to change / update the firmware by the user
• Errors cannot be fixed easily // Troubleshooting / fault-finding / repairing is a specialist task /
expensive
Page 8 of 9
• Functionality cannot be changed/extended easily // Cannot be easily adapted for another task
• Faulty / outdated devices are often thrown away rather than repaired leading to e-waste
Scenario based question:
Kiara has a washing machine and a refrigerator. She has an embedded system in her washing machine.
Describe what is meant by an embedded system, using the washing machine as an example
Definition: Microprocessor/microcontroller-based system within a larger system // microprocessor /
microcontroller that performs one specific task
Example: e.g., Embedded system in washing machine only controls the programs for the washing cycle // it
is part of the washing machine but does not perform any other function within it
The washing machine’s embedded system makes use of both Random Access Memory (RAM) and Read
Only Memory (ROM).
State the purpose of RAM and ROM within the washing machine’s embedded system
RAM:
- Stores the choices/wash program the user has entered
- stores the data read from the sensors
- stores the time left in the program
ROM:
- Stores the start-up instructions (for the washing cycles)
Scenario based question:
Many modern televisions are examples of embedded systems.
Explain why these televisions are embedded systems.
• The embedded system is built into / integrated into the TV
• Television is a combination of hardware and software designed for a specific function
• The system is not easily changed/updated by the TV owner
How does embedded system differs from general purpose computer
• Embedded systems are specialized computers designed for a specific task, often embedded within a
larger device, while general-purpose computers are versatile systems capable of handling a wide
range of applications.
Meaning of embedded within a larger system:
A computer system or device is built into a bigger system or machine for a specific purpose, but not as the
main system itself. These embedded systems control the larger device's functions and can range from simple
to complex.
Page 9 of 9