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.











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值