Systemc 如何正确地将sc_lv转换为sc_uint?

Systemc 如何正确地将sc_lv转换为sc_uint?,systemc,Systemc,对于一个项目,我试图将从sc\u lv类型输入端口接收到的值转换为sc\u uint类型信号。顺便说一下,输入端口连接到sc\u信号\u rv通道 我尝试使用以下行强制转换输入数据: sc_in< sc_lv<8> > data_in; // Other declarations sc_signal< sc_uint<8> > tx_data; // Other declarations // Assume that all else is

对于一个项目,我试图将从
sc\u lv
类型输入端口接收到的值转换为
sc\u uint
类型信号。顺便说一下,输入端口连接到
sc\u信号\u rv
通道

我尝试使用以下行强制转换输入数据:

sc_in< sc_lv<8> > data_in;

// Other declarations

sc_signal< sc_uint<8> > tx_data;

// Other declarations
// Assume that all else is properly declared

sc_uint<8> temp;
temp = (sc_uint<8>)data_in->read(); // Casting
tx_data.write(temp);
sc\u indata\u in;
//其他声明
sc_信号发送_数据;
//其他声明
//假设所有其他内容都已正确声明
温度;
temp=(sc_uint)数据输入->读取();//铸造
tx_数据写入(温度);
但我在模拟过程中得到了以下警告:

警告:(W211)sc_逻辑值“Z”无法转换为bool

我想逐案调查,但我不能完全肯定


有什么想法吗?

这是一个警告,它会通知您关于4值到2值的转换,它会丢失信息。所以警告是很好的,让你意识到,你同意魔术师的观点。 但是,让您的程序在没有任何警告的情况下编译是一种很好的做法,换句话说,警告是一个问题,您应该通过使用显式强制转换修改代码来回答:

sc_uint<8> temp = static_cast< sc_uint<8> >( data_in->read() );
sc_uint temp=static_cast(data_in->read());