Moving Functions into Programmable Logic

When you have created a new project, you can open up theSDSoC Project Overviewby double-clicking on theproject.sdsocfile in theProject Explorer.

Click on thesymbol in theHardware Functionspanel to display the list of candidate functions within your program. The list of Hardware Functions consists of functions in the call graph rooted at theRoot Functionas defined in theGeneralpanel as shown above, and is set tomainby default. TheRoot Functioncan 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 clickOK. 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 theProject Explorer, expand the contents, right-click on the function prototype, and selectToggle HW/SW.

From the command line, select a function fooin the file foo_src.cfor hardware with the following sdscccommand line option.
-sds-hw foo foo_src.c -sds-end
If fooinvokes sub-functions contained in files foo_sub0.cand foo_sub1.c, use the -filesoption.
-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 theHardware Functionspanel, select functions from the list and use theClock Frequencypull-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 and use the -clkidoption.
-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. SeeImproving Hardware Function ParallelismandCoding Guidelinesfor programming guidelines.