Tutorial - Designing Custom FPGA Logic using C

Frozen Content

Altium Designer provides the ability to add custom logic to an FPGA design, where that logic is 'captured' in an underlying C source file. Simply write the functionality required in the comfort of Altium's code-aware C Editor and then sit back as Altium Designer's C-to-Hardware Compilation technology converts your code into VHDL or Verilog (depending on your defined netlisting preference). Armed with even a basic software background, there is now no reason why you can't design custom FPGA logic!

From the schematic sheet, the underlying C source file is referenced in much the same way as a schematic or HDL file. Instead of a Sheet Symbol however, a C Code Symbol primitive is used. Each C Code Symbol represents one top-level exported function, resident in the referenced C source file. Access to the parameters of the function is made using C Code Entries – placed on the symbol and functionally similar to Sheet Entries on a Sheet Symbol. These entries can be wired to other components on the schematic, allowing for transfer of data.

In this tutorial, we will look at a simple design that incorporates C-based custom logic, which will be programmed into an FPGA resident on a daughter board plugged into the Desktop NanoBoard NB2DSK01.

The example design featured in this tutorial (Figure 1) is a simple accumulator. The design contains two C Code Symbols, each used to export a single function written in an associated C source file – one function to provide a clock pulse circuit and the other to provide an accumulation circuit.

Figure 1. Our simple Accumulator design, which we will use to highlight the addition of custom logic written in C.

Interaction with the design is handled through the GUI panel of a Custom Instrument component. Basically, the user enters a new value on the Custom Instrument's panel and clicks a button (also on the panel) to request that this value be added to the accumulated total. Once clicked, the output of the custom clock pulse circuit will go High, in turn invoking the custom accumulatIon circuit. The new value is added to the (internally-stored) accumulated value and the new total latched and subsequently displayed back in the instrument panel.

The design can be found in the \Examples\Tutorials\CHC Accumulator folder of your Altium Designer installation. Refer to this example at any time to get further insight or to skip some of the steps.

Follow each of the linked pages below, in sequence, to complete the tutorial and implement the design:

This tutorial assumes a working knowledge of the basics of FPGA design within Altium Designer. Although not a pre-requisite for this tutorial, should you wish to familialize yourself with the basics, including project creation, component placement, wiring, configuration and design processing, see Tutorial - Getting Started with FPGA Design.

 

See Also

You are reporting an issue with the following selected text and/or image within the active document: