This project is about developing an easy-to-use high-level hardware development tool, and an FPGA board to use it on. I want to make the compilation and place-and-route time as fast as reasonably possible.
In the 1990s and early 2000s some work was done on compiling high-level languages into hardware. For several years Handel-C was in use, and was a popular language on many university courses.
There were certain features of Handel-C that I really liked - it had a very concise syntax, and it was quite easy to think about the concurrency model when writing programs. The language is small enough to be easily understood in it’s entirety, and anybody who is already familiar with C and with digital logic can learn Handel-C very quickly. The development tool will use a subset of Handel-C.
Handel-C is a language related to C and Occam, designed for the purpose of translating programs directly into hardware. Handel-C was available and in use about 10-20 years ago, I'm not sure whether anybody still uses it now. Originially developed and sold by Celoxica, the DK Design Suite product which includes an implementation of Handel-C has since been aquired by Mentor Graphics.
Although Handel-C allowed more-or-less direct compilation of ANSI-C programs to hardware circuits, the resulting circuits were seldom very good. More usually, Handel-C and the associated IDE served as a rapid development language and environment, in which a programmer could directly write parallelised, pipelined Handel-C programs which would result in a reasonably efficient circuit. It was also possible to use it to gradually refine an ANSI-C program into a form more suitable for hardware implemention.
The subset of Handel-C that I am working on is called 'Small-HC'. It supports some of the features of Handel-C, and more will be added over time. The following features are currently supported:
'unsigned' variables with specified width - generally these correspond to registers in the resulting circuit
'signal' qualifier to indicate that a variable represents a wire rather than a register.
Internal RAM (on-FPGA) and external RAM (connected via device pins)
'par' and 'seq' constructs for parallel and sequential composition of statements
Input ports, through which specified FPGA pins can be connected to signals
Output ports, through which variables can be connected to FPGA pins
Currently no direct support for multiplication,division,modulus
A short example program for flashing an LED (very quickly) is shown below:
unsigned 1 testbit; port output(testbit) (163); // 163 is the output pin number on the FPGA
The starting point for this project will be a compiler for a subset of the Handel-C language. I want to target Lattice iCE40 FPGAs, because the bitstream for these devices has been reverse engineered, and open source place and route tools are available. (See project IceStorm).
This compiler is based on the same research into hardware compilation that Handel-C was based on. One of the key papers can be found here: Compiling occam into FPGAs
Initially my Handel-C subset compiler will be modified to produce verilog output (it was originally written to produce VHDL suitable for Atmel AT40K FPGAs), which can be fed into the IceStorm tools. Later, the compiler will produce a netlist, and I’ll write my own tools to map and place-and-route for the iCE40 architecture.