Giter Club home page Giter Club logo

arithmetic-machine's Introduction

Arithmetic Machine

Pre-task for language team

Instructions

main.c is a partial implementation of a small VM capable of performing simple arithmetic. To finish the implementation, fill out the blanks labeled with TODO. We have given a correct implementation of ADD as an example for you, and a few macros for interacting with the VM you may find useful (PUSH and POP). More complete instructions can be found in the file.

some example programs: Either DCONST, 0x3F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PRINT, HALT or DCONST, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F, PRINT, HALT should print 1.0. Which one will work on your machine depends on your implementation of DCONST and/or the endianness of your machine.

DCONST_2, ST1, DCONST_M1, LD1, DIV, PRINT, HALT should print -0.5.

Building and Usage

To build the program, you run the make command make. By default, the fibonacci program is loaded, and will run on program execution (./arithmatic_machine). To use other programs, modify main.c:269 to use other arrays.

Extra Credit

If you feel like this was too easy, feel free to add any capabilities you want to the VM.

arithmetic-machine's People

Contributors

coffeetableespresso avatar chuck-sys avatar

Watchers

James Cloos 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.