swapforth
subleq
Our great sponsors
swapforth | subleq | |
---|---|---|
5 | 9 | |
270 | 52 | |
- | - | |
4.6 | 4.8 | |
4 months ago | 9 days ago | |
Forth | Forth | |
BSD 3-clause "New" or "Revised" License | The Unlicense |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
swapforth
- Making my own forth implementation
- FPGAs for interpreted programming languages?
-
How many LUT for an 8 bit CPU?
Thanks! Found the port of this to the board I want :) https://github.com/jamesbowman/swapforth/tree/master/j1a
-
The RISC Deprogrammer
It's a standard thing to do in EE curricula; you normally do it in a one-semester class, and there are literally thousands of open-source synthesizable CPU cores on GitHub now.
To take two examples to show that designing a CPU is less work than writing a novel:
- Chuck Thacker's "A Tiny Computer", fairly similar to the Nova, is a page and a half of synthesizable Verilog; it runs at 66 MHz in 200 LUTs of a Virtex-5: https://www.cl.cam.ac.uk/~swm11/examples/bluespec/Tiny3/Thac...
- James Bowman's J1A is more like Chuck Moore's MuP21 and is about three pages of synthesizable Verilog: https://github.com/jamesbowman/swapforth/blob/master/j1a/ver... and https://github.com/jamesbowman/swapforth/blob/master/j1a/ver.... You can build it with Claire Wolf's iCEStorm (yosys, etc.) and run it on any but Lattice's tiniest FPGAs; it takes up 1162 4-input LUTs.
I haven't quite done it myself. Last time I played https://nandgame.com/ it took me a couple of hours to play through the hardware design levels. But that's not really "design" in the sense of defining the instruction set (which is also kind of Nova-like), thinking through state machine design, and trying different pipeline depths; you're mostly just doing the kind of logic minimization exercises you'd normally delegate to yosys.
In https://github.com/kragen/calculusvaporis I designed a CPU instruction set, wrote a simulator for it, wrote and tested some simple programs, designed a CPU at the RTL level, and sketched out gate-level logic designs to get an estimate of how big it would be. But I haven't simulated the RTL to verify it, written it down in an HDL, or breadboarded the circuit, so I'm reluctant to say that this qualifies as "designing a single CPU" either.
-
The J1 Forth CPU
Also worth checking is the Swapforth Github repository.
subleq
-
The ancient world before computers had stacks or heaps
I wrote a Forth interpreter for a SUBLEQ machine (https://github.com/howerj/subleq), and for a bit-serial machine (https://github.com/howerj/bit-serial), both of which do not have a function call stack which is a requirement of Forth. SUBLEQ also does not allow indirect loading and stores as well and requires self-modifying code to do anything non-trivial. The approach I took for both machines was to build a virtual machine that could do those things, along with cooperative multithreading. The heap, if required, is written in Forth, along with a floating point word-set (various MCUs not having instructions for floating point numbers is still fairly common, and can be implemented as calls to software functions that implement them instead).
I would imagine that other compilers took a similar approach which wasn't mentioned.
- Show HN: Computing with just one instruction – Forth on SUBLEQ
-
SUBLEQ eForth book
I've already posted about the implementation on Forth, but you might want to see how such a system is created in detail along with the design decisions and compromises. The source code can be freely viewed at https://github.com/howerj/subleq.
- Show HN: A single instruction computer running Forth
- Forth on a SUBLEQ (A One Instruction Set Computer)
- Forth Running on a One Instruction Set Computer
- Computing with Just One Instruction
What are some alternatives?
arkam - A Simple Stack VM and Forth
Mako - A simple virtual game console
lbForth - Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
durexforth - Modern C64 Forth
gforth - Gforth mirror on GitHub (original is on Savannah)
gforth-raylib - Raylib 3.5 bindings for Gforth. The name is backwards for obvious reasons.
elfort - A Forth metacompiler that directly emits an executable binary for x86-64 Linux written in Arkam
calculusvaporis - A tiny CPU
nasmjf - NASM port of JONESFORTH!
discussion - Discussion repository for Forth enthusiasts.