Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12612 Discussions

HLS Best Practices for Parameter Passing

Altera_Forum
Honored Contributor II
1,384 Views

Hello, I am new to using HLS and I am used to the object oriented programming that can be done in C++.  

 

What is the closest analog to making class or a struct so that many parameters can be passed into a component without cluttering the component function's definition? 

 

I have many different components that require similar, but not exactly the same inputs. Would I be losing efficiency if I pass in a single, overarching struct that includes all of these parameters? 

 

Thanks for the input!
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
443 Views

Hi, 

 

You can use structs to group together parameters to pass into a component. 

However, there are sometimes area penalties. if you have a struct containing members of different widths, the smaller members may be padded. 

 

Note that there is ultimately very little change in the overall design. In fact, if you ground the extra ‘padding’ bits when integrating your component with a full system, Quartus should optimize away the extra bits. 

 

Let me know if this has helped resolve the issue you are facing or if you need any further assistance. 

 

Best Regards, 

Anand Raj Shankar 

(This message was posted on behalf of Intel Corporation)
0 Kudos
Reply