3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-13 02:34:44 +00:00

Add support for int stuff

This commit is contained in:
Akash Levy 2024-09-18 16:46:53 -07:00
parent 1801bb966a
commit db0317afc5
2 changed files with 11 additions and 0 deletions

View file

@ -214,6 +214,16 @@ RTLIL::Const::Const(const std::string &str)
}
}
RTLIL::Const::Const(int val, int width)
{
flags = RTLIL::CONST_FLAG_NONE;
bits.reserve(width);
for (int i = 0; i < width; i++) {
bits.push_back((val & 1) != 0 ? State::S1 : State::S0);
val = val >> 1;
}
}
RTLIL::Const::Const(long long val, int width)
{
flags = RTLIL::CONST_FLAG_NONE;