# MikroSim

MikroSim is an educational computer program for hardware-non-specific explanation of the general functioning and behaviour of a virtual processor, running on the Microsoft Windows operating system. Devices like miniaturized calculators, microcontroller, microprocessors, and computer can be explained on custom-developed instruction code on a register transfer level controlled by sequences of micro instructions (microcode). Based on this it is possible to develop an instruction set to control a virtual application board at higher level of abstraction.

## General

Initially MikroSim was developed to be a processor simulation software to be widely available in educational areas. Since MikroSim operability starts on the basis of microcode development, defined as a sequence of micro instructions (microcoding) for a virtual control unit, the software's intention is on first approach a microcode simulator with various levels of abstractions including the ability of CPU simulators and instruction set emulators. In the current software revision it is feasible for a microcode controlled virtual application to operate on own coded instruction sets. With MikroSim typical and well-known concepts in the area of computer engineering like computer architecture and instruction set architecture are non-specifically treated, which have been established since the early days of the information era and being still valid. In this fashion the simulation software gains a timeless, free didactical benefit without being restricted on special developments of the past and in the future. The detailed documentation and the bilingual application's graphical user interface (GUI) in German and English, as well as the software's upward compatibility given to some extent by Microsoft's operating system Windows, are reasons for being a well-established, valuable e-learning tool in the field of computer engineering since 1992 for educational use.

## History of development

The software is based on a version written under Turbo Pascal compiled for MS-DOS operating systems which has been used for educational purposes in computer engineering and computer science at the Philipps-University Marburg (Germany) until 1992. The concept was picked up by Martin Perner during his study of physics (1990–95) in summer 1992, revised, and converted into a windows application compiled with Microsoft Visual Basic and running on Windows 3.1x. In doing so, at this time a simulator with huge conceptual improvements arose by exploiting the novel functionality and utilisation of MS Windows’ GUI for supporting the composition of microcode and the traceability of its instructional influence. The enhancements of the e-learning tool under Windows has been supported and promoted by the Fachbereich Mathematik/Informatik of the University of Marburg by Heinz-Peter Gumm until end 1995.
The Simulator has been awarded with the European Academic Software Award 1994 in the computer science category in Heidelberg (Germany) in November 1994. In March 1995 the simulator was presented at the computer exhibition CeBIT’95 in Hannover at the exhibit of the Hessischen Hochschulen. Between 1995 and 2000 the simulator was published as Mikrocodesimulator MikroSim 1.2 without any significant improvements. At this time the tool received an award of 1000 ECU from the European Union in conjunction with the European Year of Livelong Learning 1996. In 1997, the software was presented at the Multimedia Transfer’97 contest in connection to the LearnTec’97 exhibition. In its penultimate revision, the simulator has been published as Mikrocodesimulator MikroSim2000, optimized for MS Windows 95’s 32-bit operation.
Between 2008 and 2009, the simulator concept has been revised, reworked, and thoughtful extended. So it has received wide-ranging improvements and extensions without touching the successful conceptual aspects of the microcode simulation abilities in the core. For this purpose, advantage is taken of today’s computing system’s performance determined by operating system and underlying computational power to extend MikroSim’s simulation possibilities up to the stage of a virtual application board. MikroSim is compiled and optimized for sake of unrestricted compatibility and for widest distribution possible for MS Windows XP as a 32-bit version. The program runs on all 32- and 64-bit operating systems of MS Windows Vista and MS Windows 7. Thereby, no special XP compatibility mode is needed. Since January 2010, the simulator is distributed as Mikrocodesimulator MikroSim 2010 by 0/1-SimWare.

## Functionality

The Windows application allows for the gradual establishment of a virtual application that is predetermined and such unchangeable in its functionality.
In exploration mode, the operating principle and control of newly added components influenced by one microcode instruction within a cycle can be evaluated. The width of MikroSim’s micro instructions is 49 bits. A single micro instruction is executed in three phases of a 3-phase clock. The partial phases are referred to as "GET", "CALCULATE" and "PUT" phase, causing to fetch some register value, to execute a 32-bit calculation, and to store the calculation result into a CPU's internal register, finally.
In simulation mode, seamlessly executed micro instructions control the central processing unit of the simulator in subsequent cycles. Therefore, the intrinsic ability of one micro instruction is utilized to address the next micro instruction in the control store. The control store holding the micro instruction set (commonly referred as "microcode") comprises 1024 micro instructions words each 49-bit wide.
Using structuring opportunities of the control store for addressable scheduling of the microcode and the implementation of a cyclically operating machine code interpreter, that is programmed in microcode as well allows the implementation of individual micro-operation sequences, known as machine instructions. The microcode can be regarded as firmware for MikroSim, that can be modified, and stored in and reloaded from a microcode-ROM-file.
Within a micro instruction execution cycle, the CPU as well as an input / output controller is connected to an external 16 KB huge random access memory device (RAM). Via the input-output controller device, communication with virtual input and output devices is supported by Direct Memory Access mode (DMA), Inter-Integrated Circuit Connection (I2C), and Interrupt request functionality (IRQ). A output port, a display, a timer, an event trigger, a digital-analog converter, a keyboard and data input / output channel is provided as virtual IC device for explaining didactically the communication with external devices.
The microcode simulator uses eight freely usable register each 32-bit wide connected with a 32-bit arithmetic logic unit (ALU). The register content can be regarded as signed or unsigned integer values, or as 32-bit floating point numbers. The register content can be easily viewed, interpreted, and modified bitwise an integrated system number editor.
The 32-bit ALU is the key unit of the central processing unit. It supports 128 different basic arithmetic operations for integer operation, interrupt control, and for floating point arithmetic.
The didactical approach to floating point calculations, which has been introduced in a comparable manner already in the early 1940s by Konrad Zuse, is introduced by using elemental sublevel operations for exponent and mantissa involved in the key operations of addition/subtraction and multiplication/division. A set of powerful 32-bit floating point arithmetic commands in mantissa and exponent for the basic operations and elementary analytical functions are provided, as they are realized in today's mathematical coprocessors. Here, in the simulation with MikroSim it is ideally assumed that the execution of each supported ALU arithmetic operation requires only a distinct computing duration independent of circuit complexity realistically needed in practice.
The execution of micro instructions can be operated on various simulation levels with different temporal resolution:
* In the lowest simulation level, the simulator supports the phased wise execution of GET, CALCULATE, and PUT phase. The processing of the partial phases is possible with an adjustable delay for better traceability.
* In next upper level, the current micro instruction is executed in a complete three-phase clock without time delay. A continuous execution of several 3-phase clock cycles is supported within a so-called “Load Increment Execute” (LIE) cycle. The LIE cycle regarded as an interpreter written in microcode has the function to load machine instructions coded as byte value from the external RAM and to let branch the micro instruction sequence to the referenced microcode subroutine for execution given by the opcode and returning to the LIE back to retrieve the next machine instruction.
* One execution level higher, a sequence of several machine instructions are executable until a user-defined break point is reached, which is placed in the machine code sequence. It is possible to measure run times between break points. So it is possible to benchmark execution performance on machine and microcode level.
* In the top most simulation level the microcode simulator continuously executes micro instructions without interrupt. In this level, machine instruction by machine instruction is loaded. So, it is possible to focus on the interaction of the CPU with external devices.
With various additional options, visual CPU activities can be suppressed for the benefit of increasing the processing speed when the control of the application by machine programming is put forward. The performance index monitor provided with the simulator enables the user to benchmark the processing performance of MikroSim and setting it into relation with computing power of the simulator's hardware, measurable in floating-point operations per second (FLOPS) and instructions per second (IPS).
With the "Basic Assembler Tool for MikroSim" MikroBAT, simple programs can be developed in assembler programming language. Here, all supported mnemonics of the assembler programming language are determined by the user's self-created machine's instruction set on micro instruction level. The add-on tool is able to translate the assembly language program into machine code and data and transferring the binary code into the external RAM for subsequent simulations. Together with MikroBAT the microcode simulator MikroSim supports the didactical introduction of teaching aspects in technical computer science from a switch-controlled calculating machine to an assembler programmable application.