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);
  return(0);
}


Please let me know what is the issue here?

Link to comment
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.

Link to comment
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...