Transmogrifier C

What is Transmogrifier C ?

Transmogrifier C (or tmcc) is a compiler for a simple hardware description language. It takes a program written in a restricted subset of the C programming language, and produces a netlist for a sequential circuit that implements the program.

The netlist can be used to program a Xilinx XC4000 series FPGA (Field-Programmable Gate Array). It also can be used to program Altera's Flex 8000 and Flex 10000 series FPGAs.

You can download the Transmogrifier C source and documentation (216 Kbytes) from host in the directory /pub/software/tmcc. The most recent version is 3.1, created January 10, 1996.

The compiler compiles and runs under:

You will need your own copy of the Xilinx ppr and makebits programs. The compiler's output is compatible with both Xilinx XACT 4.31, and XACT 5.1.

A Quick Example

Here is a simple tmcc program that makes the 8 LEDs on the Xilinx 4000 demo board count up:

#pragma intbits 8

main() {
	int lights, count;

	outputport(lights, 60, 59, 58, 57, 66, 65, 62, 61);

	count = 0;
	while(1) {
		count = count + 1;
		lights = ~count;

The program starts with a #pragma statement telling the compiler that integer variables are eight bits long. It declares two of these variables. The outputport routine tells the compiler that the lights variable is really a set of 8 output pins on the chip, and specifies the pin numbers. The program then goes into an infinite loop, incrementing the count. The LEDs on the demo board are wired so that a 0 output turns them on, and a 1 output turns them off. To reverse this, we use C's ~ complement operator.

Who Did This ?

Transmogrifier C borrows its name from the Transmogrifier series of field-programmable systems constructed at the Department of Electrical and Computer Engineering, University of Toronto . The Transmogrifier 1 (TM-1), was a field-programmable system consisting of FPGAs, RAMs and programmable interconnect chips. It was designed and built by Dave Karchmer under the supervision of Jonathan Rose, Paul Chow, David Lewis, and Dave Galloway.

The Transmogrifier 2 (TM-2) is a much larger, more capable machine that is in active use.

The Transmogrifier C compiler has been used to produce circuits that run on the TM-1. It was written by Dave Galloway.

Is It Useful ?

The compiler has been used by a number of people. It was used in the summers of 1994/95 to produce several circuits that did graphics on LCD screens. The largest circuit was about 1200 lines of tmcc code, and fit into four XC4010s. The circuits work.

More recently, tmcc has been used to produce larger circuits for graphics acceleration of polygons with procedural textures.

Tmcc is not a replacement for VHDL or Verilog for people who are serious about producing a circuit design on time, and under budget. It will have bugs.

It may be interesting to someone who does know C, and wants to throw together a circuit in a couple of days to investigate its properties, or get an upper limit on the size or cycle time of a proposed design.

More Information

A paper on the internals of the tmcc compiler was presented at the IEEE Symposium on FPGAs for Custom Computing Machines (FCCM '95) in Napa, California in April 1995.

Bug Fixes

Unfortunately, we don't have a lot of time to work on tmcc so we can't promise anything in the way of support.

Changes From 3.0 to 3.1

Version 3.0 of tmcc was released in November 1994. Version 3.1 is better in a number of ways:

Implemented more of the C language, and expanded the language definition:

Produces smaller, faster circuits. The 3 circuits in the examples directory are now 15-29% faster, and 16-36% smaller than tmcc 3.0 could do:

A number of bug fixes, many due to John Forrest of UMIST in Manchester, UK and Michael Barnett of the University of Idaho:

Other changes:

Other C-Based Hardware Description Languages

There are other groups working on HDLs based on C or C++. A good list of them can be found on Luc Semeria's Links on Synthesis from C/C++ page.

FPGA research at the University of Toronto

Last Modified: November 4, 1999