You are on page 1of 3

DESIGN DOCUMENT

Introduction:

This document explains the detail design and implementation of SIMMAC, a

virtual machine which will accept programs in the target machine level language.

SIMMAC is implemented using C language.

Project Description:

SIMMAC is a machine that will accept only a specific machine level language. It

contains a 512 bit words of memory, few registers, ALU for performing arithmetic

operations and each instruction contains an operand and an opcode. SIMMAC machine

language contains instructions with opcode and operands. Opcode such as ADD, SUB,

LDA, STR, BRH, CBR and LDI are supported and operand will hold either the value or

address of the opcode. SIMMAC should execute parallel programs in a round robin

technique where the time quantum is specified as an input.

Implementation and Design:

Memory allocation: Each instruction is stored in a char array named mem[][]. For each

node a specific amount of memory is created which is equal to length of node.

PCB struct: A Process Control Block data structure is maintained by the operating systems

for every process to keep a track of all the information of a process. To support parallel

execution of SIMMAC programs, round robin method is used which will execute the

instruction for a specific time limit. If the complete program is not executed in this
specific time, to again start the execution of the program from where it has stopped, the

register values are stored in this PCB node.

PCB_Linkedlist struct: This is a structure of linked list where each node represents a PCB

structure. A single PCB_Linkedlist node is created for each program therefore this will

keep a track of number of programs.

Approach:

When the user enters the input which can be a single file or multiple files with time

quantum, for each file a PCB_queue node is created and each instruction is loaded

into a memory in an array format(mem[][]).

This loop continues till all the files are loaded into the memory.

Once all the programs are loaded into the memory, the instructions are fetched from

the main memory and stored in instruction register(IR).

These instructions are decoded which means that the opcode and operands are

determined.

After that the instructions are executed.

As the programs are executed in round robin method each one will be executed only

for a specific time frame. If the complete program is not executed in that specific

time, the current register values are stored in PCB, so that program will resume from

the last instruction.

Once the complete program is executed, the memory is cleared for all the instruction

in that program and the program is removed from the memory to create space for

other programs.
Flow Diagram:

Start

Inputs are given from command line


which are time quantum and text files.

false True
If inputs Create PCB and allocate memory
are valid (main memory) for instructions.

If number of false
files to load
=0

True

Fetch, decode and execute the


instructions

If PSIAR = 0
Clear the memory for instruction. If time out

If PSIAR != 0
Remove the program from
memory. Save PCB with current register
values.

End

You might also like