A MIPS R3000 Simulator in Java

This simulator was developed mainly for testing and debugging the new Topsy Operating System. It was written by George Fankhauser and has been published under GPL together with Topsy.

It has a gdb-interface using a TCP/IP connection and supports verbose commenting of processor exceptions and also a trace mode.

Here's a short report explaining some details.

The simulator is a terminal application (i.e. runs in a shell) but for demonstration purposes I also constructed an applet out of it (for this only 2 classes were added and a few lines had to be changed). Click here for the demo. Here's the soure for the demo-applet: MipsSimulatorApplet.tar.gz. Have a look at the makefile for information about diffs to the terminal version. red bar

Packages/CVS access

Source code (terminal-mode, with gdb-interface): MipsSimulator.tar.gz

For the latest source, try:

cvs -d :pserver:anonymous@drwho.ethz.ch:/usr/drwho/vault/cvs/topsy login (pw:anonymous)

cvs -d :pserver:anonymous@drwho.ethz.ch:/usr/drwho/vault/cvs/topsy checkout MipsSim

Installation

  • Unpack the source (using gzip, gnutar or winzip)
  • Compile the source with 'javac *.java'
  • Usage

  • Start the simulator with 'java Simulator [-t] [-s] [-v] [-b] [-l] kernel'
  • Example to start a kernel named topsy.srec in big-endian configuration:
    java Simulator topsy.srec
  • Use the follwing options:


  • Options 
    Default
    Command line switch
    trace
    false
    -t tracefile
    symbolic trace
    false
    -s kernelsymbolfile
    verbose
    false
    -v
    addressing mode
    big endian
    -b, -l
    boot-rom filename
    boot.eprom
     
    default kernel name
    topsy
    kernelname

  • If the boot ROM is not found, the simulator inserts automagically instructions to jump to the kernel's start address at the processors reset vector 0xbfc00000
  • Kernel file format: S-records with S3 (load 32bit values) and S7 (jump to 32bit address). For more details see the gnu objcopy tool (binutils) how to produce s-records.
  • gdb Support

    The simulator uses the same gdb-interface as Stanford's Simos does. You can grab gdb-simos from Stanford or use my local sparc-binary of gdb-simos To connect just type "gdb-simos topsy.ecoff", and then at the gdb prompt "target simos host:portnumber" (e.g. target simos tardis-a3:2345)

    Running MIPS Linux

    Of course, MipsSim runs Linux too. Here's what you get with a modified 2.2.13 kernel:

    
    pong:/home/gfa/Topsy/MipsSim > java  Simulator vmlinux.srec 
    
    MIPS R3000 (big endian) Simulator - (c) 1996-1999 gfa
    trace=false (symbolic=false), gdb=false, verbose=false
    ROM not initialized (imagefile: boot.eprom, java.io.IOException)
    java.net.NoRouteToHostException (No route to host)
    Ethertap: couldn't connect to Ethertap server.
    Loading from vmlinux.srec ...............................ok.
    
    Loading R3000 MMU routines.
    MIPS R2000/R3000, rev. 0x00000230
    Instruction cache 0kb
    Data cache 0kb
    Linux version 2.2.13 (gfa@orange7) (gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)) #59 Tue Jan 18 18:00:23 MET 2000
    Calibrating delay loop... 0.82 BogoMIPS
    Memory: 3044k/4092k available (560k kernel code, 228k data)
    Checking for 'wait' instruction...  unavailable.
    POSIX conformance testing by UNIFIX
    Linux NET4.0 for Linux 2.2
    Based upon Swansea University Computer Society NET3.039
    Starting kswapd v 1.5 
    Signetics SCN2681 serial driver (gfa) 0.1
    ttyS00 at 0x000000 (irq = 4)
    ttyS01 at 0x000000 (irq = 4)
    ttyS02 at 0x000000 (irq = 4)
    ttyS03 at 0x000000 (irq = 4)
    RAM disk driver initialized:  16 RAM disks of 4096K size
    VFS: Cannot open root device 00:00
    Kernel panic: VFS: Unable to mount root fs on 00:00
    
    
    If you need a patch, just mail me...

    Ok, I didn't set a RAM disk image to mount. The symbolic boot trace is nevertheless interesting.

    Compare this to Topsy's boot trace.

    red bar

    Last update Fri Jul 14 17:52:02 MET DST 2000
    Copyright 1997-2000 George Fankhauser, this page is not official ETH information.
    This page has been accessed times.

    Best Viewed With Any Browser