LOW LEVEL LANGUAGE
Low-level language is a language that provides little or no abstraction from a computer's instruction set architecture. Generally this refers to either machine code or assembly language.MACHINE CODE vs ASSEMBLY LANGUAGE
ASSEMBLY LANGUAGE
- We assign names to operand(e.g. add) and operands(e.g..$t0 )
- Branches and jumps use label instead of actual addresses
- Assemblers support many pseudo-instruction
MACHINE CODE
- Binary format that can be stored in memory and decode by the cpu
Assembly language -----> (assembler) -----> Translator
INSTRUCTION SET
- Instruction set architecture usually define a "family of microprocessor"
- Example: intelx86(IA32),Sun Sparc, Dec Alpha, IBM/360
- Formally defines the interface between a user and a microprocessor
SPIM - MIPS SIMULATOR
- SPIM (MIPS spelt backward!) is a MIPS simulator that
- reads MIPS assembly files and translate to machine language
- execute the machine language instruction
- shows contents of register and memory
- works as a debugger
- provide basic os
MIPS REGISTER CONVENTION
NAME
|
REGISTER NUMBER
|
USAGE
|
PRESERVE ON CALL?
|
$zero
|
0
|
Constant 0(hardware)
|
n.a.
|
$at
|
1
|
Reserved for
assembler
|
n.a.
|
$v0 - $v1
|
2-3
|
Returned value
|
No
|
$a0 - $a3
|
4-7
|
Arguments
|
Yes
|
$t0 - $t7
|
8-15
|
Temporaries
|
No
|
$s0 - $s7
|
16-23
|
Saved value
|
Yes
|
$t8 - $t9
|
24-25
|
Temporaries
|
No
|
$gp
|
28
|
Global pointer
|
Yes
|
$sp
|
29
|
Stack pointer
|
Yes
|
$fp
|
30
|
Frame pointer
|
Yes
|
$ra
|
31
|
Return addr(hardware)
|
Yes
|
http://msdn.microsoft.com/en-us/library/ms253512(v=vs.80).aspx
OPERANDS
Register operands
- Data stored in register
- Arithmetic instructions use register operand
- Example:
mov bx, 10 ; Load constant to BX add ax, bx ; Add BX to AX jmp di ; Jump to the address in DI
Memory operands
- Main memory use for composite data
- To apply arithmetic operations
- load value from memory into register
- store result from register to memory
- Example : A[12] = h + A[8]
1w $t0, 32($s3) #load word
add $t0, $s2, $t0
sw $t0, 48($s3) #store word
Immediate operands
- Certain instructions use data from the instruction itself as one (and sometimes two) of the operands.Such an operand is called an immediate operand. The operand may be 32,16 or 8 bit long.
REGISTER VS MEMORY
- Register are faster to access than memory
- Operating on memory requires loads and store
- Compiler must use register for variable as much as possible
INTSRUCTION FORMATS
REGISTER TYPE (R-TYPE)
This group includes arithmetics and logic with all operands in register,shift instruction and register direct jump instruction
All R-Type instructions use opcode 000000
op
Operation Code
|
rs
Source register specifier
|
rt
Target register specifier
|
rd
Destination register
specifier
|
shamt
Shift amount
|
funct
Function field
|
IMMEDIATE TYPE(I-TYPE)
This group includes instruction with an immediate operand,branch instruction ,and load and store instructions
All opcode except 000000,00001x,0110xx and 0100xx
op
Operation Code
|
rs
Source register specifier
|
rt
Target register specifier
|
immediate
Immediate , branch
displacement or address displacement
|
JUMP TYPE(J-TYPE)
- This group consist of two direct jump instructions(j and jal)
- These instructions required a memory address to specify their operand
- J-type instructions use opcode 00001x
op
Operation Code
|
target
Target address
|
SOURCES
http://courses.cs.washington.edu/courses/cse378/07au/lectures/L5-machinelang.pdf
http://msdn.microsoft.com/en-us/library/ms253512(v=vs.80).aspx
Lecture note language of the computer 1
Computer Organization And Architecture Lab Companion(Module 16)
Wow..ur blog helps me alot..now i know more abt language of the computer..thanks to you ;)
ReplyDeleteVery good explaination����
ReplyDeletevery good explaination...good job
ReplyDeleteexcellent girl.. enjoy with your explaination :)
ReplyDeleteSeriously..such a good info.. Thanks for the info
ReplyDeleteGood ^^. This information relly helping me.
ReplyDelete