Giter VIP home page Giter VIP logo

miniarm's Introduction

Build

Miniarm

A simple arm emulator

Building & Running

With Nix (Recommended)

The easiest way to build it is with Nix.

If you don't have Nix installed, you can install it using the following:

$ sh <(curl -L https://nixos.org/nix/install) --no-daemon

See here for more details about the installation.

Once you have Nix installed you should be able to run this:

$ nix-shell

This will drop you into a shell which has all the build dependencies.

Now you can build the project using the following command:

$ dune build

You will find the executable program at _build/default/bin/main.exe

With Opam

If you're an OCaml user, you can install dependencies with opam.

You can install dependencies using the following:

$ opam install . --deps-only --with-doc --with-test

And build the project with this:

$ opam exec -- dune build

You will find the executable program at _build/default/bin/main.exe

Features

This is a very simple arm32 emulator. Right now it only supports the following instructions:

add add.f32
sub sub.f32
mul mul.f32
div div.f32
ldr vldr
str vstr
mov vmov
bx

Given how simple it is, miniarm expects your program to be just a sequence of instructions which ends with bx lr

Usage

$ miniarm --help
miniarm -f [FILE]
  -f Specify the file to execute
  -help  Display this list of options
  --help  Display this list of options

Example

Say we have the following in a file called example.arm:

mov r1, #12
mov r2, #13
mov r3, #14
mov r4, #15
bx lr

You can copy _build/default/bin/main.exe into your working directory and rename it as miniarm (or just use it directly like: _build/default/bin/main.exe --help)

And we run this:

$ miniarm -f example.arm

We'd get this as output:

Ast.R6 = 0
Ast.R2 = 13
Ast.R14 = 0
Ast.R8 = 0
Ast.R7 = 0
Ast.R3 = 14
Ast.R13 = 0
Ast.R12 = 0
Ast.R5 = 0
Ast.R4 = 15
Ast.R9 = 0
Ast.R11 = 0
Ast.R0 = 0
Ast.R10 = 0
Ast.R1 = 12
Ast.R15 = 5

This is still a WIP, so please if you catch a bug open an issue.

miniarm's People

Contributors

ebresafegaga avatar jnyfah 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.