This practical builds on the tasks completed in practical 2.

Getting started with Handel-C

In this practical we will build a simple Handel-C component and use it to accelerate processing in the Microblaze.

Double-click the handelc/userhandelc.dkw file to open the Handel-C workspace in DK. (DK Design Suite is the development environment for Handel-C.) This workspace contains library files (vlab.hcc and vlab.hch) and the top-level design file (main.hcc). You will add user code into main.hcc, and you can add extra files as the size of your code base grows.

Double-click main.hcc to open it up and observe it contains the following tiny Handel-C program:
#include "vlab.hch"
extern clk_port;
set clock = internal CLK;
 
void main(void) {
 initialise();
}
There are two important features in this program. First, it is essential that vlab.hch is included by main.hcc, even if you are not using any of the hardware it presents. The VLAB library defines connection points that must be present or synthesis of the design will fail. Second, you must call the initialise() function before anything else.


To compile the example program, ensure that the current build target is EDIF (Build | Set Active Configuration) and click Build | Build (or press F7). DK should now create an EDIF file from your input code. This will create the file userhandel.edf in the implementation directory. It will complain that "nothing needs to be done" if the project has already been built.

Now we have built the Handel-C, we need to re-synthesise the project to make a new bitfile. Run:
./embs.sh implement
This will rebuild the design, but with your new Handel-C.