Well hello! *do i need to introduce myself??
For this chapter, I will be the one who will explain to you what is MIPS. So, what you will learn here is:
1. MIPS Architecture
2. Register 3. Comment (#) 4. Assembly Instruction 5. Memory Operand
4.1 MIPS Architecture
- a unit of computing speed equivalent to a million instructions per second.
- an early RISC processor. RISC processors typically support fewer and much simpler instructions.
4.2 Register
- limited number of special location built directly into the hardware
- needd to perform the operation (cannot perform without it)
- very fast since registers are directly in hardware
- only 32 registers in MIPS
4.2 Register
- limited number of special location built directly into the hardware
- needd to perform the operation (cannot perform without it)
- very fast since registers are directly in hardware
- only 32 registers in MIPS
- why? smaller the register, faster the performance
- 1 register is 32 bits wide (32 bits = a word)
- register preceded by $ in assembly language instruction
- two formats for addressing:
- using register number e.g. $0 through $31
- using equivalent names e.g. $t1, $sp
- special registers Lo and Hi used to store result of multiplication and division
- not directly addressable: contents accessed with special instruction mfhi ("move from Hi") and mflo ("move from Lo")
- stack grows from high memory to low memory
4.3 Comment
In programming language, we create comment by putting '//' at the front. Hence,in assembly language (coding in MIPS), we use put '#' (hashtag) before the words.
#comment
- hash (#) is used for MIPS comments
- anything from hash mark to the end of line is a comment
- will be ignored in the coding
4.4 Assembly Instructions
- in assembly language, instruction is a statement
- each instruction is executed exactly one with a simple command
Syntax of instructions:
The arrangement of coding :: 1(ON) 2(Ds),3(S1),4(S2)
1(ON) ---> operation name (ADD, SUB, etc)
2(S0) ---> operand for getting result or we called it ('destination')
3(S1) ---> 1st operand for operation called ('source1')
4(S2) ---> 1st operand for operation called ('source2')
example : add $s0,$s1,$s2
- Syntax is rigid
- 1 operator (add,sub, etc), 3 operands >> to keep hardware simple and fast
:: Addition in assembly
Example: add $s0,$s1,$s2 (in MIPS)
is equal to: a = b + c (in C)
:: Subtraction in assembly
Example: sub $s3,$s4,$s5 (in MIPS)
is equal to: d = e - f (in C)
4.5 Memory Operand
- Main memory used for omposite data
- To apply arithmetic operations
- load values from memory into registers
- store result from register to emory
- each address identifies an 8-bit byte
- address must be a multiple of 4
That's all from me. Hope you enjoys reading mine! Ppyong~
πππ
ReplyDeleteSangat membantu!
ReplyDeleteThank you!!! πππ
ReplyDelete