Objectives: Students should be able to —
- 1 Describe Central Processing Unit (CPU) / Microprocessor.
- 2 Show the understanding of Von Neumann Architecture of computer.
- 3 Identify and describe Arithmetic and Logic Unit (ALU), Control Unit (CU) and Registers.
- 4 Identify and describe Control bus, Address bus and Data bus.
- 5 Show the understanding about Cores, Cache and Internal Clock.
- 6 Describe 'Fetch-Decode-Execute' cycle.
- 7 Describe what is meant by 'Instruction set' for a CPU.
- 8 Describe what is meant by 'Embedded systems'.
Computer Architecture
(a) Describe CPU (Central Processing Unit):
CPU is the brain of the computer, made up of an Integrated circuit built inside a silicon chip called Microprocessor.
The CPU is made up of three main components — the Control Unit, the Immediate Access Store (IAS), and the Arithmetic Logic Unit (ALU).
The Control Unit controls the flow of data between different components using Address-bus, Data-bus and Control-bus; regulates and integrates the operation of the computer.
The Immediate Access Memory is where the CPU holds all the data and programs that it is currently using.
The Arithmetic Logic Unit (ALU) is where the CPU performs all arithmetic and logic operations.
CPU is responsible for the execution of all instructions and processing data.
(b) Explain the purpose of CPU:
The purpose of CPU is to process data and execute all instructions.
- Perform basic arithmetic calculation and logic operations.
- Control all the components of computer and perform input/output (I/O) operations specified by the instructions in the program.
- Fetch each instruction from main memory RAM, decode and execute it sequentially.
(c) Word size of CPU:
The Word size refers to the number of bits a CPU can process at a time (like 8-bit, 16-bit, 32-bit, 64-bit).
The bigger the word size, the better the CPU's performance will be.
(d) System Clock and Clock cycle / speed:
System Clock is an internal clock within the CPU that regulates the timing and speed of execution of instructions, and synchronizes all computer operations.
Clock cycle or speed refers to the number of cycles or instructions a CPU can execute per second. It is measured in MHz (Mega Hertz — 1 million cycles per second) or GHz (Giga Hertz — 1 billion cycles per second).
(e) Computer Register:
A Register is a data-holding place built inside the CPU, extremely faster than main memory RAM.
Registers are of two types — general purpose and special purpose register.
- General purpose register — discrete memory locations within CPU, used to hold data and instruction temporarily which are currently in execution.
- Special purpose register — has a specific data-handling task to carry out (e.g. PC, MAR, MDR, CIR).
(f) Difference between Cache and RAM memory:
- Cache memory is built inside the CPU, extremely faster than main memory RAM.
- Cache memory uses SRAM technology, while RAM uses DRAM technology in general.
- Cache memory stores frequently used instructions and data that need to be accessed faster.
- When a CPU wishes to read memory, it will first check the cache and then move to main memory RAM if the required data isn't there.
- The larger the cache memory size, the better the CPU performance.
(g) Core of the processor:
Core refers to the number of Processing units (CPU) built inside a single Microprocessor.
Each Processing unit has its own Control Unit, ALU, Cache and Registers which can perform all its tasks independently.
- Dual-core processor — contains two CPUs, giving twice the performance of the normal computer. It can process two instructions simultaneously.
- Quad-core processor — contains four CPUs, which divides data for processing by four units.
Multiple cores allow PCs to run multiple processes at the same time with greater ease, increasing its performance.
(a) System Bus:
System Bus is a pathway that carries data using parallel transmission between major components of a computer system.
Bus width refers to the number of bits it carries in parallel simultaneously at a time. The common data bus widths include 8-bit, 16-bit, 32-bit and 64-bit.
The wider the bus width, faster would be the data flow on the bus and thus better system performance.
(b) Three Buses used by the CPU:
★ Address Bus:
- Carries memory location address throughout the computer system, in order to either read data from, or write data to, that memory location.
- Between CPU and main memory (RAM), it is uni-directional (from CPU to main memory only).
- The width of the address bus determines how many unique memory locations can be addressed at a time simultaneously.
Example:
- A bus of width 8-bit can convey 2⁸ = 256 different addresses = 256 bytes of memory.
- A bus of width 16-bit can address 2¹⁶ = 65536 ÷ 1024 = 64 KB of memory.
- A bus of width 32-bit can address 2³² = 4 294 967 296 ÷ (1024 × 1024 × 1024) = 4 GB of memory.
The wider the bus, the more memory a computer can use.
★ Data Bus:
- Data Bus is bi-directional, allowing data to be sent in both directions between CPU and computer memory or input/output devices.
- The width of the data bus determines how many bits of data (i.e. word length) that can be transported at a time.
- The wider the bus, the larger the word-length a computer can transport.
Example:
- A bus of width 8-bit can transfer 1 byte of data per read/write cycle.
- A bus of width 16-bit can transfer 2 bytes of data per read/write cycle.
- A bus of width 32-bit can transfer 4 bytes of data per read/write cycle.
★ Control Bus:
- Control Bus is bi-directional, that carries control signals from Control Unit of CPU to other components and devices connected to the computer. The devices also communicate with CPU using control bus.
- Examples of control signals: memory read/write signals, device interrupt signal and status signals.
- The control bus also carries the clock's pulses of system clock needed to synchronize all the operations of computer.
- It is usually 8-bit wide. Since it only carries control signals, width of the control bus does not affect the performance of CPU.
A computer's performance can be increased by —
- Increasing the Clock speed.
- The use of multi-core microprocessor.
- Increasing the size of Cache memories.
- Increasing the Word size (i.e. increase the width of Address Bus and Data Bus).
A CPU has its own Instruction set, a set of low-level instructions that instructs the CPU how to carry out an operation.
Each instruction is made up of an Opcode (Operation code) and an Operand.
- The Opcode informs the CPU what operation needs to be done.
- The Operands are subjects of the operation, such as data values, registers, or memory addresses.
Example: An instruction table:
| Opcode | Operand | Comment |
|---|---|---|
| MOVE | Y, A | Y ← A |
| SUB | Y, B | Y ← Y − B |
| MOVE | T, D | T ← D |
| MPY | T, E | T ← T × E |
| ADD | T, C | T ← T + E |
| DIV | Y, T | Y ← Y ÷ T |
| LOAD | D | Acc ← D |
| MPY | E | Acc ← Acc × E |
| STOR | Y | Y ← Acc |
Von Neumann Architecture
(a) Von Neumann Architecture:
The Von Neumann architecture is a design model for a stored-program digital computer.
It stores both program and data in the same read-write memory, accessible by its location.
The CPU fetches instruction from main memory RAM, decodes and executes it sequentially called Fetch-Execute cycle.
Its Central Processing Unit (CPU) consists of Memory Unit (Registers), Control Unit and Arithmetic Logic Unit for processing.
(b) Fetch-Execute cycle:
The Fetch-Execute Cycle is a standard cyclic method of processing data by the CPU.
- CPU fetches a single program instruction or data from main memory (RAM) and stores it in a suitable register.
- Determines what CPU has to do by decoding the instruction and carries out those actions sequentially.
- This cycle is repeated continuously by the CPU, from boot-up to when the computer is shut down.
(c) Advantages of Von Neumann Architecture:
- Stores both program and data in the same memory accessible by its location, so no need to have two separate memory.
- No need to have two separate processors to process program and data separately in parallel.
- The Program Counter (PC) contains the address of the next instruction to be fetched.
- The address stored in the Program Counter (PC) is then transferred to the Memory Address Register (MAR).
- The CPU fetches the data or instruction from main memory and loads it in MDR using address in MAR.
- The data or instruction from MDR is then transferred to the Current Instruction Register (CIR).
- The value in PC is incremented by 1 so the CPU gets ready for the next instruction to be fetched.
- Finally the instruction is decoded and executed by passing control signals to the appropriate components of the computer system.
- This process continues from boot-up to when the computer is shut down.
| Register | Function |
|---|---|
| Program Counter (PC) | An incrementing counter that keeps track of the memory address from where the instruction is to be fetched next. |
| Memory Address Register (MAR) | Holds the address of the memory location that needs to be accessed now. |
| Memory Data / Buffer Register (MDR / MBR) | Holds the content of memory location contained in MAR, that is being transferred to or from the main memory. |
| Current Instruction Register (CIR) | Holds the currently fetched instruction while it is decoded and executed. |
| Arithmetic Logic Unit (ALU) | Performs mathematical and logical operations. The register where the data processing is carried out. |
| Accumulator (Acc) | A temporary data-holding place that stores intermediate arithmetic and logical results. |
★ Control Unit:
- Directs the flow of data between CPU and other components of the computer system.
- Sends control signals to control and coordinate the computer activities.
- Fetches each instruction from main memory (RAM), decodes and executes it sequentially.
- Tells the computer memory, ALU and Input/Output devices how to respond to the instruction sent by the processor.
★ ALU (Arithmetic Logic Unit):
- Performs mathematical (add, subtract etc.) and logical (AND, OR, NOT etc.) operations.
- The unit where the data processing is carried out.
- It temporarily holds the result of calculation in a register called Accumulator.
★ Memory Unit:
- MAR (Memory Address Register) and MDR (Memory Data Register) are two registers used by this unit.
- It stores memory location address in MAR and its content in MDR just before passing it to CIR, and other registers within CPU and primary memory RAM.
Cache is a very high-speed temporary memory, built using SRAM technology, placed between RAM and CPU.
- It increases the CPU performance by holding frequently requested data and instruction for immediate use by CPU.
- It is used to speed up and synchronize the main memory RAM with high-speed CPU.
- When the CPU needs to read memory, it will first check the cache and then move to main memory RAM if the required data isn't there.
- It is costlier than main memory RAM but economical than CPU registers.
Given computer memory:
| Address | Content |
|---|---|
| 1000 0000 | 0110 1110 |
| 1000 0001 | 0101 0001 |
| 1000 0010 | 1000 1101 |
| 1000 0011 | 1000 1100 |
| ⋮ | ⋮ |
| 1000 1100 | — |
| 1000 1110 | — |
(a) Read operation — read content of memory location 1000 0001:
MAR holds the address, MDR holds the content at that address.
(b) Write operation — write 0111 1001 into memory location 1000 1110:
MAR holds the address, MDR holds the data to be written.
(c) Computer memory after read and write operations:
Note: Read operation does not change memory contents. Only the write operation changes the content of location 1000 1110 to 0111 1001.
| Address | Content |
|---|---|
| 1000 0000 | 0110 1110 |
| 1000 0001 | 0101 0001 |
| 1000 0010 | 1000 1101 |
| 1000 0011 | 1000 1100 |
| ⋮ | ⋮ |
| 1000 1100 | — |
| 1000 1110 | 0111 1001 ✓ (newly written) |
- Data from main memory RAM is fetched and stored in MDR.
- Data from MDR is sent to ALU to be processed.
- ALU performs mathematical calculation and logical operation on the data.
- ALU has an in-built register called Accumulator where the intermediate result of the calculation is stored.
- After calculation, ALU sends data back to MDR from where it is sent back to the RAM.
Embedded Systems
(a) Embedded system — describe with example:
An embedded system is a microcontroller or microprocessor-based hardware system with embedded software designed to do only some specific tasks.
It is capable of performing its task either independently, or by being a part of a larger system.
Embedded software is called firmware, which is stored in ROM that tells the microcontroller how to respond to the data provided to it.
Examples:
- Electronic Calculator
- Digital Watch
- Domestic home appliances — TV, Electric Oven, Dishwasher, Home Theater (Sound system)
- ATM and Vending machines
- Central heating systems
- Engine management system in vehicles
- GPS System
(b) Difference between Microprocessor and Micro-controller:
| Microprocessor | Micro-controller |
|---|---|
| Contains only the processing unit (CPU). | Contains a CPU + ROM + RAM + I/O ports all integrated into a single chip. |
| Needs extra hardware chips (ROM, RAM) fixed on the motherboard with different I/O ports for peripheral devices. | Can be used stand-alone. |
| Powerful and complex — used for general purpose computing. | Used for dedicated / specific tasks. |
(c) How an Embedded System works:
- It takes the analogue/digital input, automatically from sensors or by user through suitable input devices, and sends it to the microcontroller.
- ADC (Analogue to Digital Converter) is used to convert the sensor's analogue data to digital.
- Embedded software tells the microcontroller how to respond to the data provided to it, managing output devices to produce the expected result.
- DAC (Digital to Analogue Converter) is used to convert digital data into analogue signals for Actuators to do some mechanical work if needed.
(d) Four features of embedded systems:
- Performs one or very few dedicated tasks.
- Uses embedded software, doesn't need any operating system.
- Cannot be changed or upgraded by the user.
- Could perform its task either independently or by being a part of a larger device/system.
- Built to do the same task repeatedly or continuously with little or no human intervention (e.g. a fully automatic washing machine).
- Performs the task within a certain time frame (e.g. a car's brake system; if it exceeds the time limit, may cause accidents).
- Small sized, consume less power and are not too expensive.
- Household Appliances — Home Security system, Setup Box, Digital Camera, Television, Microwave Oven, Air conditioning, Refrigerator, etc.
- Electronic devices at Offices / Network Communication — Printer, Photocopy machine, Router, Modem, etc.
- Healthcare (medical equipment) — Heartbeat monitors, Tele-supervision, CT/MRI Scanners, Ventilators, etc.
- Automobiles — Anti-lock Braking System (ABS), Air conditioning control, Ignition control, Airbag control, Rain-sensing wipers, etc.
- Industrial applications — Robots, 3D Printing machines, 3D Cutters, Security system, etc.
- Aerospace and Defense — Flight Control system, Navigation system, Air and Thermal Management, etc.
Benefits:
- They are small in size and therefore easy to fit into devices.
- They are cheap (low cost) to make.
- They consume very little power.
- Usually dedicated to one or very few tasks with simple interfaces. Often don't require any Operating System.
- They are convenient for mass production with low output cost.
Drawbacks:
- Once configured, these systems cannot be changed.
- Troubleshooting is difficult for embedded systems.
- Due to the difficulty in upgrading and fault finding, devices are often just thrown away rather than being repaired.
- Hardware capability is limited, because they are made to do some specific tasks.
(a) Tasks controlled by the embedded system in a digital camera:
- Operate the flash automatically.
- Focus the image automatically.
- Adjust the shutter speed automatically.
- Adjust the aperture size automatically.
(b) Applications where a digital camera could be used:
- Photography and Video shoots for personal use — take pictures or videos, check instantly and retake if necessary. Store in solid-state memory for later use.
- Verify the identity of a passenger at the airport — take a picture of the passenger and compare it with the scanned image or image stored in the database.
- Webcam for video conferencing over the internet.
- CCTV / Security camera for surveillance purposes.
- Produce 360° image of the surroundings for Virtual Reality.
- Produce 3D image of an object.
(a) Inputs and outputs of the embedded system:
Inputs:
- Game console receives input about the position and movement of the object from sensors, and commands from player through input devices like steering wheel, push of a button, or twist of the control stick (joystick).
- Embedded Accelerometers measure acceleration and deceleration and respond to the twist of control stick to move a character or object forward/backward and side to side.
- Proximity sensors used in smart touch pads with electrodes (control stick) can detect the movement of hand/finger to select and interact with the character or objects on screen.
Outputs:
- Embedded accelerometers and proximity sensors together with microcontroller allow human to interact with the game, simulate real-time events to give an immersive gaming experience.
(b) Updating device software without sending back to manufacturer:
- Embedded systems can be connected to the internet and the latest version of the device software could be updated from the manufacturer's website automatically.
- Automatic updates could also be received by plugging the device into a computer and updating the software over its internet connection via cellular network, WiFi or Bluetooth.
- New games could be downloaded and stored in the device SSD memory from the website.
- The player can play new games by inserting the memory stick in the games console, loading it into its main memory (RAM) and executing it by its microcontroller.
Revision: Statements and Key Computing Terms
| Key Term | Definition |
|---|---|
| Central Processing Unit (CPU) | Responsible for the execution or processing of all the instructions and data in a computer. |
| Integrated Circuit | Usually a chip made from a semi-conductor material which carries out the same tasks as a larger circuit made from individual components. |
| Von Neumann architecture | A type of computer architecture which introduced the concept of the stored program in the 1940s. |
| Arithmetic & Logic Unit (ALU) | The component of the CPU that carries out all arithmetic and logical operations. |
| Accumulator (Acc) | Temporary general purpose register that stores numerical values at any part of a given operation. |
| Memory Address Register (MAR) | A register that stores the address of the memory location currently being read from or written to. |
| Current Instruction Register (CIR) | A register that stores the current instruction being decoded and executed. |
| Memory Data Register (MDR) | A register that stores data that has just been read from memory or data that is about to be written to memory. |
| Program Counter (PC) | A register that stores the address where the next instruction to be read can be found. |
| Control Unit | The component of a computer's CPU that ensures synchronisation of data flow and programs throughout the computer by sending out control signals along the control bus. |
| System Clock | Produces timing signals on the control bus to ensure synchronisation takes place. |
| Clock cycle | Clock speeds are measured in terms of GHz; this is the vibrational frequency of the system clock which sends out pulses along the control bus — e.g. a 3.5 GHz clock cycle means 3.5 billion clock cycles a second. |
| Immediate Access Store (IAS) | Memory that holds all data and programs needed to be accessed by the control unit. |
| Backing store | A secondary storage device (such as HDD or SSD) used to store data permanently even when the computer is powered down. |
| Cache | Temporary memory using static RAM to hold frequently used data/instructions by the CPU thereby increasing CPU performance. More generally, cache means any area of storage used to quickly access frequently used data — other examples include web cache, database cache, DNS cache. |
| Register | A temporary component in the CPU which can be general or specific in its use; it holds data or instructions as part of the Fetch-Decode-Execute cycle. |
| Address | A label for a memory location used by the CPU to track data. |
| Memory location | A numbered place in memory where values can be stored. |
| System buses | A connection between major components in a computer that can carry data, addresses or control signals. |
| Address bus | The system bus that carries the addresses throughout the computer system. |
| Data bus | The system bus that allows data to be carried from CPU to memory (and vice versa) or to and from input/output devices. |
| Control bus | The system bus that carries signals from control unit to all other computer components. |
| Word | A group of bits used by a computer to represent a single unit; e.g. modern computers often use 64-bit word length. |
| Over Clocking | Changing the clock speed of a system clock to a value higher than the factory / recommended setting. |
| Core | A unit on a CPU made up of an ALU, Control Unit and Registers; a CPU may contain a number of Cores. Dual Core — a CPU containing two Cores. Quad Core — a CPU containing four Cores. |
| Fetch-Decode-Execute cycle | A cycle in which instructions and data are fetched from memory, decoded and finally executed. |
| Opcode | A part of a machine code instruction that identifies what action the CPU has to perform. |
| Operand | A part of a machine code instruction that identifies what data is to be used. |
| Instruction set | The complete set of machine code instructions used by a particular microprocessor. |
| Embedded System | A combination of hardware and software designed to carry out a specific set of functions. |