Jump to content
Mouhsen.Ibrahim

User Guide for systemc 2.3.2

Recommended Posts

Hi everyone,

 

I installed `systemc v2.3.2` and followed the instructions in user guide found here but when I compile the code using this single command

g++ -I. -I/usr/local/systemc-2.3.2/include -L. -L/usr/local/systemc-2.3.2/lib-linux64 -lsystemc -lm -lstdc++ channel.cpp display.cpp packet.cpp receiver.cpp timer.cpp transmit.cpp main.cpp -o main

 I get so many errors, here are few:

/usr/local/systemc-2.3.2/include/sysc/communication/sc_signal_ports.h:311:14: error: no matching function for call to sc_trace(sc_core::sc_trace_file*&, const packet_type&, std::__cxx11::string&)’
      sc_trace( p->tf, iface->read(), p->name );

/usr/local/systemc-2.3.2/include/sysc/communication/sc_signal.h:317:26: error: no match for operator<<’ (operand types are std::basic_ostream<char> and const packet_type’)
     os << "new value = " << m_new_val << ::std::endl;

/usr/local/systemc-2.3.2/include/sysc/tracing/sc_trace.h:279:13: error: invalid conversion from const char*’ to int [-fpermissive]
     sc_trace( tf, object.read(), name );
main.cpp:42:22: error: class sc_core::sc_clock has no member named signal
   sc_trace(tf, CLOCK.signal(), "clock");
                      ^
main.cpp:51:17: error: no matching function for call to sc_start(int)’
   sc_start(10000);

./packet.h:16:69: error: sc_string does not name a type
 extern void sc_trace(sc_trace_file *tf, const packet_type& v, const sc_string& NAME);

 

The source code can be found here

 

Thanks for any help you can offer :)

Edited by Mouhsen.Ibrahim
Fix code and URLs

Share this post


Link to post
Share on other sites

Your example code uses many features, which have been deprecated for good reasons already in IEEE Std 1666-2005. The Accellera proof-of-concept implementation SystemC 2.3.2 of IEEE Std 1666-2011 continued the effort to improve the code quality and facilitate the maintenance of the implementation by removing long-deprecated features and improve the compatibility with modern C++ compilers and coding techniques. I recommend that you familiarise yourself with the "Modern C++" concepts introduced by C++'11, '14, and '17 and start to modernise your SystemC models. Following are some hints to get you started:

  • Use the <systemc> header instead of <systemc.h> and explicitly use the appropriate namespace prefixes or using statements
  • Use std::string instead of the long deprecated sc_string
  • When calling sc_core::sc_start(), always pass the appropriate time unit as second argument or pass a sc_core::sc_time constant/variable
  • Make sure to compile your model with the same flags that were used during the compilation of the SystemC library itself. Especially make sure that everything is compiled against the same language standard! Otherwise, you will face link problems!

Besides a good book on C++, I also recommend you to read a good introduction to SystemC, e.g., "SystemC from the Ground Up".

Share this post


Link to post
Share on other sites

@maehne Thanks a lot for your reply, I already started writing my systemc models, I am having very few problems so far.

 

I will follow your guidelines here and hope to improve my code quality.

 

Is there a change log for systemc, so I can see what changed and modify my systemc models according to it?

Share this post


Link to post
Share on other sites
6 hours ago, Mouhsen.Ibrahim said:

Is there a change log for systemc, so I can see what changed and modify my systemc models according to it?

Annex C in the SystemC standard lists some deprecated features.

In the SystemC proof-of-concept implementation, you find detailed information about changes in the RELEASENOTES file, but mostly only relative to the previous version.

Share this post


Link to post
Share on other sites

Hi, I spent hours trying to install systemC on visual studio 2017, i have encountered a problem. when I include the systemc.h file, the vs shows the error "unrecognized preprocessing directive". I followed the install instruction carefully in  INSTALLATION file.

 

update: I fixed the issue.

Edited by Aaron0127

Share this post


Link to post
Share on other sites

Hi @maehne,

 

I am reading the book "SystemC: from the ground up". It refers to some example codes at www.EklecticAlly.com but this link is not functional anymore. It would be a great help in my SystemC adventure if someone can give me those example codes. Thanks!

Share this post


Link to post
Share on other sites

I totally agree that it would be great if the example code from the "SystemC: from the ground up" book would be made available again on the internet. It is best to ask @David Black for that as he is one of the authors of the book. By the way, the second edition of the book has its own homepage: http://scftgu.com/ Unfortunately, it doesn't provide an archive with the example code sources either.

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

×