GithubHelp home page GithubHelp logo

jmcgee01125 / risc-mc8 Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 151.35 MB

An 8-bit CPU designed for Minecraft.

License: MIT License

Assembly 3.58% C 88.45% Makefile 1.04% Python 6.93%
logisim logisim-cpu logisim-evolution minecraft c

risc-mc8's Introduction

RISC-MC8 CPU

ISA version 4.5
CPU version 1.0


The ISA

The RISC-MC8 ISA is a load-store instruction set architecture created entirely of 8-bit instructions.

The following operations are supported:

  • Bitwise AND, NAND, OR, and XOR
  • Integer addition and subtraction
  • Register value copying
  • Logical bit shifting
  • Memory load and store
  • 4-bit set immediates
  • Skip next instruction if equals
  • Unconditional relative jump (signed 7-bit offset)

The ISA provides for 8 general purpose registers, each with a size of 8 bits. No zero register exists, zero may be acquired using XORI ireg.

In order to meet the instruction bit length requirements, only one register is used as the argument for each instruction.
Math and bitwise instructions use ireg as an implicit argument, and store the result in the register argument. (For subtraction, ireg is the subtrahend).
Other instructions also use ireg, their usage varies. See the ISA document for details.

Conditional branching is achieved via a SKIP instruction. If ireg equals the value in the argument register, the next instruction is skipped.
Combining one or more SKIP instructions with one or more JUMP instruction allows for the creation of arbitrarily complex branching.

For complete information about the ISA, refer to the ISA document in the resources directory.


The CPU

The resources directory contains a .circ and .litematic file. These correspond to a Logisim and Minecraft implementation.

  • To view the Logisim CPU, download Logisim-Evolution here.
  • To view the Minecraft CPU, download the Litematica mod here to allow loading the schematic into an existing Minecraft world.

Both of these CPUs have been preloaded with the compiled testcode.asm (available in the resources directory).

ISA version 4.5 provides for optional memory-mapped IO using memory addresses 0x00 and 0x01. For simplicity, neither the Logisim nor Minecraft CPU supports this feature.


Tools

The tools directory contains tools necessary for preparing code to be used on these CPUs.

assemble-risc-mc8

  • Usage: assemble-risc-mc8 <source.asm> <output.o>
  • This program is used to assemble RISC-MC8 assembly into a binary file consisting of 8-bit instructions.
  • A README in the tools directory explains syntax details.
  • The source code for this program is in the RISC-MC8 Assembler directory.

generate-mc-schematic.py

  • Usage: python generate-mc-schematic.py <assembled file> <schematic file>
  • This program is be used to convert assembled RISC-MC8 code into a Minecraft WorldEdit mod schematic file. The file may be pasted into the Minecraft CPU's instruction ROM to be run.

Media

If media is not displayed correctly, they may be found in the media directory.

Logsim CPU

Logisim overview
Logisim control unit
Logisim ALU
Logisim shifter

Minecraft CPU

Minecraft overview
Minecraft logic area
Minecraft ALU
Minecraft program counter

risc-mc8's People

Contributors

jmcgee01125 avatar

Stargazers

 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.