Jump to content

Cannot write sc_signal


sumit_tuwien

Recommended Posts

Hello All,

I have a module, which have a public member function which when called will write some values in a signal declared within the module. I can write into the signal from within the module. But if I try to access member function from outside the module instance, I get a crash. When I am trying to debug it, I find the following message:

 

Program received signal SIGSEGV, Segmentation fault.
t0x00000000080869c6 in sc_core::sc_signal_t<double, (sc_core::sc_writer_policy)0>::write (this=0xe8, value_=@0x7ffffea1ff00: 1)
    at /blah/systemc-2.3.3/include/sysc/communication/sc_signal.h:292
292         bool value_changed = !( m_new_val == value_ );

I am using gcc-9.3.0. Any help will be appreciated.

 

Regards,

Sumit

 

Link to comment
Share on other sites

If you want real help, you need to show us the source code. At a minimum, we would need to see the signal declarationwithin its context, and the location of it's constructor and write method. If using a custom datatype, we need to know that definition. 

Also, what compiler switches are used (e.g., -Wall -Wextra -std=?)? What compilation warnings are emitted?

What version of SystemC?

 

 

 

Link to comment
Share on other sites

Hi @David Black,

 

Following is the reduced version of the class:

# ifndef BLAH_H_
# define BLAH_H_

class Blah final
   :   sc_core::sc_module
{

private :
   double ThisOneWillAlsoNotLetWrite { 0.0 } ;

public :

   sc_core::sc_signal  < double >  IWillNotLetYouWrite    { "IWillNotLetYouWrite"   } ;

   SC_HAS_PROCESS (Blah) ;

   explicit
   Blah(const sc_core::sc_module_name& ModuleName_)
      :   sc_core::sc_module    { ModuleName_ }
   {}

  ~Blah() final                       = default ;
   Blah& operator=(const Blah& other) = delete  ;
   Blah(const Blah& other)            = delete  ;
   Blah operator=(Blah&& other)       = delete  ;
   Blah(Blah&& other)                 = delete  ;


   void LetsWrite()
   {
      IWillNotLetYouWrite.write(1.0);
   }
     
   void ThisOneFailsToo()
   {
      ThisOneWillAlsoNotLetWrite = 1.0 ;
   }     

};

# endif

~

 

# Yes, -Wall -Wextra was turned ON. --std=c++14.

# SystemC version : 2.3.3

# Compiler gcc-9.3.0

 

Regards,

Sumit

Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...