CPU (PPT 7 - 10) Flashcards
What is in memory?
Memory consists of a series of numbers stored at numbered locations. Contiguous blocks usually contain:
- A sequence of numbers, forming a machine code program
- Collections of numbers which are user data
What is the Fetch Execute Cycle?
The CPU fetches in a number, interprets this number by decoding it and getting the operation and the operand.
What does an instruction consist of?
A single instruction is made up of: An opcode and possibly: An Operand An Addressing Mode
What is the Instruction Set?
The instruction set defines the operations which a microprocessor can perform
What are some examples of operations an Instruction Set contains?
Data transfer Arithmetic Logical I/O Flow Control System Control
What are some of the additions to the Instruction Set over the years?
More arithmetic operations have been added, such as trigonometric functions and logarithmic functions. or the ability to use real numbers
Signal processing operations, such as for audio and video
What is SIMD?
Single Instruction Multiple Data is when we pack two samples into one register and process both samples together, saving time.
What is the Addressing Mode?
Specifies where to find the operand for an instruction. Can be immediate, stored in the registers or in main memory.
Why do we need multiple Addressing Modes?
We need a range of modes to be able to reference as large a range of locations in memory as flexibly as possible
What happens if the required operand is stored in main memory?
The processor must calculate the physical address of the data using one of the addressing modes.
What are the different types of addressing mode and what are the trade offs?
Immediate Direct Indirect Register Register Indirect Displacement Stack Each trade off between address range and/or flexibility and the number of memory references and/or complexity of the address calculation
What is the immediate addressing mode?
Data is packed into the code
What is the register addressing mode?
Data is in the register named in the code?
What is the direct addressing mode?
Data is at the address indicated by a pointer named in the code
What is the displacement addressing mode?
Data is at the address indicated by a pointer and displacement named in the code
What is the stack addressing mode?
Data is at the address indicated by the stack pointer
What is an advantage and disadvantage of direct addressing and give an example?
Example: simple variables
Adv: simple
Disadv: limited addressing to one instruction
What is an advantage and disadvantage of indirect addressing and give an example?
Example: arrays(pointer is the index)
Adv: Simple to access multiple addresses
Disadv: Access takes longer
What is an advantage and disadvantage of displacement addressing and give an example?
Example: records
Adv: Simple to access multiple addresses
Disadv: Access takes even longer
What is a stack?
Stack is used for storage of temporary variables. It is stored in part of the RAM. It functions like a separate data structure within the hardware.
How is the stack stored?
A contiguous block is reserved in main memory. Most of the time, the block is partially filled with elements and the remainder is available for stack growth.
What is the stack used for?
The stack is mainly used for the following things:
- Temporary storage of variables
- parameter passing to subroutines
- Parsing syntax by compilers
- Any application where flexibility of size and/or address less storage is needed.
Calculate the Physical Address if the Base Register contains $00156989 and the Start Register contains $00AA9673
PA = SR + B
00156989 + 00AA9673 = 00BFFFFC
Calculate the Physical Address if the Base Register contains $00133900 and the Start Register contains $00AA9673 and the Address field of the instruction contains 42
PA = SR + B + A
00133900 + 00AA9673 + 42 = 00BDCFBF5
Calculate the Physical Address if the Base Register contains $00145270 and the Start Register contains $00CD9271 and the Address field of the instruction contains 37. The Index Register contains 100 and the Scale Factor is 4
PA = SR + B + A + (I x S)
00145270 + 00CD9271 + 37 + ( 100 x 4 ) = 00E1EDC8
What does the Instruction Set of a Processor define?
- Types of operations available
- Types of operands available
- Instruction formats available
- Addressing modes available