Giter Site home page Giter Site logo

tisa's Introduction

TISA

TISA stands for Tiny ISA.

Bulding and executing

For building the project we're using cmake.

mkdir build
cd build
cmake ..
make

Then run with: ./tisa ../input.s --dump

Supported instructions

  • ADD rx, ry // rx = rx + ry
  • SUB rx, ry
  • DIV rx, ry
  • MUL rx, ry
  • BRZ rx, DES // PC += DES se rx = 0
  • BRNZ rx, DES // PC += DES se rx != 0
  • BRLZ rx, DES // PC += DES se rx < 0
  • BRGZ rx, DES // PC += DES se rx > 0
  • IBRZ rx, ADR // PC = MEM(ADR) se rx = 0
  • MOV rx, ry // rx = ry
  • LOADM rx, ADR // rx = MEM(ADR)
  • STOREM rx, ADR // MEM(ADR) = rx
  • LOADI rx, VAL // rx = VAL
  • WRITE rx // printf(“%d\n”, rx)
  • READ rx // scanf(“%d”, rx)
  • EXIT // exit(0)

Example

int x = 0;
for (int i = 100; i > 0; i--) {
  for (int k = i; k > 0; k--) {
    x += k;
  }
}
printf("%d\n", x);

The C code above is translated to:

LOADI r1, 0
LOADI r3, 1
LOADI r2, 100
MOV r4, r2
ADD r1, r4
SUB r4, r3
BRNZ r4, -2
SUB r2, r3
BRNZ r2, -5
WRITE r1
EXIT

tisa's People

Contributors

grdsdev avatar

Stargazers

Andrew Johnson 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.