对于一个项目,我正在尝试将从sc_lv<8>类型输入端口接收的值转换为sc_uint<8>类型信号。顺便说一下,输入端口连接到sc_signal_rv<8>通道。
我尝试使用下面这行代码转换输入数据:
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);但我在模拟过程中收到了这样的警告:
Warning: (W211) sc_logic value 'Z' cannot be converted to bool
我想做一个案例的影响,但我不是完全确定。
有什么想法吗?
发布于 2013-12-03 06:44:12
这是一个警告,它会通知你关于4值到2值的转换,它会丢失信息。所以警告会让你警觉到
发布于 2013-12-05 17:48:15
同意魔术师的观点。但是,最好在没有任何警告的情况下编译您的程序,换句话说,警告是一个问题,您应该通过使用显式强制转换修改您的代码来回答:
sc_uint<8> temp = static_cast< sc_uint<8> >( data_in->read() );https://stackoverflow.com/questions/20261242
复制相似问题