Chapter 4 Flashcards
What are the three main sections a computer system consists of?
- CPU (/processor): the main processing unit
- Storage
i. Primary (/main) memory: RAM and ROM, cache memory and registers
ii. Secondary storage – Hard drives, CD-ROMs - Input and Output devices: allow interaction with the computer
What are the components of the CPU?
▪ Arithmetic Logic Unit (ALU)
▪ Control Unit (CU)
▪ System Clock
▪ Immediate Access Store (IAS)
What does the Arithmetic Logic Unit (ALU) do?
Allows
• Arithmetic operations: addition, subtraction, multiplication, division
• Logical operations (comparing one data item
to another)
Caried out while a program is running
What is the Accumulator (ACC)?
Accumulator (ACC) is the register used to store
values when carrying out ALU calculations – it is
inside the ALU
What does the Control Unit (CU) do?
▪ CU ensures synchronization by sending out signals along the control bus to control operations while fetching, interpreting and executing instructions
▪ Tells the other computer components what to do (input/output, flow of data)
What does the System Clock do?
▪ Sends out a number of pulses in a given time
interval on the control bus to ensure synchronisation takes place
▪ An electronic pulse of the CPU is called Clock cycle
▪ Each processor instruction takes a certain
number of clock cycles to execute
▪ The higher the clock frequency, the shorter the
execution time for the instruction// Increasing
the clock frequency improves performance
What purpose does the Immediate Access Store (IAS) have?
▪ Stores all the data and programs that the processor needs to access
▪ Done by the CPU temporarily
▪ Read/write operations carried out using IAS is faster than read/write operations to backing store
What are registers?
- Small pieces of fast memory where data is stored temporarily
- Part of the processor
What is the difference between general purpose registers and special purpose registers?
General Purpose:
• Hold data that is frequently used by the CPU or can be used by the programmer when addressing the CPU directly
• Example: Accumulator (ACC)
Special Purpose:
• Have a specific function within the CPU and hold the program state
• Example: CIR, IX, MAR, MDR, PC , SR
What is the purpose of the Current Instruction Register (CIR)?
Stores the current instruction being decoded and executed
What is the purpose of the Index Register (IX)?
Used when carrying out index addressing operations
assembly code
What is the purpose of the Memory Address Register
(MAR)?
Stores the address of the memory location currently being read for or written to
What is the purpose of the Memory Data Register (MDR/MBR)?
Stores data which has just been read form memory or data which is about to be written to memory (sometimes referred to as MBR)
What is the purpose of the Program Counter (PC)?
Stores the address where the next instruction to be read (fetched) can be found
What is the purpose of the Status Register (SR)?
Contains bits which can be set or cleared depending on the operation (e.g.: to indicate overflow in a calculation)
What is a status register?
▪ Contains different bits/flags (each flag takes one bit with 0 or 1 value)
▪ Used when an instruction requires some form of arithmetic or logical
processing
Examples of flags
▪ Negative flag (N) : set to 1 if the result of a calculation yields a NEGATIVE value
▪ Overflow flag (V) : set to 1 if an arithmetic operation results in an OVERFLOW
▪ Zero flag (Z) : set to 1 if the the result of an arithmetic/logic operation is ZERO
Where are the PC and CI registers found?
PC and CI registers are in the control unit
Where are the MDR and MAR found?
MDR and MAR are in the processor
Explain the Fetch-Decode-Execute cycle:
Fetch:
Fetches the next instruction and any data involved from main memory and stores them in registers
Decode:
Decodes (interprets, understands) the instruction
Execute:
Executes the instruction – sends control signals to the appropriate components of the computer system
What is a program?
A program is a set of instructions stored in a
sequential block of main memory locations
How are the registers during the fetch execute cycle utilized?
▪ Current Instruction Register (CIR) : Contains the current instruction being processed
▪ Program Counter (PC) : Contains the address of the next instruction to be executed
▪ Memory Address Register (MAR)
▪ Memory Data Register (MDR)
▪ General Purpose Registers: Holds data, such as numbers during arithmetic calculations
The steps in the fetch-execute cycle:
1) PC (Program Counter) register holds the address of the next instruction to be executed
2) CPU copies the address contained in the PC to the MAR via the address bus
3) The contents, the instruction, of the memory location contained in the MAR is then copied to the MDR
4) The contents, (the instruction) is then copied from the MDR and placed in the CIR
5) the value in the PC is then incremented so that it points to the next instruction to be fetched
6) the instruction is finally decoded and is then executed
The fetch-execute cycle using RTN
- MAR ← [PC] (Address stored in PC stored in MAR)
- PC ← [PC] + 1 PC (points to the next address-is incremented by 1)
- MDR ← [[MAR]] (Contents found in address stored in
MAR transferred to MDR)
- Double brackets means the data stored at the address shown in MAR that is being copied - CIR ← [MDR] (Contents of MDR transferred to CIR)
- Decode
- Execute
- Go to Step 1
What is an interrupt?
A signal from a program or device telling the processor its attention is needed
What can cause interrupts?
o Timing signal
o Input/output processes (e.g. disk drive ready to receive more data)
o Hardware fault (e.g.: paper jam, out of paper)
o User interaction (e.g.: Ctrl+Alt+Break keys to interrupt a process)
o Software error (e.g.: .exe not found, division by zero)
What happens when there’s an interrupt during the fetch-execute cycle?
- At the end of each fetch–execute cycle the processor checks for interrupt(s)
- Checks if an interrupt flag/bit is set (in interrupt register).
- Processor identifies source of interrupt
- Checks the priority of interrupt.
- If the interrupt priority is high enough
- Processor saves current contents of registers and
- Calls interrupt handler / Interrupt Service Routine (ISR)
- Address of ISR is loaded into Program Counter (PC)
- When servicing of interrupt complete, processor restores registers - Lower priority interrupts are re-enabled
- Processor continues with next F–E cycle
What is a bus?
A bus is a set of parallel wires connecting two or more components of the computer
Address bus:
Carries signal relating to addresses of main memory locations or input/output device to be used between the processor and memory
Unidirectional (addresses travel in one direction only) – from the processor to MAR
Data bus:
Sends data between the processor, the memory unit (and the input/output devices)
Bi-directional (data can travel in both
directions). Data is carried from CPU to
memory (and vice versa) as well as to and
from input/output devices
Control bus:
Carries signals relating to the control and coordination of all activities within the computer (e.g.: read and write functions) from CU to all the other computer components
Bi-directional. It carries signals from the CU to all the other computer components
What happens when we increase the bus address width?
The wider the data bus, the larger the number of bits (word length) that can be transported simultaneously at one time.
Increasing the width of address bus increases the performance of a computer system as fewer transfers are needed (increases the performance of a computer system)