DATA REPRESENTATION | FUNCTIONS OF THE CPU
DESIGNED FOR IB EXAMINATIONS
OBJECTIVES
A1.1.1 Describe the functions and interactions of the main CPU components.
A1.1.1 Describe the functions and interactions of the main CPU components.
- Units: arithmetic logic unit (ALU), control unit (CU)
- Registers: instruction register (IR), program counter (PC), memory address register (MAR), memory data register (MDR), accumulator (AC)
- Buses: address, data, control
- Processors: single core processor, multi-core processor, co-processors
- A diagrammatic representation of the relationship between the specified CPU components
The Central Processing Unit (CPU) is the main component of a computer that performs most of the processing. It retrieves instructions from memory, decodes and executes them, and manages the flow of data in and out of the computer. The CPU is responsible for carrying out basic arithmetic, logical, and input/output operations and acts as the "brain" of the computer, making decisions based on the instructions it receives.
The role of the CPU in a computer can be described as follows:
In conclusion, the CPU plays a crucial role in a computer by executing instructions, controlling operations, performing arithmetic and logical operations, storing temporary data, and operating at a specific clock speed.
MICRO PROCESSOR
A microprocessor is a compact integrated circuit that contains the central processing unit (CPU) of a computer or other device. It is responsible for executing instructions and performing operations on data, making it the "brain" of the device. A microprocessor combines the functions of the CPU, memory, and I/O interfaces onto a single chip, making it more cost-effective and efficient than a traditional CPU. Microprocessors can be found in a wide range of devices, including computers, smartphones, appliances, and vehicles.
The role of the CPU in a computer can be described as follows:
- Instruction Execution: The CPU fetches instructions from memory, decodes them, and then executes the instructions by performing mathematical and logical operations.
- Control Unit: The CPU controls the flow of data and operations in the computer by managing the input/output devices and coordinating the activities of other components.
- Arithmetic Logic Unit: The CPU performs arithmetic operations like addition, subtraction, and multiplication, and logical operations like comparisons and decision making.
- Registers: The CPU stores temporary data in its registers for quick access during execution.
- Clock Speed: The CPU operates at a certain clock speed, which determines how many instructions it can execute per second. A higher clock speed results in faster processing.
In conclusion, the CPU plays a crucial role in a computer by executing instructions, controlling operations, performing arithmetic and logical operations, storing temporary data, and operating at a specific clock speed.
MICRO PROCESSOR
A microprocessor is a compact integrated circuit that contains the central processing unit (CPU) of a computer or other device. It is responsible for executing instructions and performing operations on data, making it the "brain" of the device. A microprocessor combines the functions of the CPU, memory, and I/O interfaces onto a single chip, making it more cost-effective and efficient than a traditional CPU. Microprocessors can be found in a wide range of devices, including computers, smartphones, appliances, and vehicles.
VON NEUMANN MODEL
Whilst there are many different types of computer architecture in current technology, John von Neumann was a pioneer of the principle that modern processors follow. This section closely relates to the basic Von Neumann concept of CPU architecture.
THE SYSTEM BUS
The system bus refers to the method in which data and signals are transferred throughout a computer system. Data travels through various medium such as cables, ribbons and tracks on a circuit board. Where processor fundamentals are concerned there are three different Bus systems each with their own purpose.
THE ADDRESS BUS
The address bus, as its name suggest simply carries an address. This address is the address(location) that needs to be accessed from the memory. If we think of the memory as being like a very large spreadsheet containing thousands of cells and each cell has its own unique address. The address bus carries the address location of a specific cell within the memory to be accessed. Earlier computers had address buses that were only 8 wires wide, this only allowed the machine to transfer 1 byte (8 bits) at a time, which limited the maximum amount of address locations that could be represented to 256 locations (with 1 byte we can represent between 0 and 255), so adding more that 256 memory locations to an 8 bit computer would have been very inefficient.
Many modern computers are 64 bit, meaning the address bus is 64 wires wide, allowing address locations of between 0 and 18,446,744,073,709,551,615 (18 Quintillion) to be accessed in a single request, although modern computers may not contain this amount of memory locations.
The Address Bus is unidirectional, meaning it is a one way system and only carries the location of the address to be accessed from the processor to the memory, the data from that memory location is then transfers through the Data Bus.
THE DATA BUS
THE Data Bus is bi-directional (meaning that data can flow two ways) and is responsible for transporting data between the memory, the processor and and I/O (input/output) devices. The size of the Data Bus varies between machines, however it is efficient to have a Data Bus at least equivalent to the size of a Word. A word is the number of bytes that the system will handle in one go, for example 16, 32 or 64 bits. If the computer system uses 64 bits as a word and the Data Bus is only 32 wires wide, then the word would need to be transmitted through the data bus as 2 separate signals, thus making it inefficient. The size of the Data Bus does not need to be the same size as the Address Bus.
THE CONTROL BUS
The Control Bus is bi-directional (meaning that data can flow two ways) and is responsible for transmitting signals between various components. The Control Bus is generally only 8 wires wide as it carries signals rather than larges combinations of data representations. It is primarily tasked with carrying timing signals from the system clock, aiding the synchronisation of tasks.
The clock speed is a major factor in determining the overall speed of the computer, it can be seen that on every tick of the clock an action is performed, the more times per second the clock ticks the more actions are performed.
As can be seen in the system bus diagram the Data Bus is not directly connected to any input or output devices, it is connected to a separate I/O interface or device controller.
The address bus, as its name suggest simply carries an address. This address is the address(location) that needs to be accessed from the memory. If we think of the memory as being like a very large spreadsheet containing thousands of cells and each cell has its own unique address. The address bus carries the address location of a specific cell within the memory to be accessed. Earlier computers had address buses that were only 8 wires wide, this only allowed the machine to transfer 1 byte (8 bits) at a time, which limited the maximum amount of address locations that could be represented to 256 locations (with 1 byte we can represent between 0 and 255), so adding more that 256 memory locations to an 8 bit computer would have been very inefficient.
Many modern computers are 64 bit, meaning the address bus is 64 wires wide, allowing address locations of between 0 and 18,446,744,073,709,551,615 (18 Quintillion) to be accessed in a single request, although modern computers may not contain this amount of memory locations.
The Address Bus is unidirectional, meaning it is a one way system and only carries the location of the address to be accessed from the processor to the memory, the data from that memory location is then transfers through the Data Bus.
THE DATA BUS
THE Data Bus is bi-directional (meaning that data can flow two ways) and is responsible for transporting data between the memory, the processor and and I/O (input/output) devices. The size of the Data Bus varies between machines, however it is efficient to have a Data Bus at least equivalent to the size of a Word. A word is the number of bytes that the system will handle in one go, for example 16, 32 or 64 bits. If the computer system uses 64 bits as a word and the Data Bus is only 32 wires wide, then the word would need to be transmitted through the data bus as 2 separate signals, thus making it inefficient. The size of the Data Bus does not need to be the same size as the Address Bus.
THE CONTROL BUS
The Control Bus is bi-directional (meaning that data can flow two ways) and is responsible for transmitting signals between various components. The Control Bus is generally only 8 wires wide as it carries signals rather than larges combinations of data representations. It is primarily tasked with carrying timing signals from the system clock, aiding the synchronisation of tasks.
The clock speed is a major factor in determining the overall speed of the computer, it can be seen that on every tick of the clock an action is performed, the more times per second the clock ticks the more actions are performed.
As can be seen in the system bus diagram the Data Bus is not directly connected to any input or output devices, it is connected to a separate I/O interface or device controller.
The Arithmetic and Logic Unit is responsible for calculations such as addition, multiplication and logic such as AND and OR. Registers are temporary storage areas used to store small instructions or small pieces of data as it is being processed. Registers are very small and very fast memory situated very close to the ALU. The basic Von Neumann architecture comprises of the following registers.
PC Program Counter
Stores the memory address that holds the next instruction to be read. The incrementor increments/changes the program counter from one instruction to the next and the incrementor is controlled by the clock through the control unit.
MAR Memory Address Register
The MAR holds the memory location address that is about to be written or read from
MDR Memory Data Register
The MDR, sometimes known as MBR (Memory Buffer Register) holds the data that has just been read, or the data that is about to be stored in a memory location.
CIR Current Instruction Register
The CIR is used to store the current instruction during the time it is being processed (decoded and executed).
IR Index Register
The IR is used to store the value of the current index being accessed. Used when accessing array variable, by indexing the address to be accessed a loop can be used to iterate the value of the index to be accessed. This is illustrated in the assembly language section.
The fetch decode execute cycle
The fetch execute cycle is used to describe the flow of data through the processor, how the data is fetched from memory, decoded, a decision on what to do with the data, and then executed, the appropriate action is carried out on the data.
The fetch decode execute sequence
1: The value from the program counter is copied to the MAR
2: A request is made to retrieve the data from the memory location stipulated in the MAR, the request is send via the address bus(one way).
3: The content of the memory location is sent via the Data Bus to the MDR
4: A copy of the MDR is made and placed in the CIR
5: The value of the CIR is decoded (A decision made on what needs to be done with the data).
6: The data is moved to the Acc to be executed
7: A check for interrupts is made
8: The program counter is iterated.
Note: The program counter can be iterated at any point after the data is accessed from the memory location, stage 3, however for the purpose of this illustration it is iterated lastly.
9: The loop starts again.
- PC Program Counter
- MAR Memory Address Register
- MDR Memory Data Register ( Sometimes abbreviated as MBR)
- CIR Current Instruction Register
- IR Index Register (Sometimes abbreviated as IX)
- SR Status Register
PC Program Counter
Stores the memory address that holds the next instruction to be read. The incrementor increments/changes the program counter from one instruction to the next and the incrementor is controlled by the clock through the control unit.
MAR Memory Address Register
The MAR holds the memory location address that is about to be written or read from
MDR Memory Data Register
The MDR, sometimes known as MBR (Memory Buffer Register) holds the data that has just been read, or the data that is about to be stored in a memory location.
CIR Current Instruction Register
The CIR is used to store the current instruction during the time it is being processed (decoded and executed).
IR Index Register
The IR is used to store the value of the current index being accessed. Used when accessing array variable, by indexing the address to be accessed a loop can be used to iterate the value of the index to be accessed. This is illustrated in the assembly language section.
The fetch decode execute cycle
The fetch execute cycle is used to describe the flow of data through the processor, how the data is fetched from memory, decoded, a decision on what to do with the data, and then executed, the appropriate action is carried out on the data.
The fetch decode execute sequence
1: The value from the program counter is copied to the MAR
2: A request is made to retrieve the data from the memory location stipulated in the MAR, the request is send via the address bus(one way).
3: The content of the memory location is sent via the Data Bus to the MDR
4: A copy of the MDR is made and placed in the CIR
5: The value of the CIR is decoded (A decision made on what needs to be done with the data).
6: The data is moved to the Acc to be executed
7: A check for interrupts is made
8: The program counter is iterated.
Note: The program counter can be iterated at any point after the data is accessed from the memory location, stage 3, however for the purpose of this illustration it is iterated lastly.
9: The loop starts again.
QUICK QUESTION
What is Binary?
A) A number system that uses digits 0 through 9
B) A number system that uses digits 0 and 1
C) A method for representing negative numbers
D) An operation that moves bits left or right within a binary number
EXPLAINATION
The answer is B) A number system that uses digits 0 and 1 because the binary number system, also known as base-2, consists only of two digits: 0 and 1. Each digit in a binary number represents a power of 2, making it fundamental to computer systems and digital electronics.
WANT MORE HELP ON THE CPU? TRY THESE:
For a video showing the fetch decode execute cycle, click here (HurrayBanana, Published on Oct 11, 2013)
For a video that covers different types of addressing and the practical use, click here (Kevin Drumm, Published on Nov 27, 2018)
Try Little Man Computing LMC - A simulation of the CPU
Try schweigi Github CPU simulation
Simple animation of the fetch decode execute cycle - by future learn
For a video showing the fetch decode execute cycle, click here (HurrayBanana, Published on Oct 11, 2013)
For a video that covers different types of addressing and the practical use, click here (Kevin Drumm, Published on Nov 27, 2018)
Try Little Man Computing LMC - A simulation of the CPU
Try schweigi Github CPU simulation
Simple animation of the fetch decode execute cycle - by future learn
Binary: A number system that uses only two digits, 0 and 1.
Logic Gates: Electronic circuits that perform basic logic functions such as AND, OR, and NOT.
Registers: Small, fast storage locations in a computer's CPU that hold data temporarily during processing.
Logic Gates: Electronic circuits that perform basic logic functions such as AND, OR, and NOT.
Registers: Small, fast storage locations in a computer's CPU that hold data temporarily during processing.
1: Why is the address bus uni-directional?
2: How does the width of the address bus effect the access of memory locations?
3: What is the purpose of the Data bus?
4: Why is the data bus a serial bus rather than a parallel bus?
5: State the purpose of the control bus.
2: How does the width of the address bus effect the access of memory locations?
3: What is the purpose of the Data bus?
4: Why is the data bus a serial bus rather than a parallel bus?
5: State the purpose of the control bus.
1: What are 'registers' ?
2: What is the role of 'interrupts' ?
3: Why does the CIR create a copy of the MDR?
4: Describe what happens in the fetch stage of the cycle.
5: Describe what happens in the decode stage of the cycle.
6: Describe what happens in the execute stage of the cycle.
7: Describe the role of the control unit during the Fetch decode execute cycle.
ADDITIONAL TASK
Sketch a visualisation of the internal operations of the CPU
2: What is the role of 'interrupts' ?
3: Why does the CIR create a copy of the MDR?
4: Describe what happens in the fetch stage of the cycle.
5: Describe what happens in the decode stage of the cycle.
6: Describe what happens in the execute stage of the cycle.
7: Describe the role of the control unit during the Fetch decode execute cycle.
ADDITIONAL TASK
Sketch a visualisation of the internal operations of the CPU
COMING SOON
1.1 NUMBER SYSTEMS
➩ 1.1.1 WHY COMPUTERS USE BINARY
☐ 1.1.2 BINARY, HEX AND CONVERTIG BETWEEN NUMBER SYSTEMS
☐ 1.1.3 BENEFITS OF HEX
☐ 1.1.4 BINARY ADDITION AND OVERFLOW
☐ 1.1.5 BINARY SHIFTS
☐ 1.1.6 NEGATIVE NUMBER REPRESENTATION, TWO'S COMPLEMENT
1.2 COLOUR AND SOUND
☐ 1.2.1 HOW COMPUTERS REPRESENT TEX
☐ 1.2.2 HOW COMPUTERS REPRESENT SOUND
☐ 1.2.3 HOW COMPUTERS REPRESENT IMAGES
1.3 FILE SIZE AND COMPRESSION
☐ 1.3.1 HOW STORAGE IS MEASURED
☐ 1.3.2 CALCULATING IMAGE AND SOUND FILE SIZE
☐ 1.3.3 PURPOSE OF COMPRESSION
☐ 1.3.4 LOSSY AND LOSSLESS COMPRESSION
EXTRAS
☐ END OF TOPIC REVIEW | COMING SOON
☐ TOPIC 1 KEY TERMINOLOGY
☐ REVISION FLIP CARDS
☐ TOPIC 1 ANSWERS
☐ TOPIC 1 TEACHER RESOURCES (CIE)
➩ 1.1.1 WHY COMPUTERS USE BINARY
☐ 1.1.2 BINARY, HEX AND CONVERTIG BETWEEN NUMBER SYSTEMS
☐ 1.1.3 BENEFITS OF HEX
☐ 1.1.4 BINARY ADDITION AND OVERFLOW
☐ 1.1.5 BINARY SHIFTS
☐ 1.1.6 NEGATIVE NUMBER REPRESENTATION, TWO'S COMPLEMENT
1.2 COLOUR AND SOUND
☐ 1.2.1 HOW COMPUTERS REPRESENT TEX
☐ 1.2.2 HOW COMPUTERS REPRESENT SOUND
☐ 1.2.3 HOW COMPUTERS REPRESENT IMAGES
1.3 FILE SIZE AND COMPRESSION
☐ 1.3.1 HOW STORAGE IS MEASURED
☐ 1.3.2 CALCULATING IMAGE AND SOUND FILE SIZE
☐ 1.3.3 PURPOSE OF COMPRESSION
☐ 1.3.4 LOSSY AND LOSSLESS COMPRESSION
EXTRAS
☐ END OF TOPIC REVIEW | COMING SOON
☐ TOPIC 1 KEY TERMINOLOGY
☐ REVISION FLIP CARDS
☐ TOPIC 1 ANSWERS
☐ TOPIC 1 TEACHER RESOURCES (CIE)