Jump to content
rahuljn

disbale sc_assert statements

Recommended Posts

Yes, defining NDEBUG also disables the sc_assert statements in the SystemC proof-of-concept implementation.

 

Having said that, I don't think it is a good idea to do so globally.  You usually want your simulation to reliably abort in case of an error/bug, instead of running into arbitrary undefined behaviour.

 

I would recommend to leave assertions active by default until profiling proves that (specific) assertions have a significant performance impact.  In such cases, selectively disable only these assertions in optimized configurations.

 

/Philipp

Share this post


Link to post
Share on other sites

Hello Philipp

 

With following example, where I have #define NDEBUG, the sc_assert is still executed.

#include "systemc.h"
#define NDEBUG

SC_MODULE(trial){
    public:
    int i;
    SC_HAS_PROCESS(trial);
    trial(sc_module_name name){
        i=10;
        sc_assert(i!=10);
    }
};

int sc_main(int , char**){
    trial et("et");
    sc_start();
    return 0;
}

 

 

Thanks

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

×