otl0rz Posted May 21, 2021 Report Share Posted May 21, 2021 I am trying to initialize a sc_vector of sc_uint<8>, but I always get this error message: Error: (E403) conversion failed: character string 'test_0' is not valid In file: ../../../src/sysc/datatypes/int/sc_uint_base.cpp:530 I don't get an error with the same approach but using sc_lv instead. Here's a minimal code example to reproduce my issue: #include <systemc.h> int sc_main (int argc, char* argv[]) { sc_vector<sc_lv<8>> test2 {"test2", 1000}; sc_vector<sc_uint<8>> test {"test", 1000}; exit(0); } Can anyone explain to me what I'm doing wrong? Quote Link to comment Share on other sites More sharing options...
Andy Goodrich Posted May 21, 2021 Report Share Posted May 21, 2021 The form you are using is causing the sc_vector constructor to think it has named elements, that is, it expects the vector elements to have a name field that is passed to the constructor for each element. So it will try to create elements with names test_0, test_1, ..., test_999 by calling the constructor for sc_uint<8> with those names. While the sc_uint class has a constructor that takes a char* argument, that argument is expected to be a character representation of a value. I would suggest you use std::vector for scalar types like sc_uint instead: std::vector<sc_lv<8> > test2(1000); std::vector<sc_uint<8> > test(1000); Quote Link to comment Share on other sites More sharing options...
scsc Posted May 24, 2021 Report Share Posted May 24, 2021 The 2.3 LRM didn't even mention sc_vector. It is a hidden feature? Quote Link to comment Share on other sites More sharing options...
maehne Posted May 25, 2021 Report Share Posted May 25, 2021 No, sc_vector is part of the IEEE Std 1666-2011 (cf. to clause 8.5), which is describing SystemC including TLM-2.0 and is available for free through the IEEE Get Program. Additional information on how to use it, you may find, e.g., here, here, and here. Quote Link to comment Share on other sites More sharing options...
scsc Posted May 27, 2021 Report Share Posted May 27, 2021 Thanks. I realized my LRM is an "OSCI SystemC 2.1 LRM", which was published in 2005. The 1666-2011 one has sc_vector. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.