cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Explorer
Explorer
285 Views
Registered: ‎01-18-2019

SystemC hierarchy

Jump to solution

Dear All,

What is the proper way to create separation of tasks in a design?
When to use modules and when functions?

There must be some sort of widely accepted methodology for this.

My design shall receive commands and data thru SPI, calculate stuff, and send it back.

The whole thing could be done in one module with many functions - or with many modules, having one function each.

Update question: are there non-void (module member) functions at all?  Or return values are used only with sub-functions?

Could you recommend me a link maybe?

Thank you indeed.

Miklos

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
139 Views
Registered: ‎01-18-2019

Re: SystemC hierarchy

Jump to solution

Hi,  I think I found out the answer to my own question:

A module declaration ( a class ) in a .h file  wants all its member functions ( threads) in one common .cpp file with a name identical to the .h file.  That is, all the thread definitions would be listed in the same .cpp files which is exactly what we want to avoid.  I tried a workaround solution, namely, to include the separate .cpp files (the threads) into one common .cpp file, but the compiler did not like it.

Comments are welcome.

Miklos

View solution in original post

0 Kudos
3 Replies
Highlighted
Explorer
Explorer
224 Views
Registered: ‎01-18-2019

Re: SystemC hierarchy

Jump to solution

Hi

Since I cannot edit my post, I add more questions here:

Someone please confirm or deny my assumption regarding separation of tasks ( in SystemC

Separate modules suit better for standalone verification, while you cannot do that with one function of interest, because its signals are already connected to other functions or ports or sub-modules. Does that makes sense?

Secondly, if a module holds an array that a function works on, then it might be implemented in a RAM and there may be more wires than visible in the code (e.g. rd_en, wr_en, addr, data). That would make verification complicated.

Furthermore, modules are better for hierarchy, encapsulation. Does that make sense? Does this not make sense either?

Any comments, views, experience welcome!

Miklos

p.s: Win10, Vivado 2019.2

0 Kudos
Highlighted
Explorer
Explorer
193 Views
Registered: ‎01-18-2019

Re: SystemC hierarchy

Jump to solution

Dear All,

I posted this question.  Let me reformulate it:

in RTL you could put your whole design into 1 module with many always blocks. One reason not to do that is that the file would be way too long, you want modularity.  But in SystemC you have separate .cpp files for you parallel running threads, so why not put everything into one module with many threads?  There must be a reason..

Thank you.

Miklos

0 Kudos
Highlighted
Explorer
Explorer
140 Views
Registered: ‎01-18-2019

Re: SystemC hierarchy

Jump to solution

Hi,  I think I found out the answer to my own question:

A module declaration ( a class ) in a .h file  wants all its member functions ( threads) in one common .cpp file with a name identical to the .h file.  That is, all the thread definitions would be listed in the same .cpp files which is exactly what we want to avoid.  I tried a workaround solution, namely, to include the separate .cpp files (the threads) into one common .cpp file, but the compiler did not like it.

Comments are welcome.

Miklos

View solution in original post

0 Kudos