Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
/ tern Public archive

A poorly implemented VM with a MIPS-style architecture based on balanced ternary arithmetic

License

Notifications You must be signed in to change notification settings

jdanford/tern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notice

Tern has been superseded by BTM, but the previous README remains below

Tern

This is a poorly implemented VM with a MIPS-style architecture based on balanced ternary arithmetic. It operates on 6-trit trytes, 12-trit halfwords, and 24-trit words, and has built-in support for text encoded in UTF-6t, the ternary analogue of UTF-8. This project is not finished, as the intention is to eventually replace it with a much better design, informed by the many lessons I've learned along the way about Rust programming and VM/CPU design.

Improvements for the next version

  • Use as little unsafe code as possible
  • Address trytes instead of trits
  • Operate on trytes as 16-bit integers instead of individual trits as bytes
  • Encode every instruction as a single word
  • Match the classic MIPS instruction set more closely
  • Add a div instruction for integer division and modulus
  • Use a real parser for the assembler instead of a pile of regexes
  • Implement UTF-6t functionality in assembly code instead of opaque syscalls

Usage

There are a few binaries in the project, but the primary one is run, which allows you to execute the assembly files in the programs directory: cargo run --bin run programs/hash.tasm

About

A poorly implemented VM with a MIPS-style architecture based on balanced ternary arithmetic

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages