Moving Functions into Programmable Logic

When you have created a new project, you can open up the SDSoC Project Overview by double-clicking on the project.sdsoc file in the Project Explorer.

Click on the symbol in the Hardware Functions panel to display the list of candidate functions within your program. The list of Hardware Functions consists of functions in the call graph rooted at the Root Function as defined in the General panel as shown above, and is set to main by default. The Root Function can be changed by clicking on the ... button and selecting an alternative function root.

From within the popup window, you can select one or more functions for hardware acceleration and click OK. The selected functions appear in the list box. Note that the Eclipse CDT indexing mechanism is not foolproof, and you might need to close and reopen the selection popup to view available functions. If a function does not appear in the list, you can navigate to its containing file in the Project Explorer, expand the contents, right-click on the function prototype, and select Toggle HW/SW.

From the command line, select a function foo in the file foo_src.c for hardware with the following sdscc command line option.
-sds-hw foo foo_src.c -sds-end
If foo invokes sub-functions contained in files foo_sub0.c and foo_sub1.c, use the -files option.
-sds-hw foo foo_src.c -files foo_sub0.c,foo_sub1.c -sds-end

Although the data motion network runs off of a single clock, it is possible to run hardware functions at different clock rates to achieve higher performance. In the Hardware Functions panel, select functions from the list and use the Clock Frequency pull-down menu to choose their clocks. Be aware that it might not be possible to implement the hardware system with some clock selections.

To set a clock on the command-line, determine the corresponding clock id using sdscc -sds-pf-info <platform> and use the -clkid option.
-sds-hw foo foo_src.c -clkid 1 -sds-end

When moving a function optimized for CPU execution into programmable logic, you usually need to revise the code to achieve best performance. See Improving Hardware Function Parallelism and Coding Guidelines for programming guidelines.