Coder Social home page Coder Social logo

ite2031's Introduction

ITE2031 - Computer Architecture Project (LC-2K)

In this project, we implemented simple assembler and simulator for LC-2K Instruction-Set Architecture.

What is LC-2K?

The LC-2K is an 8-register, 32-bit computer. All addresses are word-addresses. The LC-2K has 65536 words of memory.

Supported instructions

This simulator supportes 3 type instructions followed.

  • R-type instructions (add, nor):
    • bits 24-22: opcode
    • bits 21-19: reg A
    • bits 18-16: reg B
    • bits 15-3: unused (should all be 0)
    • bits 2-0: desgReg
  • I-type instructions (lw, sw, beq):
    • bits 24-22: opcode
    • bits 21-19: reg A
    • bits 18-16: reg B
    • bits 15-0: offsetField (a 16-bit, 2's complement number with a range of -32768 to 32767)
  • J-type instructions (jalr):
    • bits 24-22: opcode
    • bits 21-19: reg A
    • bits 18-16: reg B
    • bits 15-0: unused (should all be 0)
  • O-type instructions (halt, noop):
    • bits 24-22: opcode
    • bits 21-0: unused (should all be 0)

How to build

First of all, you should clone this repository.

git clone https://github.com/JYPark09/ITE2031

And by using make, you can get assemble and simulate programs.

cd ITE2031
make

Test cases

samples/test.as

This test performs the same behavior as the C code below.

int i = 5;

do {
    i = i + (-1);
} while (i != 0);

samples/test1.as

This test is designed to check offsetField overflow condition. This code cannot generate machine language file.

samples/test2.as

This test is designed to check undefined label using. This code cannot generate machine language file.

samples/test3.as

This test is designed to check unrecognized opcode. This code cannot generate machine language file.

samples/test4.as

This test is designed to check duplicated label. This code cannot generate machine language file.

samples/test5.as

This test is designed to check invalid arguments. This code cannot generate machine language file.

samples/test6.as

This test performs the same behavior as the C code below.

int i;
int res = 0;

for (i = 1; i < 10; ++i)
    res += i;

samples/test7.as

This test is designed to ensure that the jalr instruction was implemented correctly.

samples/test8.as

This test is intended to ensure that the lw instruction was implemented correctly.

samples/test9.as

This test is designed to ensure that the nor instruction and lw/sw offset were implemented correctly. This test performs the same behavior as the C code followed.

int i, j;
int arr[10] = { 0 };

for (i = 0; i < 10; ++i) {
  for (j = 0; j < i; ++j) {
    arr[i] += i;
  }
}

samples/test10.as

This test is the stress test. The simulator will execute a lots of instructions for calculate many matrix additions.

ite2031's People

Contributors

frechele avatar

Stargazers

Park Hyean Sue 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.