Skip to content

Conversation

tomverbeure
Copy link
Contributor

@tomverbeure tomverbeure commented Sep 25, 2025

What are the reasons/motivation for this change?

When I compile verific.cc, I get tons of warnings like this:

frontends/verific/verific.cc:1652:16: warning: 'bits' is deprecated: Don't use direct access to the internal std::vector<State>, that's an implementation detail. [-Wdeprecated-declarations]
 1652 |                                                         initval.bits()[bit_idx] = (*ascii_initdata == '0') ? State::S0 : State::S1;
      |                                                                 ^
./kernel/rtlil.h:888:4: note: 'bits' has been explicitly marked deprecated here
  888 |         [[deprecated("Don't use direct access to the internal std::vector<State>, that's an implementation detail.")]]

When I replace bits() by to_bits(), the warning goes away.

Explain how this is achieved.

By replacing bits() by to_bits().

If applicable, please suggest to reviewers how they can test the change.

They need to run some tests with Verific enabled to make sure it works, because I compiled with my own Verific stub code instead of the real thing.

@widlarizer
Copy link
Collaborator

Sorry for not keeping an eye on warnings in the verific builds and thanks for reporting this. However to_bits() returns a copy of the bit vector, not a reference like bits(). I'll put up a fixed version later

You can use Const::set instead, or construct and modify std::vector<State> that you then construct a Const from, or refactor with Const::Builder which basically only exposes push_back(State). This might seem like a hassle but there's memory and runtime reasons for removing this direct bit vector access

@widlarizer widlarizer self-assigned this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants