Jump to content

debug problem systemc


Recommended Posts

Hi all , 

pls who can expain to me the reson of this warning even my code is too simple 

 warning C4407: cast impossible between different representation of pointer , lthe complier may generate a wrong code

#ifndef ALARM_H_
#define ALARM_H_

#include <systemc>
#include <iostream>

SC_MODULE(Alarm)
{
  sc_core::sc_in<bool> i;

  SC_CTOR(Alarm) :
    i("i")
  {
    SC_METHOD(AlarmMethod);
    sensitive << i.pos();
    dont_initialize();
  }

  void AlarmMethod();
}; // Alarm

#endif // ALARM_H_
----------------------------------------------------------

#include "alarm.h"

void Alarm::AlarmMethod() {
  bool temp = i.read();
   std::cout << sc_core::sc_time_stamp()  <<std::boolalpha << " i: "  << temp << std::endl;
}
------------

#include "detect.h"
void Detect::DetectThread() {
  // Open CV setup
  // required only once.
  while(1) {
    // Call OpenCV motion detection
    // Compare with threshold
    // if greater then write true
    // else
    // false    
    if (!s) 
    {
      s = true;
    } 
    else
    {
      s = false;
    }
    std::cout <<sc_core::sc_time_stamp() << std::boolalpha << " s: "  << s << std::endl;
    o.write(s);
    wait(50, sc_core::SC_MS);
    }
}
------------------------------------------------

#include "top.h"


int sc_main(int argc, char **argv) {
  Top t("t");

  sc_core::sc_start(1000, sc_core::SC_MS);
  sc_core::sc_stop();
  return 0;
}
 

Link to comment
Share on other sites


-------------------------------------------------

#ifndef DETECT_H_
#define DETECT_H_

#include <systemc>
#include <iostream>
SC_MODULE(Detect)
{
  sc_core::sc_out<bool> o;

  SC_CTOR(Detect) :
    o("o")
   // , s(false)
  {
    SC_THREAD(DetectThread);
  }
  void DetectThread();
  private: 
  bool s;
}; // Detect

#endif // DETECT_H_
----------------------------------------------------------

#ifndef TOP_H_
#define TOP_H_

#include <systemc>
#include <iostream>

#include "alarm.h"
#include "detect.h"

SC_MODULE(Top)
{
  sc_core::sc_signal<bool> sig;

  Detect d;
  Alarm a;

  SC_CTOR(Top) :
    sig("sig")
    , d("d")
    , a("a")
  {
    d.o(sig);
    a.i(sig);
  }

}; // Top

#endif // TOP_H_
 

Link to comment
Share on other sites

The error message is an indication, that you might miss the /vmg switch in your the MSVC project.

Quoting from the SystemC INSTALL file (emphasis mine):

Quote

Creating SystemC Applications
-----------------------------

1. Start Visual Studio. From the Start Page select New Project and Win32
   Console Project. Type the project name and select a suitable location
   then click OK.

2. Select the Application Settings page of the Win32 Application Wizard
   and make sure the 'Empty project' box is ticked. Click 'Finish' to
   complete the wizard.

3. Add new/existing C++ files to the project and edit code.

4. Display the project Property Pages by selecting 'Properties...' from
   the Project menu.

5. From the C/C++ tab, select the Language properties and set
   'Enable Run-Time Type Info' to Yes

6. From the C/C++ tab, select the Command Line properties and add /vmg
   to the 'Additional Options:' box.

7. From the Linker tab, select the Input properties and type 'systemc.lib'
   in the 'Additional Dependencies' box.

8. Click OK

(... more information follows)

Hope that helps,
  Philipp

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