Jump to content
wasim6691

Memory Allocation In SystemC

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×