0

For a project, I am trying to convert a value that I receive from an sc_lv<8> type input port to an sc_uint<8> type signal. By the way, the input port is connected to an sc_signal_rv<8> channel.

I tried casting the input data using this line :

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);

But I get this warning during simulation :

Warning: (W211) sc_logic value 'Z' cannot be converted to bool

I though of doing a case-by-case affect, but I'm not entirely sure.

Any ideas?

KaiserHaz
  • 25
  • 1
  • 9

2 Answers2

0

That's a warning, it notices you about 4-value to 2-value converting, it would lose information. So warning is good to make you awaring that

enchanter
  • 884
  • 8
  • 20
0

Agree with enchanter. But, it is a good practice to have your program compile without any warning, in other words that warning is a question and you should answer by modifying your code with an explicit cast:

sc_uint<8> temp = static_cast< sc_uint<8> >( data_in->read() );
Jean Davy
  • 2,062
  • 1
  • 19
  • 24