Giter VIP home page Giter VIP logo

parm_assembler's Introduction

parm_assembler

PARM Assembler is a library for assembling a subset of the ARM instruction set. It is designed to be used in conjunction with logisim-evolution, a digital logic simulator. It was written as a part of the Computer Architecture course.

Examples

        const INPUT: &str = "
            movs r0, #0
            movs r1, #1
            .goto:
            movs r2, #20
            cmp r0, r1
            bMI .then1
            b .endif1
            .then1:
            rsbs r2, r2, #0
            .endif1:
            cmp r2, r1
            bLT .then2
            b .endif2
            .then2:
            movs r0, #50
            b .goto
            .endif2:
            adds r3, r0, r2
            @a comment";

        let output = parm_assembler::export_to_logisim(INPUT).unwrap();

        // logisim-evolution expects the output to be in the following format:
        let expected = "v2.0 raw\n2000 2101 2214 4288 d4ff e7ff 4252 428a dbff e000 2032 e7f4 1883";

        assert_eq!(expected, output);

Supported instructions

See the assignment for a full list of supported instructions.

Overview

  • Each instruction is an enum variant.
  • Each instruction is associated to a struct representing its operands.
  • Each operand is an enum variant.
  • Lines are parsed into a vector of Instructions using the nom crate.
  • The Instructions are then converted into a byte vector using the bitvec crate, each one being 16 bits long.
  • The byte vector is then converted into a string of hexadecimal numbers.

parm_assembler's People

Contributors

guekka avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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