You are on page 1of 8

Soal- Jawab

1. Diketahui sebuah data prosessor untuk format 1 alamat.


Jawab :

Bentuk umum:

Upcode Opd1

0110 Acc<- B
Load B
0111 Acc<- Acc + C
Add C
0112 Sub D Acc<- Acc - D
store A
0113 A<-Acc

 Pertanyaan : tuliskan instruksi mesinnya!

A:= B+C-D

Untuk menyimpan hasil maka harus ditentukan operan keduanya diletakkan dimana,
misalkan pada alamat R0 . Sebagai contoh:
Add a berarti R0 = a + R0

Instruksi mesin

Load tmp , B Memuat b ke accumulator (R0 )


add tmp, C Tambahkan C ke R0
Sub tmp, D Kurangkan R0 dengan D
Store tmp, A
Simpan data (R0 ) kedalam register A

2. Jelaskan dan berikan contoh set instruksi untuk prosessor yang memiliki 0-alamat
Jawab :

Bentuk umum:

Upcode Opd1

Semua alamat operand implisit, disimpan dalam bentuk stack (tumpukan).


Operasi yang biasanya membutuhkan 2 operand, akan mengambil isi stack paling atas
dan di bawahnya dan disimpan paling atas.

 Ciri-ciri prosessor format 0-alamat


 Menggunkan stack
 Instruksi dengan format ini mengasumsikan operand-operand sudah ada distack.
Dan hasil operand akan disimpan di stack juga.

Ekspresi arithmatika yang akan dijalankan di mesin sudah harus dalam bentuk notasi
polish.

Contoh:
- mis. Operasi A=B + C
PUSH B
PUSH C
ADD
POP A
Catatan: semua operand implisitmenggunakanmemoritumpukan(stack)

- Operasi-c + ba
PUSH a
PUSH b
ADD (pop a dan b dari stack danditambahkan, c := a + b)
PUSH C
SUB

*Ket: PUSH : Memindahkan word dari sumber kebagian paling atas stack.

POP : Memindahkan word dari bagian paling atas sumber.

3. Tuliskan jenis-jenis dan perbedaan instruksi microprosessor 80x86 dengan MIPS serta
bandingkan keduanya.
Jawab:
 Jenis – jenis instruksi microprosessor 8086
Petunjuk dalam 8086, dapat diklasifikasikan ke dalam 13 kelompok berdasarkan
fungsinya:
1. Instruksi Transfer Data

MOV Move byte or word to register or memory


IN, OUT Input byte or word from port, output word to port
LEA Load effective address
LDS,
Load pointer using data segment, extra segment
LES
PUSH,
Push word onto stack, pop word off stack
POP
XCHG Exchange byte or word

XLAT Translate byte using look-up table

2. Instruksi Aritmatika
- Addition Instructions - ADD, ADC, INC, AAA, DAA

- Subtraction Instructions - SUB, SBB, DEC, NEG, AAS, DAS

- Multiplication Instructions - MUL, IMUL, AAM

- Division Instructions - DIV, IDIV, AAD, CBW, CWD


ADD dest, source SUB dest, source dest, source – reg , reg / reg, mem /
mem, reg / mem, imme / reg, imme INC dest, DEC dest, NEG dest
dest – reg / mem
ADD,
Add, subtract byte or word
SUB
ADC,
Add, subtract byte or word and carry (borrow)
SBB
INC,
Increment, decrement byte or word
DEC
NEG Negate byte or word (two's complement)
CMP Compare byte or word (subtract without storing)
MUL,
Multiply, divide byte or word (unsigned)
DIV
IMUL,
Integer multiply, divide byte or word (signed)
IDIV
CBW, Convert byte to word, word to double word (useful
CWD before multiply/divide)

3. Instruksi Logika

NOT Logical NOT of byte or word (one's complement)


AND Logical AND of byte or word
OR Logical OR of byte or word
XOR Logical exclusive-OR of byte or word
TEST Test byte or word (AND without storing)

4. Compare Instruction
Instruction to compare two 8 bit or 16 bit numbers
- CMP
5. Jump Instructions
Unconditional
- JMP
Conditional
- Jcc
6. Loop Instruksi
Three instructions specifically designed for implementing loops.
- LOOP

- LOOPE/LOOPZ

- LOOPNE/LOOPNZ
7. Shift Instruksi
- Logical shift
SHL, SHR
- Arithmetic shift
SAL, SAR
8. Rotate Instructions
- ROL, ROR, RCL, RCR
CALL and RET instructions
PUSH and POP instructions
9. Bendera Kontrol Instruksi
10. String Instruksi
11. Input / Output Instruksi
- IN

- OUT
12. Instruksi Interrupt
Number of instructions for processing interrupts
- CLI

- STI

- INT n

- IRET

- INTO

- HLT

- WAIT
13. Subrutin dan instruksi penanganan subrutin.
 Jenis-jenis instruksi MIPS
Instruksipada MIPS dibagidalamtigabentuk format yakni:
- R format terdiridaritiga register dan function field
- I format terdiriatasdua register dan 16 bit long immediate value
- J format terdiriatasenam bit opcode yang diikutioleh 26 bits immediate value
 Jenis-jenisinstruksi
Add – penambahan
Addi – Add immediate
ADDIU -- Add immediate unsigned
ADDU -- Add unsigned
AND -- Bitwise and
ANDI -- Bitwise and immediate
BEQ -- Branch on equal
BGEZ -- Branch on greater than or equal to zero
BGEZAL -- Branch on greater than or equal to zero and link
BGTZ -- Branch on greater than zero
BLEZ -- Branch on less than or equal to zero
BLTZ -- Branch on less than zero
BLTZA -- Branch on less than zero and link
BNE -- Branch on not equal
DIV -- Divide
DIVU -- Divide unsigned
J -- Jump
JAL -- Jump and link
JR -- Jump register
LB -- Load byte
LUI -- Load upper immediate
LW -- Load word
MFHI -- Move from HI
MFLO -- Move from LO
MULT -- Multiply
MULTU -- Multiply unsigned
NOOP -- no operation
OR -- Bitwise or
ORI -- Bitwise or immediate
SB -- Store byte
SLL -- Shift left logical
SLLV -- Shift left logical variable
SLT -- Set on less than (signed)
SLTI -- Set on less than immediate (signed)
SLTIU S l h i di i d --Set on less than immediate unsigned
SLTU -- Set on less than unsigned
SRA -- Shift right arithmetic
SRL -- Shift right logical
SRLV -- Shift right logical variable
SUB – Subtract
SUBU -- Subtract unsigned
SW -- Store word
SYSCALL -- System call
XOR -- Bitwise exclusive or
XORI -- Bitwise exclusive or immediate
 Perbedaan MIPS dan microprosessor 8086

MIPS Microprosessor 8086


Dipisahkan antara operand Salah satu operand bisa bertindak
sumber dan tujuan sebagai sumber maupun tujuan
Tidak mungkin untuk memiliki Salah satu operand bisa berada di
salah satu operan dalam memori memori
Petunjuk umum format opcode Petunjuk Umum format
tujuan, source 1, source 2. opcode destination/source1,
Source2

You might also like