Close

VBCC C Compiler now working !!

A project log for SPAM-1 - 8 Bit CPU

8 Bit CPU in 7400 with full Verilog simulator and toolchain

John LonerganJohn Lonergan 07/14/2022 at 16:320 Comments

I've Made really good progress on porting a the C compiler to SPAM-1.  The capability of the product of my labours is best seen from the integration tests which can be seen in the SPAM-1 assembler test suite...  

https://github.com/Johnlon/spam-1/blob/master/jvmtools/compiler/src/test/scala/asm/VbccAndAssemblerTest.scala

This test suite is pretty reliable in that it uses VBCC to compile various C of increasing complexity each down to SPAM-1 assembler, it then converts the assembly to ROM images and then runs the ROM images on the Verilog simulation.

See actual the SPAM-1 VBCC code is https://github.com/Johnlon/spam-1-vbcc/tree/main/demo - needs doco and also needs a way to keep is up to date with changes in the core VBCC code base.

I will do a vidoe at some point to cover getting started with porting it as there's nothing out there that I found really useful.

There are loads of undone stuff like I support 32 bit integer arithmetic only, I only support add and nothing else yet -  there's probabl;y a ton of language features I've not covered. However, supporting 32 bit is cool on an 8 bit CPU and adding other arith ops isn't hard.  Also I want to add at least 8 bit ops since they are native to the hardware and would be super fast. 

I really think this is something others building such machines would benefit from.

GCC and LLVM were basically impenetrable.

Discussions