Hades logo    Hades applet banner

TAMS / Java / Hades / applets (print version): contents | previous | next

Java processor demo (Microjava)

Java processor demo (Microjava) screenshot


This applet demonstrates the MicroJava microprocessor (Mic2) from [Tanenbaum, Structured Computer Organization, 2001].

Please wait until the applet is fully loaded. Then press the clock switch a few times to single-step through the machine cycles of the Microjava processor. It first initializes a few registers, then executes a simple program. Use the clock 1/2 switch to select manual clocking (via the clock switch) or automatic clocking.

While the applets includes all required hardware of the Microjava2 processor, at the moment only the following JVM opcodes are implemented in the microcode:

 NOP        (0x00)
 BIPUSH     (0x10)
 IADD       (0x60)
 INIT       (0xFE - implementation specific opcode, here: initialization)
The default class file (Java program) in the ROM does the following:
  addr   32-bit data   
  0000   fe002010    
  0001   03100460      
  0002   00000000
  0020   0001000f
  0021   00010000
  0022   00010100
which translates into
  fe 00 20     custom-opcode (initialization from ROM address 0020)
  10 03        bipush 03
  10 04        bipush 04
  60           iadd
  00           nop (actually starts processor initialization again...)
The processor initialization sets the constant-pool pointer to memory address 0x00010100 (address 0x0100 inside the RAM) and the stack pointer to 0x00010010 (address 0x0010 inside the RAM).

Therefore, the program first load the value 0x00000003 into TOS and memory address 0x00010010, and next loads the value 0x00000004 into TOS and memory address 0x00010011. It then adds the values and stores the result (0x00000007) into memory address 0x00010010.

Run the applet | Run the editor (via Webstart)

Impressum | 24.11.06