Giter Site home page Giter Site logo

vmsim's Introduction

vmsim

2024-1 Operating Systems (ITP30002) - HW #4

A homework assignment to implement a virtual memory simulator using C language.

Author

Hyunseo Lee (22100600) [email protected]

1. How to build

This program is written in C language on Ubuntu 22.04.1 LTS. To build this program, you need to use Ubuntu 22.04.1 LTS with GCC and Make installed.

After unarchiving the folder, you should see the following files:

$ ls
Makefile     README.md    example    vmsim.h      vmsim_main.c vmsim_main.h vmsim_op.c   vmsim_op.h

To build the program, run the following command in the terminal:

$ make

To cleanup the build files, run the following command in the terminal:

$ make clean

2. Usage

To run the program, run the following command in the terminal:

$ /vmsim <process_image.txt>

process_image: A text file that contains the process image.

The process image file should contain the following format:

<size of process image> <number of instructions>
<Instruction 1>
<Instruction 2>
...

Here is an example of the process image file:

16384 9
M 0 10
M 1 20
M 2 30
A 3 0 1
A 4 1 2
S 3 0x1000
S 4 0x2000
L 5 0x1000
L 6 0x2000

3. Instructions

There are 4 types of instructions:

  • M: Move integer value into register
    • Ex) M 0 10 means move 10 into register #0.
  • A: Add the integer value of RegSrc1 and the integer value of RegSrc2. The result is stored in RegDst.
    • Ex) A 3 0 1 means add the integer value of register #0 and the integer value of register #1. The result is stored in register #3.
  • L: Load 4-bytes integer value from the specified memory address into register.
    • Ex) L 5 0x1000 means load 4-bytes integer value from the memory address 0x1000 into register #5.
  • S: Store 4-bytes integer value of register at the specifed memory address.
    • Ex) S 3 0x1000 means store 4-bytes integer value of register #3 at the memory address 0x1000.

vmsim's People

Contributors

iamhslee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.