vc2013 中 SystemC一个初级例子时产生错误error:"no RTTI data"

//fulladdermodule.h

#include "systemc.h"




SC_MODULE(half_adder)
{
public:
sc_in<bool> a, b;
sc_out<bool> sum, carry;
protected:
void prc_half_adder()
{
sum = a^b;
carry = a&b;
}
public:
SC_CTOR(half_adder)
{
SC_METHOD(prc_half_adder);
sensitive << a << b;
}
};




SC_MODULE(full_adder)
{
public:
sc_in<bool> a, b, carry_in;
sc_out<bool>  sum, carry_out;


sc_signal<bool> c1, s1, c2;
half_adder     *ha1_ptr, *ha2_ptr;
protected:
void prc_or()
{
carry_out = c1 | c2;
}
public:
SC_CTOR(full_adder)
{
ha1_ptr = new half_adder("ha1");
ha1_ptr->a(a);
ha1_ptr->b(b);
ha1_ptr->sum(s1);
ha1_ptr->carry(c1);


ha2_ptr = new half_adder("ha2");
(*ha2_ptr)(s1, carry_in, sum, c2);


SC_METHOD(prc_or);
sensitive << c1 << c2;
}


~full_adder()
{
delete ha1_ptr;
delete ha2_ptr;
}
};









//scmain.cpp

#include "systemc.h"
#include "fulladdermodule.h"


SC_MODULE(driver)
{
sc_out<bool> d_a, d_b, d_cin;




void prc_driver()
{
sc_uint<3>pattern;
pattern = 0;
while (1)
{
d_a = pattern[0];
d_b = pattern[1];
d_cin = pattern[2];
wait(5, SC_NS);
pattern++;
}
}


SC_CTOR(driver)
{
SC_THREAD(prc_driver);
}
};






SC_MODULE(monitor)
{
sc_in<bool> m_a, m_b, m_cin, m_sum, m_cout;


void prc_monitor()
{
cout << "At time " << sc_time_stamp() << "::";
cout << "(a,b,carry_in):";
cout << "(sum,carry_out):" << m_sum << m_cout << endl;
}


SC_CTOR(monitor)
{
SC_METHOD(prc_monitor);
sensitive << m_a << m_b << m_cin << m_sum << m_cout;
}
};




int sc_main(int argc, char *argv[])
{
sc_signal<bool> t_a, t_b, t_cin, t_sum, t_cout;


full_adder *f1 = new full_adder("FullAdderWithHalfAdder");
//Connect using positional association
f1 << t_a << t_b << t_cin << t_sum << t_cout;


driver d1("GenerateWaveforms");
//Connect using named association;
d1.d_a(t_a);
d1.d_b(t_b);
d1.d_cin(t_cin);


monitor mo1("MonitorWaveforms");
mo1 << t_a << t_b << t_cin << t_sum << t_cout;


sc_start(100, SC_NS);


return(0);
}




错误:

Access voilation:"No RTTI data".


解决办法:

Make sure you have the RTTI-information enabled in your VC++ project and that the /vmg switch is added to your compiler settings.

See INSTALL file in the SystemC package:

Quote

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

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

  • http://msdn.microsof...y/we6hfdy0.aspx
  • http://msdn.microsof...y/yad46a6z.aspx










你可能感兴趣的:(vc2013 中 SystemC一个初级例子时产生错误error:"no RTTI data")