Hades logoHades applet banner
Java processor demo (Microjava)

applet icon

The image above shows a thumbnail of the interactive Java applet embedded into this page. Unfortunately, your browser is not Java-aware or Java is disabled in the browser preferences. To start the applet, please enable Java and reload this page. (You might have to restart the browser.)

Circuit Description

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.

Print version | Run this demo in the Hades editor (via Java WebStart)
Usage | FAQ | About | License | Feedback | Tutorial (PDF) | Referenzkarte (PDF, in German)
Impressum http://tams-www.informatik.uni-hamburg.de/applets/hades/webdemos/65-microjava/10-microjava/microjava.html