systemC2.2与2.0的兼容问题

来源:互联网 发布:mac找不到iphone设备 编辑:程序博客网 时间:2024/05/16 10:05

今天编译一个以前的SystemC程序,当时是在SystemC2.0下写的,用最新的2.2版本编译下来一堆错误,总结一下这些错误分三类:

1.sc_string类型的问题,2.2版本中的sc_string类型已经废除,但在systemc的源代码里能看到如下定义:

 

sc_string_old 取代了sc_string

SystemC标准里给的解释是:

The new SystemC standard replaces sc_string with std::string, sc_pvector with   std::vector, and sc_exception with std::exception. The old nonstandard classes are now deprecated. By default, the name sc_string is undefined, but the old sc_string class is still part of the source code under the name of sc_string_old. All new SystemC applications should use std::string exclusively. These changes will render obsolete code that uses the old classes.

最后用std::string替换sc_string 问题解决。

2.sc_signal的问题。

error C2679: 二进制“<<”: 没有找到接受“const packet_type”类型的右操作数的运算符(或没有可接受的转换)

原因是代码中定义了一个信号如下:

sc_signal<packet_type> PACKET;

可能是2.2中sc_signal多了print这个方法导致找不到操作符<<。

在packet_type中重载operator <<问题解决。

感觉应该有更好的解决方法,SystemC不能让所有只要加到sc_signal上的用户自定义类型都要重载<<吧。

3. sc_signal多信号驱动问题

Error: (E115) sc_signal<T> cannot have more than one driver。

 

查了一下2.2的release notes 有如下说明:

The check for multiple writers of a signal now defaults on rather than
off. This means that if two separate processes write to a signal an
error will be reported. To turn off the check, reverting to the
behavior of previous releases, one needs set an environment variable:
setenv SC_SIGNAL_WRITE_CHECK DISABLE
When set SystemC programs will not perform the write check.
SC_SIGNAL_WRITE_CHECK现在默认是开启的。
systemC中有如下代码

这个问题只要设定环境变量把SC_SIGNAL_WRITE_CHECK关掉就行了。

原创粉丝点击