This example shows how to program a standalone FPGA with your MATLAB design, using the FPGA Turnkey workflow.
The target device in this example is an Altera® DE2-115 development and education board.
To use the FPGA Turnkey workflow, you must:
Have your synthesis tool path set up. To learn how to setup your synthesis tool path, see Synthesis Tool Path Setup (HDL Coder).
Connect the target device if you want to program it immediately. If the target device is not connected, you can still generate the programming file.
Create a new folder to hold your project files.
At the MATLAB® command line, open the design and test bench files:
edit mlhdlc_turnkey_led_blinking.m edit mlhdlc_turnkey_led_blinking_tb.m
Save copies of the design and test bench files to your new project folder.
Change directory to your new project folder.
At the MATLAB command line, enter:
For Name, enter
and click OK.
Under MATLAB Function, click Add MATLAB
Function and select
Under MATLAB Test Bench, click Add
files and select
Click the Workflow Advisor button to open the HDL Workflow Advisor.
Right-click the Define Input Types task and select Run This Task.
In the Variables tab, for the
freqCounter variable, in the Proposed
Type column, enter
0) to set the type to unsigned 27-bit integer.
On the left, right-click the Fixed-Point Conversion task and select Run This Task.
In the Select Code Generation Target task, select the FPGA Turnkey workflow and Altera DE2-115 development and education board as follows:
For Workflow, select FPGA Turnkey.
For Platform, select Altera DE2-115 development and education board. If your target device is not in the list, select Get more to download the support package.
The coder automatically sets Chip family, Device, Package, and Speed according to your platform selection.
For FPGA clock frequency, for both Input and System, enter 100.
In the Set Target Interface task, map the design input and output ports to interfaces on the target device by setting the fields in the Target Platform Interfaces column as follows:
User-defined Push-button Switch
Blink_direction to Slide
LED to LED Green
You can leave the
The HDL Workflow Advisor applies your settings immediately.
You can generate code, perform synthesis and analysis, and download the design to the target hardware using the default settings:
For the Synthesis and Analysis task group, uncheck the Skip this Step option.
For the Download to Target task group, uncheck the Skip this Step option.
Right-click Download to Target > Generate Programming File and select Run to Selected Task.
If your target hardware is connected and ready to program, select the Program Target Device subtask and click Run.