Choosing Functions to Implement in Hardware
Although functions that are destined for implementation in hardware can be 'identified' directly at the source code level, Altium Designer provides a more friendly, straightforward and intuitive interface, as part of the configuration of its ASP peripheral.
The right-hand side of the configuration dialog (Figure 1) provides two distinct regions that deal with global variables and functions defined in the C source code of the embedded software project – linked to the processor which is wired to communicate with the ASP peripheral.
Figure 1. Set up your hardware acceleration requirements from within the ASP's intuitive configuration dialog.Use the upper list to determine which global variables should be allocated in hardware. Such variables will be allocated in ASP Block RAM by the C-to-Hardware Compiler. Access to this memory is much faster, in comparison to storage allocation in Block RAM outside of the ASP by the Embedded Compiler.
A global variable that is allocated in hardware can only be accessed by a function that has also been implemented in hardware. Such a variable can not be called from a software-based function running on the host processor.
Use the lower list to specify which source functions should be implemented in hardware. To have the C-to-Hardware Compiler generate a function in hardware, as part of the ASP, simply enable the associated check box for that function, in the Implement in Hardware column. Should you wish to be able to call that hardware function from within the software running on the host processor, ensure that the corresponding check box in the Export to Software column is also enabled.
The following are some key points to consider when using these two function-related options:
- A function with enabled Implement in Hardware option will become a hardware function.
- A hardware function can call another hardware function.
- A hardware function can not call a software function.
- A software function running on the host processor can call a hardware function, provided that hardware function has been exported to software (Export to Software option enabled for function).
- A hardware-only function (not exported to software) can call a hardware function that has been exported to software. Conversely, a hardware function that has been exported to software can call a hardware-only function.
Allocation of variables and implementation of functions in hardware can also be performed from within the C source code – either from the C To Hardware panel, or by right-clicking on a global variable/function directly in the code editor and using the relevant commands that appear on the context menu.
Note: When using the panel, only global variables and functions defined in the active C document will be listed.
Figure 2. Specifying hardware acceleration requirements from within the Code Editor.See Also