Jump to content

Compiler error: using is_reset() with sc_signal<bool> in sc_signal.h


Recommended Posts

Hello,

i have the following piece of code not compiling:

#include <systemc.h>
int sc_main(int argc, char* argv[]){
	sc_signal<bool> my_signal_bool;
    sc_reset* my_reset;
    my_reset = my_signal_bool.is_reset();
    return 0;
}

I get this error:

In file included from /usr/local/systemc-2.3.3/include/sysc/communication/sc_buffer.h:34:0,
                 from /usr/local/systemc-2.3.3/include/systemc:79,
                 from /usr/local/systemc-2.3.3/include/systemc.h:219,
                 from ../src/playground.cpp:12:
/usr/local/systemc-2.3.3/include/sysc/communication/sc_signal.h: In function int sc_main(int, char**)’:
/usr/local/systemc-2.3.3/include/sysc/communication/sc_signal.h:472:23: error: sc_core::sc_reset* sc_core::sc_signal<bool, POL>::is_reset() const [with sc_core::sc_writer_policy POL = (sc_core::sc_writer_policy)0u]’ is private
     virtual sc_reset* is_reset() const;
                       ^
../src/playground.cpp:95:37: error: within this context
  my_reset = my_signal_bool.is_reset();
                                     ^
make: *** [src/playground.o] Error 1
src/subdir.mk:18: recipe for target 'src/playground.o' failed
"make all" terminated with exit code 2. Build might be incomplete.

I have installed SystemC 2.3.3 and using Eclipse CDT under Ubunut 16.04.

How i can resolve this error?

Best regards,

Julian

Link to post
Share on other sites

Hi Ralph,

thanks for your reply.

Quote

The is_reset method is private. So, you cannot call it on an object.

I also recognized that this function is private, so i did the workaround making this function public. This fast solution is for the moment ok, but not as long term option. I know that is not a good solution, but it is a qick dirty fix.

Quote

But why are you using is_reset() method? What do you want to achieve?

I have an old SystemC Library(ReChannelv2 from 2007) where this call is used and i want to use this library(the library is not compiling yet). For now i have not the resources to refactor the old library to the newer C++(11 or 14) and SystemC(2.3.3) standard. Also it is an external library, so it is hard to get in and understand how the implementation is done in detail. In theory, i only want to use it 😉

This library is i would say something which wrapped extra stuff around the systemc classes to model reconfiguration during runtime.

Quote

This is not part of the standard API, i.e. it might be dangerous to use.

If i check the SystemC version 2.2, there was this function public, so it was allowed to use this function. Why is this dangerous now? What changed between these two version?

Best regards,

Julian

Link to post
Share on other sites
  • 2 weeks later...
On 2/5/2020 at 9:46 AM, haase said:

If i check the SystemC version 2.2, there was this function public, so it was allowed to use this function.

The only normative reference for SystemC is defined by the IEEE Std. 1666-2011, see http://ieeexplore.ieee.org/document/6134619/. The is_reset() was never part any version of the standard, so one could never rely on its presence. You would to check, why the ReChannel library tries to call this function and then find another way to implement this functionality.

/Philipp

Link to post
Share on other sites

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...