Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

Latest commit

 

History

History
88 lines (64 loc) · 4.65 KB

README.md

File metadata and controls

88 lines (64 loc) · 4.65 KB

Mima IDE

Simple environment for writing Mima-Code (see http://gbi.ira.uka.de/ chapter 10)

This is a simple IDE developed for writing code targeted at the Mima (Minimal Computing Machine) taught at KIT (Karlsruher Intitute for Technology).

This is a personal project to gain experience in GUI programming using the Java Swing Api. The design is based on the design of the Jetbrains product and builds on the open-source Darcula Look and Feel but extends it in a lot of ways to keep up with the newer Darcula design with didn't yet make it into the LaF.

How to use

You can run either the jar or executable from .\build or the release page. No further installation is needed. You can also compile it yourself using maven.

What is a Mima

The Mima or minimal Machine is an idealized Prozessor taught at the KIT. It uses, as the name implies, a minimal set of prozessor instruction to achieve full computational power.

The Mima uses registers that are 24bit long and store numbers in twos complement. To encode the instructions the first four bytes of the register are reserved and the remaining 20 bits are used for the argument. This implies that arguments can only be positive numbers as negative numbers need to be stored in 24 bits.

An extended version of the Mima called MimaX adds some further capabilities to support callstacks and 24bit values in adresses and argument constants.

Instructions of the Mima(X)

<a> denotes the value in memory at address a

c is a constant value

accu is the accumulation register

iar is the instruction address register

sp is the stack pointer

rs is the return stack

Mima Instructions:

Instruction Description
LDC c c ⟶ accu
LDV a <a> ⟶ accu
STV a accu ⟶ <a>
LDIV a <<a>> ⟶ accu
STIV a accu ⟶ <<a>>
NOT invert all bits in accu
RAR rotate bits in accu one place to the right
ADD a accu + <a> ⟶ accu
AND accu AND <a> ⟶ accu (bitwise)
OR accu OR <a> ⟶ accu (bitwise)
XOR accu XOR <a> ⟶ accu (bitwise)
EQL a if <a> = accu then -1 ⟶ accu else 0 ⟶ accu
JMP c c ⟶ iar
JMN c if msb of accu = 1 then c ⟶ iar

Additional MimaX Instructions:

Instruction Description
CALL c rs.push(iar) and c ⟶ iar
RET rs.pop() ⟶ iar
ADC c accu + c ⟶ accu
LDSP sp ⟶ accu
STSP accu ⟶ sp
STVR disp,SP accu ⟶ < + disp>
LDVR disp,SP <<sp> + disp> ⟶ accu

Language implementation details

The IDE utilizes an internal Mima language with makes it easier to produce working code.

  • Comments: #... or #...#.
  • Definitions:
    • §define "def" = "value" (use with e.g. STV "def").
    • §define const "ref" = "value" (use with e.g. LDC("ref")).
    • "ref" : ... (use with e.g. JMP "ref").
  • Statements must be terminated by ;.
  • Arguments are passed within parenthesis (e.g. STV(5), LDVR(1,SP())
  • SP is a function call, so it has to be used by typing SP() and not SP.
  • You can use scopes { ... } for variable shadowing. Variables are lost outside the scope except they explicitly define a memory cell. Constants are lost indefinitely.
  • Variables must be defined before they can be used. Jumps are the only exception for this.
  • You can not jump into an inner scope. Jumps can only occur within the same or an outer scope.