Jump to content

comparison of data of type 'double' results in error

Recommended Posts

#include "systemc.h"
#include "systemc-ams.h"

SC_MODULE (chkdouble) {
 sca_tdf::sca_signal <double> tdf_ana_out;
 double x1, x2;

 void check () {
   if (tdf_ana_out > (x2-x1)/2 ) {      // <<<<<<<<<<<<<<<<<<   the error  is as follows 

                                                      //chkdouble.cpp: In member function 'void chkdouble::check()':
                                                      //chkdouble.cpp:9: error: no match for 'operator>' in '((chkdouble*)this)->
    cout << "hello" ;


 SC_CTOR (chkdouble) :
   tdf_ana_out ("tdf_ana_out") 
   x1 = 0;
   x2 = 8;
   tdf_ana_out = 5.2;

   SC_THREAD (check);   


int sc_main(int argc, char* argv[]) 
 sc_set_time_resolution (1, SC_NS);
  sc_signal <bool> adc_clock;

  chkdouble chkdouble_1 ("chkdouble_1");

  sc_start (100, SC_MS);

Please let me know what is the issue here?

Share this post

Link to post
Share on other sites

you cannot read a value from a TDF signal. Access to TDF signals is only possible via TDF ports in the context of aTDF module inside the context of a processing method (see LRM or User guide).


It's why the schedule (underlying equation system) is setup during elaboration and during simulation the TDF time is not inline with the SystemC time - a read access to a TDF signal out of context cannot know which value from the buffer has to be read - only the connected and thus scheduled TDF module has this information.

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