IJVM Classes of Instructions (Instruction Set Architecture)

IJVM Classes of Instructions (Instruction Set Architecture) Hex 0x10 0x13 0x15 0x36 0x57 0x59 0x5F Mnemonic Basic Stack Operations BIPUSH byte LDC_W ...
Author: Adam Richard
2 downloads 2 Views 64KB Size
IJVM Classes of Instructions (Instruction Set Architecture) Hex 0x10 0x13 0x15 0x36 0x57 0x59 0x5F

Mnemonic Basic Stack Operations BIPUSH byte LDC_W index ILOAD varnum ISTORE varnum POP DUP SWAP

Meaning Data Movement Instructions Push byte onto stack Push constant from constant pool onto stack Push local variable onto stack Pop word from stack and store in local variable Delete word on top of stack Copy top word on stack and push onto stack Swap the two top words on the stack

0x60 0x64 0x7E 0x80 0x84

Operand Arithmetic IADD ISUB IAND IOR IINC varnum const

ALU Instructions Pop two words from stack; push their sum Pop two words from stack; push their difference Pop two words from stack; push Boolean AND Pop two words from stack; push Boolean OR Add a constant to a local variable

0x99 0x9B 0x9F 0xA7

Branching IFEQ offset IFLT offset IF_ICMPEQ offset GOTO offset

Flow Control Instructions Pop word from stack and branch if zero Pop word from stack and branch if less than zero Pop two words from stack; branch if equal Unconditional branch

0x00 0xC4

Misc. NOP WIDE

Other Instructions Do nothing Prefix instruction; next instruction has a 16-bit index

Special Operations 0xB6 INVOKEVIRTUAL disp 0xAC IRETURN

Subroutine/ISR Control Instructions Invoke a method Return from method with integer value

The operands byte, const, and varnum are 1 byte. The operands disp, index, and offset are 2 bytes. 1 of 20 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured Computer Organization 4th ed., Prentice Hall, Upper Sable River, NJ, 1999. ISBN 0-13-095990-1.

The IJVM MAL (p. 262-264) IJVM Microinstruction 1 (MIC-1) Architecture Language (1 of 4) main1

PC = PC + 1; fetch; goto (MBR)

nop1 iadd1 iadd2 iadd3

goto main1 MAR = SP = SP-1; rd H = TOS MDR = TOS = MDR + H; wr; goto main1 MAR = SP = SP-1; rd H = TOS MDR = TOS = MDR - H; wr; goto main1 MAR = SP = SP-1; rd H = TOS MDR= TOS = MDR AND H; wr; goto main1 MAR = SP = SP-1; rd H = TOS MDR = TOS = MDR OR H; wr; goto main1 MAR = SP = SP + 1 MDR = TOS; wr; goto main1 MAR = SP = SP-1; rd

isub1 isub2 isub3 iand1 iand2 iand3 ior1 ior2 ior3 dup1 dup2 pop1 pop2 pop3 swap1

TOS = MDR; goto main1 MAR = SP-1; rd

swap2 swap3

MAR = SP H = MDR; wr

swap4 swap5

MDR = TOS MAR = SP-1; wr

swap6

TOS = H; goto main1

MBR holds opcode; get next byte; dispatch Do nothing Read in next-to-top word on stack H = top of stack Add top two words; write to top of stack Read in next-to-top word on stack H = top of stack Do subtraction; write to top of stack Read in next-to-top word on stack H = top of stack Do AND; write to new top of stack Read in next-to-top word on stack H = top of stack Do OR; write to new top of stack Increment SP and copy to MAR Write new stack word Read in next-to-top word on stack Wait for new TOS to be read from memory Copy new word to TOS Set MAR to SP-1; read 2nd word from stack Set MAR to top word Save TOS in H; write 2nd word to top of stack Copy old TOS to MDR Set MAR to SP-1; write as 2nd word on stack Update TOS

2 of 20 Notes and figures are based on or taken from materials in the course textbook: A.S. Tanenbaum, Structured Computer Organization 4th ed., Prentice Hall, Upper Sable River, NJ, 1999. ISBN 0-13-095990-1.

IJVM Microinstruction 1 (MIC-1) Architecture Language (2 of 4) bipush1 bipush2 bipush3 iload1 iload2

SP = MAR = SP + 1 PC = PC + 1; fetch MDR = TOS = MBR; wr; goto main1 H = LV MAR = MBRU + H; rd

iload3

MAR = SP = SP + 1

iload4

PC = PC + 1; fetch; wr

iload5 istore1 istore2

TOS = MDR; goto main1 H = LV MAR = MBRU + H

istore3 istore4 istore5 istore6 wide1 wide_iload1

MDR = TOS; wr SP = MAR = SP-1; rd PC = PC + 1; fetch TOS = MDR; goto main1 PC = PC+ 1; fetch; goto (MBR OR 0x100) PC = PC + 1; fetch

wide_iload2 wide_iload3 wide_iload4

H = MBRU

Suggest Documents