Instruction Set Architectures (1) Flashcards
What are the different types of MIPS registers and their purposes?
General-purpose registers include temporary ($t), saved ($s), argument ($a), return address ($ra), global pointer ($gp), stack pointer ($sp), and frame pointer ($fp)
What is the purpose of the Arithmetic and Logic Unit (ALU) in the Processing Unit?
It performs arithmetic and logical operations on data
What are the fundamental components of the von Neumann model?
- Memory
- Processing Unit
- Input
- Output
- Control Unit
How is an addition operation represented in MIPS assembly language?
Using the ‘add’ instruction: add $d, $s, $t, where $d is the destination and $s, $t are source operands
How does the MIPS assembly handle the loading of immediate values?
Using the ‘li’ (load immediate) instruction, or through a combination of ‘lui’ (load upper immediate) and ‘ori’ (OR immediate)
What key functions does the Control Unit perform in a computer system?
It directs the operation of the processor and coordinates the activities of the other components
How does MIPS handle temporary variables during function calls?
Temporary variables can be stored in $t registers, which are not preserved across function calls
How do data movement instructions in MIPS function?
They read data from memory or write data to memory
What role do immediate values play in MIPS instructions?
Immediate values provide constants directly in the instruction for operations without requiring a separate load
What are the conventions surrounding caller and callee functions in MIPS?
The caller passes arguments and jumps to the callee, which must return the result without overwriting essential registers
What is the major difference between RISC and CISC architectures?
- RISC (Reduced Instruction Set Computer) uses a small, highly optimised instruction set
- CISC (Complex Instruction Set Computer) uses a larger set of instructions, including more complex ones
What is the significance of the ‘shamt’ field in the R-format instruction?
The ‘shamt’ field specifies the amount of shift for shift operations in R-format instructions
How many types of instructions are defined in the MIPS ISA?
Three main types:
- Operate instructions
- Data movement instructions
- Control flow instructions
How is a MIPS function call executed with the jump and link (jal) instruction?
‘jal’ saves the return address in $ra and jumps to the specified function
What is meant by ‘word length’ in the context of the MIPS architecture?
In MIPS, word length is 32 bits, meaning integers and addresses are typically 32 bits long
How does an Instruction Set Architecture (ISA) differ from microarchitecture?
ISA defines the set of instructions a processor can execute, while microarchitecture refers to how those instructions are implemented in hardware
How is the instruction format structured in MIPS?
There are multiple formats: R-format, I-format, and J-format, each with specific fields and layouts for different types of instructions
Why is the concept of modular functions important in programming?
Modular functions enhance code reusability, readability, and maintainability by encapsulating functionality
How are conditional branches implemented in MIPS assembly code?
Using instructions like ‘beq’ for branching based on equality or ‘bne’ for branching based on inequality
How are arrays accessed in MIPS assembly programming?
By loading the base address into a register and using offsets to access elements
In MIPS, how is a while loop structure typically represented in assembly?
Using a combination of branch instructions to check the loop condition and jump back to the start of the loop
What is the difference between load word (lw) and store word (sw) instructions?
‘lw’ retrieves a word from memory into a register, while ‘sw’ stores a word from a register into memory
What happens during a procedure return in MIPS assembly language?
The return address is retrieved from $ra, and control is transferred back to the caller using ‘jr $ra’
What is the role of the stack pointer in MIPS architecture?
The stack pointer ($sp) points to the top of the current stack frame, managing local variables and function arguments
How does the R-format instruction in MIPS differ from I-format instruction?
- R-format instructions use three registers
- I-format includes an immediate value
What instruction is used to implement a branch instruction in MIPS?
Branch instructions like ‘beq’ (branch if equal) and ‘bne’ (branch if not equal) are used
What are the steps involved in a for loop implementation in MIPS?
Initialize the loop variable, check the condition with a branch, perform body actions, increment the loop variable, and loop back
How does MIPS handle function return values?
Return values are typically stored in the $v0 register by the callee and accessed by the caller after a return
What is the significance of the PC or IP in the von Neumann architecture?
PC (Program Counter) or IP (Instruction Pointer) tracks the address of the next instruction to be executed
How are MIPS instructions encoded in terms of binary representation?
MIPS instructions are encoded as 32-bit instruction words called machine code