JOP - Java Optimized Processor

 

Home
Documentation
Publications
Performance
Download
Applications
Simulation
Links

Cyclone Board
LEON/Nios
Acex Board

LEGO MindStorms
Java TCP/IP

Teaching Material

Contact

Third Approach: A stack machine

In JOP2 a basic JVM instruction like iadd needs 3 cycles: load, add and store. This can be reduced if the ALU is moved to the stack. The instruction set is changed to reflect this: ALU operation are done only with the operands from the stack. But this means that the stack is used for the Java stack and for internal operations of the JVM.

The stack

The stack is implemented in local memory with independent read and write ports. The top two elements are registers. The ALU operation is done with these registers. To fill the second register one memory read is necessery.

Local variables are also stored in the stack memory. A load needs one memory read for the variable and one store to write the second register back to the memory.

Fetch and Decode

By merging the former jump table and the micro code ROM the pipeline can be reduced to four stages:
  • byte code fetch/decode
  • jop instruction fetch
  • jop instruction decode/address generation
  • jop instruction execute
The JVM instruction is used to address the first JOP instrucion in the ROM. If it can be executed with one JOP instruction we are done and the next JVM instruction is fetched. If not, a micro code jump is executed to a memory location above 255. This decision is made during the fetch and there is no overhead of the jump. This means if a JVM instruction needs two JOP instructions it takes two cycles to execute them. The jump takes no additional cycle.

Adding some hardware (an adder for the new JVM pc) a JVM conditional and unconditional goto can be executed in four cycles.

Instruction Set

One instruction needs 16 bits (like JOP1). But the jump table is saved. Five bits are used for the instruction. Eight bits for a jump address, an immediate value or additional instruction coding.

Three bits have a special meaning:

  • fetch a new byte code as JVM instruction
  • fetch a new byte code as JVM operand
  • take a micro code jump

The instruction set of the current JOP3 implementation:

00000 pop
00001 and
00010 or
00011 xor
00100 add
00101 sub
00110 bz
00111 bnz
01000 st mem
01001 st periph
01010
01011 st vp, ap
01100 st (vp+d/idx)
01101
01110 st sp
01111 jbr
10000 nop
10001 shr
10010 jbr goto
10011
10100
10101
10110
10111
11000 ld mem
11001 ld periph
11010 ld imm
11011 ld sp, vp, cp
11100 ld (vp+d/idx), ld (cp+idx)
11101 ld opd
11110
11111 dup

Diagrams

Java and JOP fetch

Address generation

Execute

A final word (for now)

It's about two times faster then JOP2. The third approach has been verified in different applications.

Some further enhancements have to be documented.


Copyright © 2000-2007, Martin Schoeberl