Friday, January 08, 2016

Arsitektur dan Organisasi Komputer - Instruction Sets: Characteristics and Functions

Instruction Sets: kumpulan instruksi yang dimengerti CPU

Elemen dari Instruksi:
- Operation Code (Op Code): do this
- Source Operand reference: to this
- Result Operand reference: put the answer here
- Next Instruction reference: when you have done that, do this...

Instruction Representation:
cth: ADD, SUB, LOAD

Simple Instruction Format:

Instruction Types:
- Data Processing
- Data Storage (main memory)
- Data Movement (I/O)
- Program flow control

Untuk mengambil operand, alamat dapat berjumlah 0, 1, 2, atau 3 alamat
3 Alamat
A = B + C

2 Alamat
A = A + B

1 Alamat
Accumulator, cth A++

0 Alamat
Menggunakan stack
cth:
PUSH A
PUSH B
ADD
POP C

sama saja seperti: C = A + B

Types of Operand:
- Addresses
- Numbers (integer/ floating point)
- Characters (ASCII dll)
- Logical Data (bits/ flags)

More addresses
-> More complex (powerful?) instructions
-> More registers 
     -> Inter-register operations are quicker
-> Fewer instructions per program

Fewer addresses
-> Less complex (powerful?) instructions
-> More instructions per program
-> Faster fetch/execution of instructions


Types of Operation:
- Data transfer
   Specify -> source, destination, amount of data
- Arithmetic
   Add, subtract, multiply, divide
   May include: increment (a++), decrement (a--), negate (-a)
- Logical
   AND, OR, NOT
- Conversion
   e.g binary to decimal
- I/O
   May be specific instructions
   May be done using data movement instructions (memory mapped)
   May be done by separate controller (DMA)
- System Control
   for OS use, CPU must be in specific state
- Transfer of Control
   Branch, dibagi 2:
   -> Branch Conditional, cth branch to x if result is zero
   -> Branch Unconditional, cth call 1000
   -> cth branch:

   Skip
   -> cth: increment and skip if zero
   -> bersyarat
   Subroutine Call
   -> tanpa syarat
   -> cth: interrupt call

Uses of Stack
Stack berguna utk menyimpan isi register kalau ada program yang loncat (bercabang) sehingga dia tau harus kembali ke mana
Stack hanya menyimpan operand yang di push dan alamat untuk kembali
Stack terdapat di RAM (memori bisa diambil secara acak)
Namun, stack tdk dapat diambil secara acak melainkan dengan LIFO
Contoh:



2 comments:

Unknown said...

Nas, itu sistem stack bukannya diambil secara LIFO ya?

Annastasya said...

oh iya LIFO. Thanks koreksinya :)