Coder Social home page Coder Social logo

psmths / riscal-cpu Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 267 KB

RISCAL is a 32-bit reduced instruction-set computer (RISC) designed for learning and research purposes. It is named after my dog, Rascal.

License: GNU General Public License v3.0

C++ 96.00% Makefile 4.00%
virtual-machine instruction-set-architecture assembly risc machine-code assembler obfuscation virtualization

riscal-cpu's Introduction


RISCAL CPU

RISCAL is a 32-bit custom instruction set architecture virtual machine. It is intended to be used for learning/research purposes. In a nutshell, RISCAL provides:

  • 32-bit, fixed-length instruction set
  • 16 General-purpose registers
  • FLAGS, stack pointer, return pointer registers
  • 65536 words of program memory, can be extended to 2^32 bytes
  • Ability to set up and leverage a return stack to send and retrieve data from RISCAL after exit

Getting Started

This repo comes preloaded with several examples. To build the examples:

git clone https://github.com/Psmths/riscal-cpu
cd riscal-cpu
make examples

The built examples will be available in the bin/ directory.

To leverage RISCAL from a program, use the following methods:

unsigned char *run();
void load_rom(unsigned char *rom, int rom_size);
void load_stack(unsigned char *data, int data_size);

The easiest way to get starting programming RISCAL is to grab a copy of customasm. This repo contains the custom instruction set definition in the examples directory, in the file riscal.asm to get you started, as well as plenty of supporting examples to use as guides and references.

Debugging RISCAL

As it stands RISCAL does not have a formal debugger. You can set a debugging flag, however, in the debugger.hpp file:

#ifndef DBG_HPP
#define DBG_HPP

#define DEBUG

#endif

This will print to stdout all registers for each operation that the VM performs, as well as a stack dump.

riscal-cpu's People

Contributors

psmths avatar

Stargazers

 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.