Assembly Flashcards
What is an instruction set?
An instruction set is a series of commands typically written in machine code which a CPU is programmed to recognise and respond to. An instruction set can refer to all the instructions for a particular CPU or a subset.
-WhatIs.com
Features of the MIPS Processor
The MIPS (Microprocessor without Interlocked Pipelined Stages) is a processor with 32 general registers.
It uses 32-bit instructions to form its instruction set.
32 bit represents a word in MIPS.
Notable for a small number of formats encoding opcodes
It uses a 32x32 bit register file for frequently accessed data.
What does MIPS stand for?
Microprocessor without Interlocked Pipelined Stages
How are instructions represented in an instruction set?
They are encoded in binary or machine code.
How are instructions encoded in MIPS?
They are encoded as 32-bit instruction words.
What instruction formats are part of MIPS?
MIPS has three instruction formats,
The I Format: I for immediate
The J Format for Jump Instructions
The R Format for arithmetic or register-based instructions.
Define Register.
A register is a small amount of memory in the CPU, it is quickly accessible and used to primarily to perform arithmetic operations in the CPU, storing the results of operations, the numbers on which the calculation is performed with etc. Registers may also have specific functions where some registers cannot be written to and only read from.
What are the purposes of registers?
Registers are the fastest and primary form of memory in the computer. They are most often used to perform arithmetic operations as accessing main memory is far slower. Certain register s may have special functions such as the $zero register in MIPS which cannot be rewritten and is always zero.
How many general-purpose registers does the MIPS processor have?
32 general registers.
What is a register operand?
An operand, in general, refers to the piece of an instruction that specifies what data can be manipulated. As such the term register operand in the context of MIPS means that registers act as operands and the data stored on them
What is the MIPS regsiter file?
A register file is an array of the processor registers on a CPU. MIPS uses a 32x32 bit register file.
It is numbered 0 to 31, with 32-bit words.
When is the MIPS register file used?
The register file is used for frequently accessed data.
What register operand names are used for the assembler?
Assembler names include:
$s0 to $s7 for the saved variables
$t0 to $t7 for the temporary values.
What is the MIPS design principle?
Smaller is faster, maximise design with millions of memory locations
What are the MIPS general registers?
What is register r0?
r0 has the assembly name $zero. It represents 0 and is a read-only register.
It is always zero.
What is register r30?
Register r30 has the assembly name $fp, it is the frame pointer.
What is register r31?
Register r31 has the assembly name $ra, it is the return address
What is register r29?
Register r29 has the assembly name $sp, it is the stack pointer.
What is register r28?
Register r1 has the assembly name $gp, it is the global pointer.
What is register r1?
Register r1 has the assembly name $at, it is reserved for pseudoinstructions.
What are registers r4to r7?
These registers have the names $a0, $a1, etc.. They store arguments
What are registers r2 to r3?
These registers have the names $v0, $v1. They store results.
What are registers r26 to r27?
These registers have the names $k0, $k1.. They are reserved by the operating system
What are registers r23 to r25?
These registers have the names $t8, $t9.. They store temporary which are not saved
What are registers r16 to r23?
These registers have the names $s0, $s1, etc.. They store values to be saved for future use.
What are registers r8 to r15?
These registers have the names $t0, $t1, etc.. They store temporary values which are not saved.
Define assembly language
Assembly language is a programming tool designed to be closer to machine code. The instructions available in assembly are dependent on the machine’s instruction set.
It has an almost 1:1 mapping with machine code
Why was assembly used, and why is it used today?
Assembly was designed to make code a bit easy to understand in early systems, however, small resources meant that the instruction set had to be as efficient as possible.
Today, assembly is used each time a compiler is run, used in the inner core of operating systems and to optimise a system. It provides process control overtime cost. Suitable for low-level interactions such as a microcontroller, it helps with performance analysis as to allows observation of the compiler and where the program spending most of its time.