wasim6691 1 Posted January 10, 2018 Report Share Posted January 10, 2018 Hi, I have to Allocate Memory for my data in SystemC. We Use malloc in C Language and New in C++ to dynamically Allocate Memory. But today I have read that we cannot use New and Delete Operators in System C as they are not synthesizeable. Which command should I use for Memory Allocation in System C. Thanks. Quote Link to post Share on other sites
maehne 75 Posted January 10, 2018 Report Share Posted January 10, 2018 Dynamic memory allocation in behavioural description is indeed not synthesizable, as there is no sensible mapping to digital hardware. You will have to use static memory allocation instead. Check the SystemC Synthesis Subset and the documentation of your HLS toolchain for details on how to write proper synthesizable code in SystemC. Quote Link to post Share on other sites
wasim6691 1 Posted January 10, 2018 Author Report Share Posted January 10, 2018 Hi Maehne But If I am defining Memory as SC_MODULE and using 4KB Memory Alignment for my data storage as I am reading the data from binary files. As I have to read from and store the respective output data in the Memory Module. Like I am confused How do i define the Memory Module using static allocation. Can You give me or refer to some example. That would be so nice of You. Thanks Quote Link to post Share on other sites
wasim6691 1 Posted January 10, 2018 Author Report Share Posted January 10, 2018 2nd Question: I am using reinterpret_cast <char*> to read the HEX data from the binary file. Now I have studied that reinterpret_cast is not supported for Synthesis purpose in SystemC. Now What alternative should I use for reinterpret_cast command in SystemC? Thanks Quote Link to post Share on other sites
maehne 75 Posted January 10, 2018 Report Share Posted January 10, 2018 How to initialise your memory content from a file is very HLS tool-specific. Check its documentation! They may or may not support it. Maybe, you'll have to use a specific IP block provided by your tool vendor. Quote Link to post Share on other sites
David Black 181 Posted January 11, 2018 Report Share Posted January 11, 2018 Using new and malloc are supported for the verification side of SystemC. In other words, when you are creating a validation simulation. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.