1/47
These flashcards cover key topics and concepts related to assembly language and machine code as presented in the lecture notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What does Assembly Language represent?
Assembly language represents low-level programming instructions corresponding to machine code.
What operation does the Control Unit perform based on the opcode value?
The Control Unit sends signals to the datapath.
What two types of instructions are crucial in assembly programming?
Machine code instructions and assembly language instructions.
How are the first 6 bits of a machine code instruction used?
They are used to extract the opcode.
What is the role of the instruction register in a processor?
It sends instruction components to the processor.
What is the assembly language instruction for adding registers $t1 and $t2 and storing the result in $t3?
add $t3, $t1, $t2.
What does R-type stand for in MIPS instructions?
R-type stands for register-type instructions, where all inputs and outputs are registers.
What special purpose does register $0 serve in MIPS architecture?
Register $0 always has the value 0.
What are I-type instructions characterized by?
I-type instructions include a constant value encoded in the last 16 bits of the instruction.
What does the J-type instruction do?
J-type instructions jump to a memory location encoded in the last 26 bits.
What should the value in the immediate field of I-type instructions represent?
A constant value or address offset.
What is the significance of function codes in R-type instructions?
Function codes specify the operation performed, with an opcode of 000000.
What registers are reserved for the OS kernel in MIPS architecture?
Registers $26-$27 are reserved for the OS kernel.
What memory alignment is required for word accesses in MIPS?
Word accesses must be word-aligned, meaning addresses must be divisible by 4.
What does the term 'branch instruction' refer to?
A branch instruction allows the program to jump to a different section of code based on a condition.
Which special MIPS register stores the return address for function calls?
Register $31 stores the return address.
What is the purpose of the stack in relation to function calls?
The stack is used to store return addresses and local variables to manage function calls.
What differentiates caller-saved registers from callee-saved registers?
Caller-saved registers must be saved by the caller, while callee-saved registers must be saved by the callee.
How do interrupts differ from exceptions?
Interrupts are external events requiring attention, while exceptions are internal errors raised by the processor.
What type of values are passed to functions when using caller-conventions?
Values are passed through registers (if fewer than four) or pushed onto the stack.
What happens when a nested function call occurs?
The current value of $ra must be saved onto the stack before making another call.
Which instruction is used to load an immediate into a register?
The lui instruction is used to load an immediate.
What instructions are generally used to handle input and output operations in MIPS?
Input and output operations are typically handled via syscall instructions.
Which instruction do you use to return from a subroutine?
The jr $ra instruction is used to return from a subroutine.
What is the meaning of the opcode 001000?
The opcode 001000 indicates an add immediate (addi) instruction.
What does a 'trap' instruction do in MIPS?
The trap instruction sends system calls to the operating system.
What do offset values do in memory accesses?
Offset values specify the address relative to a base address for accessing memory.
In MIPS, how are variables stored in memory sections?
Variables are stored in .data (for data values) and .text (for instruction values) sections.
How do you represent an array in assembly?
Arrays are declared in consecutive memory locations, and the base address is the address of the first element.
What is the main component used to perform multiplication in MIPS?
The hi and lo registers are used to store results of multiplication.
What is Big Endian in data storage?
Big Endian stores the most significant byte at the lowest memory address.
What is Little Endian in data storage?
Little Endian stores the least significant byte at the lowest memory address.
What is the opcode for branch if equal (beq)?
The opcode for beq is 000100.
What is the function of the stack pointer ($sp)?
The stack pointer points to the last element pushed onto the stack.
What does the instruction 'lw $t0, 0($s0)' do?
This instruction loads a word from the address specified by $s0 into register $t0.
What is the format used for memory load/store instructions in MIPS?
The format is: opcode rs rt immediate.
What is a pseudo-instruction in assembly language?
A pseudo-instruction simplifies the programming process, translating into one or more real MIPS instructions.
How can an 'if statement' be represented in assembly language?
If statements are typically represented via conditional branch instructions like beq and bne.
Why can MIPS be described as RISC architecture?
MIPS architecture is RISC because it uses a small set of simple, optimized instructions.
What identifies the start of a function in assembly code?
The start of a function is indicated by a label for the first line of the function.
What is the purpose of storing values onto the stack?
Values are stored on the stack for preservation during function calls.
What does the instruction 'sw $t0, 0($s1)' do?
This instruction stores the word in $t0 into memory at the address given by $s1.
What is the primary role of the assembler in MIPS?
The assembler translates assembly code into machine code.
What occurs during a syscall instruction?
The syscall instruction transfers control to the operating system to handle requests.
What is the typical structure of machine code instructions in MIPS?
Machine code instructions in MIPS are 32 bits long.
What does the instruction 'jal main' do?
The instruction 'jal main' jumps to the function 'main' and stores the return address in $ra.
What typically happens when a function completes execution in assembly?
The return address is used to jump back to the line following the function call.
What mechanism allows MIPS to support recursive function calls?
The use of the stack allows MIPS to save state and handle recursion.