對於一個項目,我試圖將我從sc_lv<8>
型輸入端口收到的值轉換爲sc_uint<8>
型信號。順便說一下,輸入端口連接到sc_signal_rv<8>
頻道。如何正確地將sc_lv轉換爲sc_uint?
我試着用這條線鑄造輸入數據:
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
我雖然做了逐案影響,但我不完全確定。
任何想法?