Bitwise is a training project for creating a computer software and hardware stack from scratch
In the process of discussing the topic of various principles of writing code, I suddenly discovered that on Habré there is not a single mention of such a wonderful project as Bitwise.
In 2017, Per Vognsen, a programmer with more than 15 years of experience who has worked for companies such as NVIDIA and Oculus, takes a break and in March 2018 starts the ambitious Bitwise training project, in which he is going to develop and write an entire software and hardware stack for simple computer from scratch and run it on FPGA.
The project was to include the operating system, compiler, system libraries, and HDL code for the CPU and peripheral controllers. The prerequisites to it are minimal – fluency in the C language (and a little Python), as well as knowledge of some algorithms and data structures from standard CS courses. Everything else is explained as you write the code.
Projects like Bitwise can be counted on one hand (I think many will remember the famous Handmade Hero from Casey Muratori). The author of this project is an excellent programmer who shows and explains each decision in the form of screencasts as he writes the code. With this short article, I would like to fill in the gap and introduce more people to the Bitwise project, as I myself have learned a lot from it.
For a general overview, I tried to conditionally break the content into 5 logical parts:
1. The project begins by writing a C-like system programming language Ion, which will be used for further development. The author gives reasons for why he made the decision to write a compiler for a new language, and not just use C. Ion development is done in pure C99, no third party libraries are used. The written compiler generates C code at the output, which is then compiled by the standard C compiler. All further development is done in the Ion language.
2. In the second part, the author starts writing an assembler and a processor emulator based on the RISC-V architecture and examines the documentation and command system in detail.
3. The third part follows the writing of one of the versions of the Forth programming language in the assembler developed earlier.
4. In the fourth part, he switches to Python and writes a prototype of his own DSL for hardware development.
5. In the final (for the moment) part, the author designs various hardware parts of the computer, starting with the basic logic gates.
Unfortunately, the project is not active at the moment. The first time there was a big pause a few months after the launch, and after a while the author returned and promised to continue the project. However, this did not last long, as from his last post on github, we learn that he is badly burned out and does not want to make any promises about the continuation yet. But in any case, what has already been done, and this is more than 100 hours of video, I consider worthy of attention:
Officially, the project was based on the handmade network platform at the link https://bitwise.handmade.network/
All code with history can be found at the link https://github.com/pervognsen/bitwise, and videos are available on the channel https://www.youtube.com/pervognsen
The video material is divided into 2 playlists (main and extra, in which some points are considered in more detail):
Bitwise – https://www.youtube.com/watch?v=ZjwvMcP3Nf0&list=PLU94OURih-CiP4WxKSMt3UcwMSDM3aTtX
Bitwise extra – https://www.youtube.com/watch?v=t0YAOfZcSfw&list=PLU94OURih-ChlhR_dQ_nfcZoyteSPYfNx
There is still hope for the revival of the project, but in any case, the material already created is an excellent guide from which, I believe, programmers of all levels can get information.