Pages

Tuesday, 18 December 2012


Language of Computer :

Unsigned Binary Integers

x = xn-12n-1 + xn-22n-2 + …… + x121 + x020
ini adalah formula bagi n-bit nombor.
-Julatnyan dari 0 hingga 2n-1
-contoh 1
0000 0000 0000 0000 0000 0000 0000 11102
= 0 + …… + 1323 + 1222 + 1121 + 0020
= 0 + 8 + 4 + 2 + 0
= 1410



2s-Complement Signed Integers

-contoh 2
1111 1111 1111 1111 1111 1111 1111 10012
= –1×231 + 1×230 + …+1×23 +0×22 +0×21 +1×20
= –2,147,483,648 + 2,147,483,641
= –710

-contoh 3
010 = 0000 0000 0000 0000 0000 0000 0000 00002

-contoh 4
-110 = 1111 1111 1111 1111 1111 1111 1111 11112

-contoh 5
+5 = 0000 0000 … 01012
-5 = 1111 1111 … 10102 + 1
  = 1111 1111 … 10112


R – format Instruction




op: operation code (opcode)
rs: first source register number
rt: second source register number
rd: destination register number
shamt: shift amount (00000 for now)
funct: function code (extends opcode)


-contoh 6
add $t0, $s1, $s2
 000000100011001001000000001000002 = 02324402016


Hexadecimal






-contoh 7
abcf097616
= 1010 1011 1100 1111 0000 1001 0111 01102

MIPS I – format Instructions



op: operation code (opcode)
rs: first source register number
rt: second source register number
Constant: –215 to +215 – 1
Address: offset added to base address in rs

-contoh 8
A[300] = h + A[300]
lw      $t0,1200($t1)
add    $t0,$s2,$t0
sw     $t0,1200($t1)

0 comments:

Post a Comment