KPU55 Projects

Welcome to the KPU55 Projects web pages

This website contains information for the KPU55 CPU, it's Verilog Code and source code for a C compiler. The C Compiler is in progress for the KPU55 and potentially other CPUs.

NOTE: Jan 3, 2016: Currently I'm diligently working on the latest version of KPU55, however I've halted any KPU55 CPU related updates to this section of my website temporarily. This is due to having discovered a new pipeline method that eliminates (not minimizes) Branch Mispredictions in pipelined CPUs. My latest KPU55 CPU has this new logic. Thus until I get the patent filed, I can't release any KPU related information on this section of my website. However, once the patent is filed I want to show those interested how branch mispredictions can be eliminated and will release the KPU55 to demonstrate it. For me this is an exciting development. Currently in simulation I can watch branches cleanly transition to either the Taken or Not Taken branch address - no stalls, no flushes, NO branch prediction logic, and no predication type instructions. Currently I'm testing by using ModelSim, a Verilog testbench, the KPU55 which is written in RTL Verilog, and either compiled C code or compiled assembly (using KCC). Eventually I'll put the CPU in an FPGA. There is still a lot of work and simulation to do.

This 16 bit CPU is relatively small and simple for a pipelined CPU and can be used in FPGAs and ASICs. Having the source for both the CPU and the C compiler will allow the user to make his/her own custom CPU and C compiler for various projects.

Goals include:

1. A documented Verilog design for both the KPU55 CPU and KCC compiler that others can learn from

2. Making a 16 bit pipelined CPU that's small and fast for FPGAs.

3. Tutorials for others to learn the how to install FPGA tools, create projects, compile the KPU55 for use in an FPGA, program an FPGA, create KCC that will produce machine code for KPU55, tutorials on the internal workings of KCC, etc.. Basically a website of things and ideas for those who haven't designed CPUs or compilers.


Since I'm quite busy, if others would like to contribute changes, I will check them into the source along with the users name/contribution, if I decide the change(s) as useful. I've decided to make this a Kickstarter projec.

Currently, KCC (a C compiler for the KPU55) is in infancy, so there are MANY places various users can contribute to make the code cleaner and more robust. Though it may be tempting to use C++, the goal is to do this in C, Flex and Bison so that most hardware engineers can understand the compiler code and be able to contribute - including me. However, I'm open to a branch of the code that is the equivalent in C++. Serious overhauls of sections may be needed from time to time. Hopefully those that get involved will learn how this C compiler is created and operates. It assumes the user has a basic understanding of Flex & Bison.

This "wiki" will explain how to setup this project on a Windows 7 or 10 machine in the "How to..." section. It uses Cygwin tools gcc, flex and bison for compiling the C code.

For questions or comments about this "wiki" or to get a copy of the latest source, please contact Kirk Weedman - get my contact info from my resume on my main website webpage

Getting Started with the KPU55 CPU

1. You will need to understand the Verilog Language. You can watch a series of 10 video lectures where I teach Verilog here

2. You will need a tool for compiler the Verilog source as well as creating your FPGA project - such as Xilinx ISE 14.7

3. Learn how to use the KPU55 Assembler in the "How to.." section

4. It is highly recommended you have a Verilog simulator such as ModelSim to be able to debug your FPGA project and be able to run Verilog simulations

5. Study the design of the KPU55 in the "Theory and Operation" section.

6. Download the source files for KPU55

Getting Started with KCC - the KPU55 C Compiler

1. You will need to know C, Bison and Flex to understand the KCC source code.

2. Download the Cygwin tools which contain gcc, bison and flex which are used to compile the KCC source code. See the How to..." section.

3. Learn how the various KCC source modules operate in the "Theory and Operation" section.

4. Download the source files for the compiler.

5. Learn "How to..." compile and use the KCC compiler.