mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-23 09:05:32 +00:00
rtlil: represent Const strings as std::string
This commit is contained in:
parent
61ed9b6263
commit
785bd44da7
90 changed files with 947 additions and 643 deletions
|
@ -354,7 +354,7 @@ struct BugpointPass : public Pass {
|
|||
for (auto it2 = sy->mem_write_actions.begin(); it2 != sy->mem_write_actions.end(); ++it2) {
|
||||
auto &mask = it2->priority_mask;
|
||||
if (GetSize(mask) > i) {
|
||||
mask.bits.erase(mask.bits.begin() + i);
|
||||
mask.bits().erase(mask.bits().begin() + i);
|
||||
}
|
||||
}
|
||||
return design_copy;
|
||||
|
|
|
@ -160,7 +160,7 @@ struct CleanZeroWidthPass : public Pass {
|
|||
memwr.address = State::S0;
|
||||
Const priority_mask;
|
||||
for (auto x : swizzle) {
|
||||
priority_mask.bits.push_back(memwr.priority_mask.bits[x]);
|
||||
priority_mask.bits().push_back(memwr.priority_mask[x]);
|
||||
}
|
||||
memwr.priority_mask = priority_mask;
|
||||
swizzle.push_back(i);
|
||||
|
|
|
@ -883,7 +883,7 @@ struct DftTagWorker {
|
|||
{
|
||||
if (sig_a.is_fully_const()) {
|
||||
auto const_val = sig_a.as_const();
|
||||
for (auto &bit : const_val.bits)
|
||||
for (auto bit : const_val)
|
||||
bit = bit == State::S0 ? State::S1 : bit == State::S1 ? State::S0 : bit;
|
||||
return const_val;
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ struct PrintAttrsPass : public Pass {
|
|||
}
|
||||
|
||||
static void log_const(const RTLIL::IdString &s, const RTLIL::Const &x, const unsigned int indent) {
|
||||
if (x.flags == RTLIL::CONST_FLAG_STRING)
|
||||
if (x.flags & RTLIL::CONST_FLAG_STRING)
|
||||
log("%s(* %s=\"%s\" *)\n", get_indent_str(indent).c_str(), log_id(s), x.decode_string().c_str());
|
||||
else if (x.flags == RTLIL::CONST_FLAG_NONE || x.flags == RTLIL::CONST_FLAG_SIGNED)
|
||||
log("%s(* %s=%s *)\n", get_indent_str(indent).c_str(), log_id(s), x.as_string().c_str());
|
||||
else
|
||||
log_assert(x.flags == RTLIL::CONST_FLAG_STRING || x.flags == RTLIL::CONST_FLAG_NONE); //intended to fail
|
||||
log_assert(x.flags & RTLIL::CONST_FLAG_STRING || x.flags == RTLIL::CONST_FLAG_NONE); //intended to fail
|
||||
}
|
||||
|
||||
void execute(std::vector<std::string> args, RTLIL::Design *design) override
|
||||
|
|
|
@ -243,7 +243,7 @@ struct SetundefPass : public Pass {
|
|||
{
|
||||
for (auto *cell : module->selected_cells()) {
|
||||
for (auto ¶meter : cell->parameters) {
|
||||
for (auto &bit : parameter.second.bits) {
|
||||
for (auto bit : parameter.second) {
|
||||
if (bit > RTLIL::State::S1)
|
||||
bit = worker.next_bit();
|
||||
}
|
||||
|
@ -390,12 +390,12 @@ struct SetundefPass : public Pass {
|
|||
for (auto wire : initwires)
|
||||
{
|
||||
Const &initval = wire->attributes[ID::init];
|
||||
initval.bits.resize(GetSize(wire), State::Sx);
|
||||
initval.bits().resize(GetSize(wire), State::Sx);
|
||||
|
||||
for (int i = 0; i < GetSize(wire); i++) {
|
||||
SigBit bit = sigmap(SigBit(wire, i));
|
||||
if (initval[i] == State::Sx && ffbits.count(bit)) {
|
||||
initval[i] = worker.next_bit();
|
||||
initval.bits()[i] = worker.next_bit();
|
||||
ffbits.erase(bit);
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ struct SetundefPass : public Pass {
|
|||
continue;
|
||||
|
||||
Const &initval = wire->attributes[ID::init];
|
||||
initval.bits.resize(GetSize(wire), State::Sx);
|
||||
initval.bits().resize(GetSize(wire), State::Sx);
|
||||
|
||||
if (initval.is_fully_undef()) {
|
||||
wire->attributes.erase(ID::init);
|
||||
|
|
|
@ -77,7 +77,7 @@ struct SplitnetsWorker
|
|||
if (it != wire->attributes.end()) {
|
||||
Const old_init = it->second, new_init;
|
||||
for (int i = offset; i < offset+width; i++)
|
||||
new_init.bits.push_back(i < GetSize(old_init) ? old_init.bits.at(i) : State::Sx);
|
||||
new_init.bits().push_back(i < GetSize(old_init) ? old_init.at(i) : State::Sx);
|
||||
new_wire->attributes.emplace(ID::init, new_init);
|
||||
}
|
||||
|
||||
|
|
|
@ -827,9 +827,9 @@ struct XpropWorker
|
|||
auto init_q_is_1 = init_q;
|
||||
auto init_q_is_x = init_q;
|
||||
|
||||
for (auto &bit : init_q_is_1)
|
||||
for (auto &bit : init_q_is_1.bits())
|
||||
bit = bit == State::S1 ? State::S1 : State::S0;
|
||||
for (auto &bit : init_q_is_x)
|
||||
for (auto &bit : init_q_is_x.bits())
|
||||
bit = bit == State::Sx ? State::S1 : State::S0;
|
||||
|
||||
initvals.remove_init(sig_q);
|
||||
|
@ -864,14 +864,14 @@ struct XpropWorker
|
|||
auto init_q_is_x = init_q;
|
||||
|
||||
if (ff.is_anyinit) {
|
||||
for (auto &bit : init_q_is_1)
|
||||
for (auto &bit : init_q_is_1.bits())
|
||||
bit = State::Sx;
|
||||
for (auto &bit : init_q_is_x)
|
||||
for (auto &bit : init_q_is_x.bits())
|
||||
bit = State::S0;
|
||||
} else {
|
||||
for (auto &bit : init_q_is_1)
|
||||
for (auto &bit : init_q_is_1.bits())
|
||||
bit = bit == State::S1 ? State::S1 : State::S0;
|
||||
for (auto &bit : init_q_is_x)
|
||||
for (auto &bit : init_q_is_x.bits())
|
||||
bit = bit == State::Sx ? State::S1 : State::S0;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,10 +168,10 @@ undef_bit_in_next_state:
|
|||
ctrl_in_bit_indices[ctrl_in[i]] = i;
|
||||
|
||||
for (auto &it : ctrl_in_bit_indices)
|
||||
if (tr.ctrl_in.bits.at(it.second) == State::S1 && exclusive_ctrls.count(it.first) != 0)
|
||||
if (tr.ctrl_in.at(it.second) == State::S1 && exclusive_ctrls.count(it.first) != 0)
|
||||
for (auto &dc_bit : exclusive_ctrls.at(it.first))
|
||||
if (ctrl_in_bit_indices.count(dc_bit))
|
||||
tr.ctrl_in.bits.at(ctrl_in_bit_indices.at(dc_bit)) = RTLIL::State::Sa;
|
||||
tr.ctrl_in.bits().at(ctrl_in_bit_indices.at(dc_bit)) = RTLIL::State::Sa;
|
||||
|
||||
RTLIL::Const log_state_in = RTLIL::Const(RTLIL::State::Sx, fsm_data.state_bits);
|
||||
if (state_in >= 0)
|
||||
|
|
|
@ -30,11 +30,11 @@ PRIVATE_NAMESPACE_BEGIN
|
|||
|
||||
static bool pattern_is_subset(const RTLIL::Const &super_pattern, const RTLIL::Const &sub_pattern)
|
||||
{
|
||||
log_assert(GetSize(super_pattern.bits) == GetSize(sub_pattern.bits));
|
||||
for (int i = 0; i < GetSize(super_pattern.bits); i++)
|
||||
if (sub_pattern.bits[i] == RTLIL::State::S0 || sub_pattern.bits[i] == RTLIL::State::S1) {
|
||||
if (super_pattern.bits[i] == RTLIL::State::S0 || super_pattern.bits[i] == RTLIL::State::S1) {
|
||||
if (super_pattern.bits[i] != sub_pattern.bits[i])
|
||||
log_assert(GetSize(super_pattern) == GetSize(sub_pattern));
|
||||
for (int i = 0; i < GetSize(super_pattern); i++)
|
||||
if (sub_pattern[i] == RTLIL::State::S0 || sub_pattern[i] == RTLIL::State::S1) {
|
||||
if (super_pattern[i] == RTLIL::State::S0 || super_pattern[i] == RTLIL::State::S1) {
|
||||
if (super_pattern[i] != sub_pattern[i])
|
||||
return false;
|
||||
} else
|
||||
return false;
|
||||
|
@ -54,10 +54,10 @@ static void implement_pattern_cache(RTLIL::Module *module, std::map<RTLIL::Const
|
|||
RTLIL::Const pattern = it.first;
|
||||
RTLIL::SigSpec eq_sig_a, eq_sig_b, or_sig;
|
||||
|
||||
for (size_t j = 0; j < pattern.bits.size(); j++)
|
||||
if (pattern.bits[j] == RTLIL::State::S0 || pattern.bits[j] == RTLIL::State::S1) {
|
||||
for (size_t j = 0; j < pattern.size(); j++)
|
||||
if (pattern[j] == RTLIL::State::S0 || pattern[j] == RTLIL::State::S1) {
|
||||
eq_sig_a.append(ctrl_in.extract(j, 1));
|
||||
eq_sig_b.append(RTLIL::SigSpec(pattern.bits[j]));
|
||||
eq_sig_b.append(RTLIL::SigSpec(pattern[j]));
|
||||
}
|
||||
|
||||
for (int in_state : it.second)
|
||||
|
@ -176,7 +176,7 @@ static void map_fsm(RTLIL::Cell *fsm_cell, RTLIL::Module *module)
|
|||
state_dff->type = ID($adff);
|
||||
state_dff->parameters[ID::ARST_POLARITY] = fsm_cell->parameters[ID::ARST_POLARITY];
|
||||
state_dff->parameters[ID::ARST_VALUE] = fsm_data.state_table[fsm_data.reset_state];
|
||||
for (auto &bit : state_dff->parameters[ID::ARST_VALUE].bits)
|
||||
for (auto &bit : state_dff->parameters[ID::ARST_VALUE].bits())
|
||||
if (bit != RTLIL::State::S1)
|
||||
bit = RTLIL::State::S0;
|
||||
state_dff->setPort(ID::ARST, fsm_cell->getPort(ID::ARST));
|
||||
|
@ -198,10 +198,10 @@ static void map_fsm(RTLIL::Cell *fsm_cell, RTLIL::Module *module)
|
|||
RTLIL::Const state = fsm_data.state_table[i];
|
||||
RTLIL::SigSpec sig_a, sig_b;
|
||||
|
||||
for (size_t j = 0; j < state.bits.size(); j++)
|
||||
if (state.bits[j] == RTLIL::State::S0 || state.bits[j] == RTLIL::State::S1) {
|
||||
for (size_t j = 0; j < state.size(); j++)
|
||||
if (state[j] == RTLIL::State::S0 || state[j] == RTLIL::State::S1) {
|
||||
sig_a.append(RTLIL::SigSpec(state_wire, j));
|
||||
sig_b.append(RTLIL::SigSpec(state.bits[j]));
|
||||
sig_b.append(RTLIL::SigSpec(state[j]));
|
||||
}
|
||||
|
||||
if (sig_b == RTLIL::SigSpec(RTLIL::State::S1))
|
||||
|
@ -261,8 +261,8 @@ static void map_fsm(RTLIL::Cell *fsm_cell, RTLIL::Module *module)
|
|||
for (size_t i = 0; i < fsm_data.state_table.size(); i++) {
|
||||
RTLIL::Const state = fsm_data.state_table[i];
|
||||
int bit_idx = -1;
|
||||
for (size_t j = 0; j < state.bits.size(); j++)
|
||||
if (state.bits[j] == RTLIL::State::S1)
|
||||
for (size_t j = 0; j < state.size(); j++)
|
||||
if (state[j] == RTLIL::State::S1)
|
||||
bit_idx = j;
|
||||
if (bit_idx >= 0)
|
||||
next_state_sig.replace(bit_idx, RTLIL::SigSpec(next_state_onehot, i));
|
||||
|
@ -306,7 +306,7 @@ static void map_fsm(RTLIL::Cell *fsm_cell, RTLIL::Module *module)
|
|||
fullstate_cache.insert(j);
|
||||
|
||||
for (auto &tr : fsm_data.transition_table) {
|
||||
if (tr.ctrl_out.bits[i] == RTLIL::State::S1)
|
||||
if (tr.ctrl_out[i] == RTLIL::State::S1)
|
||||
pattern_cache[tr.ctrl_in].insert(tr.state_in);
|
||||
else
|
||||
fullstate_cache.erase(tr.state_in);
|
||||
|
|
|
@ -106,11 +106,11 @@ struct FsmOpt
|
|||
for (int i = 0; i < ctrl_in.size(); i++) {
|
||||
RTLIL::SigSpec ctrl_bit = ctrl_in.extract(i, 1);
|
||||
if (ctrl_bit.is_fully_const()) {
|
||||
if (tr.ctrl_in.bits[i] <= RTLIL::State::S1 && RTLIL::SigSpec(tr.ctrl_in.bits[i]) != ctrl_bit)
|
||||
if (tr.ctrl_in[i] <= RTLIL::State::S1 && RTLIL::SigSpec(tr.ctrl_in[i]) != ctrl_bit)
|
||||
goto delete_this_transition;
|
||||
continue;
|
||||
}
|
||||
if (tr.ctrl_in.bits[i] <= RTLIL::State::S1)
|
||||
if (tr.ctrl_in[i] <= RTLIL::State::S1)
|
||||
ctrl_in_used[i] = true;
|
||||
}
|
||||
new_transition_table.push_back(tr);
|
||||
|
@ -169,8 +169,8 @@ struct FsmOpt
|
|||
|
||||
for (auto tr : fsm_data.transition_table)
|
||||
{
|
||||
RTLIL::State &si = tr.ctrl_in.bits[i];
|
||||
RTLIL::State &sj = tr.ctrl_in.bits[j];
|
||||
RTLIL::State &si = tr.ctrl_in.bits()[i];
|
||||
RTLIL::State &sj = tr.ctrl_in.bits()[j];
|
||||
|
||||
if (si > RTLIL::State::S1)
|
||||
si = sj;
|
||||
|
@ -207,8 +207,8 @@ struct FsmOpt
|
|||
|
||||
for (auto tr : fsm_data.transition_table)
|
||||
{
|
||||
RTLIL::State &si = tr.ctrl_in.bits[i];
|
||||
RTLIL::State &sj = tr.ctrl_out.bits[j];
|
||||
RTLIL::State &si = tr.ctrl_in.bits()[i];
|
||||
RTLIL::State &sj = tr.ctrl_out.bits()[j];
|
||||
|
||||
if (si > RTLIL::State::S1 || si == sj) {
|
||||
RTLIL::SigSpec tmp(tr.ctrl_in);
|
||||
|
@ -232,22 +232,22 @@ struct FsmOpt
|
|||
|
||||
for (auto &pattern : set)
|
||||
{
|
||||
if (pattern.bits[bit] > RTLIL::State::S1) {
|
||||
if (pattern[bit] > RTLIL::State::S1) {
|
||||
new_set.insert(pattern);
|
||||
continue;
|
||||
}
|
||||
|
||||
RTLIL::Const other_pattern = pattern;
|
||||
|
||||
if (pattern.bits[bit] == RTLIL::State::S1)
|
||||
other_pattern.bits[bit] = RTLIL::State::S0;
|
||||
if (pattern[bit] == RTLIL::State::S1)
|
||||
other_pattern.bits()[bit] = RTLIL::State::S0;
|
||||
else
|
||||
other_pattern.bits[bit] = RTLIL::State::S1;
|
||||
other_pattern.bits()[bit] = RTLIL::State::S1;
|
||||
|
||||
if (set.count(other_pattern) > 0) {
|
||||
log(" Merging pattern %s and %s from group (%d %d %s).\n", log_signal(pattern), log_signal(other_pattern),
|
||||
tr.state_in, tr.state_out, log_signal(tr.ctrl_out));
|
||||
other_pattern.bits[bit] = RTLIL::State::Sa;
|
||||
other_pattern.bits()[bit] = RTLIL::State::Sa;
|
||||
new_set.insert(other_pattern);
|
||||
did_something = true;
|
||||
continue;
|
||||
|
|
|
@ -43,8 +43,8 @@ static void fm_set_fsm_print(RTLIL::Cell *cell, RTLIL::Module *module, FsmData &
|
|||
fprintf(f, "set_fsm_encoding {");
|
||||
for (int i = 0; i < GetSize(fsm_data.state_table); i++) {
|
||||
fprintf(f, " s%d=2#", i);
|
||||
for (int j = GetSize(fsm_data.state_table[i].bits)-1; j >= 0; j--)
|
||||
fprintf(f, "%c", fsm_data.state_table[i].bits[j] == RTLIL::State::S1 ? '1' : '0');
|
||||
for (int j = GetSize(fsm_data.state_table[i])-1; j >= 0; j--)
|
||||
fprintf(f, "%c", fsm_data.state_table[i][j] == RTLIL::State::S1 ? '1' : '0');
|
||||
}
|
||||
fprintf(f, " } -name {%s_%s} {%s:/WORK/%s}\n",
|
||||
prefix, RTLIL::unescape_id(name).c_str(),
|
||||
|
@ -105,7 +105,7 @@ static void fsm_recode(RTLIL::Cell *cell, RTLIL::Module *module, FILE *fm_set_fs
|
|||
|
||||
if (encoding == "one-hot") {
|
||||
new_code = RTLIL::Const(RTLIL::State::Sa, fsm_data.state_bits);
|
||||
new_code.bits[state_idx] = RTLIL::State::S1;
|
||||
new_code.bits()[state_idx] = RTLIL::State::S1;
|
||||
} else
|
||||
if (encoding == "binary") {
|
||||
new_code = RTLIL::Const(state_idx, fsm_data.state_bits);
|
||||
|
|
|
@ -48,8 +48,8 @@ struct FsmData
|
|||
cell->parameters[ID::STATE_TABLE] = RTLIL::Const();
|
||||
|
||||
for (int i = 0; i < int(state_table.size()); i++) {
|
||||
std::vector<RTLIL::State> &bits_table = cell->parameters[ID::STATE_TABLE].bits;
|
||||
std::vector<RTLIL::State> &bits_state = state_table[i].bits;
|
||||
std::vector<RTLIL::State> &bits_table = cell->parameters[ID::STATE_TABLE].bits();
|
||||
std::vector<RTLIL::State> &bits_state = state_table[i].bits();
|
||||
bits_table.insert(bits_table.end(), bits_state.begin(), bits_state.end());
|
||||
}
|
||||
|
||||
|
@ -57,16 +57,16 @@ struct FsmData
|
|||
cell->parameters[ID::TRANS_TABLE] = RTLIL::Const();
|
||||
for (int i = 0; i < int(transition_table.size()); i++)
|
||||
{
|
||||
std::vector<RTLIL::State> &bits_table = cell->parameters[ID::TRANS_TABLE].bits;
|
||||
std::vector<RTLIL::State> &bits_table = cell->parameters[ID::TRANS_TABLE].bits();
|
||||
transition_t &tr = transition_table[i];
|
||||
|
||||
RTLIL::Const const_state_in = RTLIL::Const(tr.state_in, state_num_log2);
|
||||
RTLIL::Const const_state_out = RTLIL::Const(tr.state_out, state_num_log2);
|
||||
std::vector<RTLIL::State> &bits_state_in = const_state_in.bits;
|
||||
std::vector<RTLIL::State> &bits_state_out = const_state_out.bits;
|
||||
std::vector<RTLIL::State> &bits_state_in = const_state_in.bits();
|
||||
std::vector<RTLIL::State> &bits_state_out = const_state_out.bits();
|
||||
|
||||
std::vector<RTLIL::State> &bits_ctrl_in = tr.ctrl_in.bits;
|
||||
std::vector<RTLIL::State> &bits_ctrl_out = tr.ctrl_out.bits;
|
||||
std::vector<RTLIL::State> &bits_ctrl_in = tr.ctrl_in.bits();
|
||||
std::vector<RTLIL::State> &bits_ctrl_out = tr.ctrl_out.bits();
|
||||
|
||||
// append lsb first
|
||||
bits_table.insert(bits_table.end(), bits_ctrl_out.begin(), bits_ctrl_out.end());
|
||||
|
@ -97,23 +97,23 @@ struct FsmData
|
|||
for (int i = 0; i < state_num; i++) {
|
||||
RTLIL::Const state_code;
|
||||
int off_begin = i*state_bits, off_end = off_begin + state_bits;
|
||||
state_code.bits.insert(state_code.bits.begin(), state_table.bits.begin()+off_begin, state_table.bits.begin()+off_end);
|
||||
state_code.bits().insert(state_code.bits().begin(), state_table.begin()+off_begin, state_table.begin()+off_end);
|
||||
this->state_table.push_back(state_code);
|
||||
}
|
||||
|
||||
for (int i = 0; i < trans_num; i++)
|
||||
{
|
||||
auto off_ctrl_out = trans_table.bits.begin() + i*(num_inputs+num_outputs+2*state_num_log2);
|
||||
auto off_ctrl_out = trans_table.begin() + i*(num_inputs+num_outputs+2*state_num_log2);
|
||||
auto off_state_out = off_ctrl_out + num_outputs;
|
||||
auto off_ctrl_in = off_state_out + state_num_log2;
|
||||
auto off_state_in = off_ctrl_in + num_inputs;
|
||||
auto off_end = off_state_in + state_num_log2;
|
||||
|
||||
RTLIL::Const state_in, state_out, ctrl_in, ctrl_out;
|
||||
ctrl_out.bits.insert(state_in.bits.begin(), off_ctrl_out, off_state_out);
|
||||
state_out.bits.insert(state_out.bits.begin(), off_state_out, off_ctrl_in);
|
||||
ctrl_in.bits.insert(ctrl_in.bits.begin(), off_ctrl_in, off_state_in);
|
||||
state_in.bits.insert(state_in.bits.begin(), off_state_in, off_end);
|
||||
ctrl_out.bits().insert(ctrl_out.bits().begin(), off_ctrl_out, off_state_out);
|
||||
state_out.bits().insert(state_out.bits().begin(), off_state_out, off_ctrl_in);
|
||||
ctrl_in.bits().insert(ctrl_in.bits().begin(), off_ctrl_in, off_state_in);
|
||||
state_in.bits().insert(state_in.bits().begin(), off_state_in, off_end);
|
||||
|
||||
transition_t tr;
|
||||
tr.state_in = state_in.as_int();
|
||||
|
|
|
@ -219,7 +219,7 @@ struct IFExpander
|
|||
const RTLIL::SigSpec &conn_signals)
|
||||
{
|
||||
// Check if the connected wire is a potential interface in the parent module
|
||||
std::string interface_name_str = conn_signals.bits()[0].wire->name.str();
|
||||
std::string interface_name_str = conn_signals[0].wire->name.str();
|
||||
// Strip the prefix '$dummywireforinterface' from the dummy wire to get the name
|
||||
interface_name_str.replace(0,23,"");
|
||||
interface_name_str = "\\" + interface_name_str;
|
||||
|
@ -289,7 +289,7 @@ struct IFExpander
|
|||
return;
|
||||
|
||||
// If the connection looks like an interface, handle it.
|
||||
const auto &bits = conn_signals.bits();
|
||||
const auto &bits = conn_signals;
|
||||
if (bits.size() == 1 && bits[0].wire->get_bool_attribute(ID::is_interface))
|
||||
on_interface(submodule, conn_name, conn_signals);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ struct SubmodWorker
|
|||
flag_wire(c.wire, create, set_int_used, set_ext_driven, set_ext_used);
|
||||
if (set_int_driven)
|
||||
for (int i = c.offset; i < c.offset+c.width; i++) {
|
||||
wire_flags.at(c.wire).is_int_driven[i] = State::S1;
|
||||
wire_flags.at(c.wire).is_int_driven.bits()[i] = State::S1;
|
||||
flag_found_something = true;
|
||||
}
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ struct SubmodWorker
|
|||
auto it = sig[i].wire->attributes.find(ID::init);
|
||||
if (it != sig[i].wire->attributes.end()) {
|
||||
auto jt = new_wire->attributes.insert(std::make_pair(ID::init, Const(State::Sx, GetSize(sig)))).first;
|
||||
jt->second[i] = it->second[sig[i].offset];
|
||||
it->second[sig[i].offset] = State::Sx;
|
||||
jt->second.bits()[i] = it->second[sig[i].offset];
|
||||
it->second.bits()[sig[i].offset] = State::Sx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ struct SubmodWorker
|
|||
|
||||
for (auto cell : module->cells())
|
||||
{
|
||||
if (cell->attributes.count(ID::submod) == 0 || cell->attributes[ID::submod].bits.size() == 0) {
|
||||
if (cell->attributes.count(ID::submod) == 0 || cell->attributes[ID::submod].size() == 0) {
|
||||
cell->attributes.erase(ID::submod);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -848,9 +848,9 @@ grow_read_ports:;
|
|||
for (int i = 0; i < mem.width; i++)
|
||||
if (shuffle_map[i] != -1) {
|
||||
module->connect(port.data[shuffle_map[i]], new_data[i]);
|
||||
new_init_value[i] = port.init_value[shuffle_map[i]];
|
||||
new_arst_value[i] = port.arst_value[shuffle_map[i]];
|
||||
new_srst_value[i] = port.srst_value[shuffle_map[i]];
|
||||
new_init_value.bits()[i] = port.init_value[shuffle_map[i]];
|
||||
new_arst_value.bits()[i] = port.arst_value[shuffle_map[i]];
|
||||
new_srst_value.bits()[i] = port.srst_value[shuffle_map[i]];
|
||||
}
|
||||
port.data = new_data;
|
||||
port.init_value = new_init_value;
|
||||
|
@ -887,9 +887,9 @@ grow_read_ports:;
|
|||
for (int i = 0; i < init_size; i++)
|
||||
for (int j = 0; j < bram.dbits; j++)
|
||||
if (init_offset+i < GetSize(initdata) && init_offset+i >= 0)
|
||||
initparam[i*bram.dbits+j] = initdata[init_offset+i][init_shift+j];
|
||||
initparam.bits()[i*bram.dbits+j] = initdata[init_offset+i][init_shift+j];
|
||||
else
|
||||
initparam[i*bram.dbits+j] = State::Sx;
|
||||
initparam.bits()[i*bram.dbits+j] = State::Sx;
|
||||
c->setParam(ID::INIT, initparam);
|
||||
}
|
||||
|
||||
|
|
|
@ -1019,7 +1019,7 @@ void MemMapping::handle_priority() {
|
|||
}
|
||||
|
||||
bool is_all_zero(const Const &val) {
|
||||
for (auto bit: val.bits)
|
||||
for (auto bit: val)
|
||||
if (bit == State::S1)
|
||||
return false;
|
||||
return true;
|
||||
|
@ -1913,7 +1913,7 @@ void MemMapping::emit_port(const MemConfig &cfg, std::vector<Cell*> &cells, cons
|
|||
if (!bit.valid) {
|
||||
hw_val.push_back(State::Sx);
|
||||
} else {
|
||||
hw_val.push_back(val.bits[bit.bit]);
|
||||
hw_val.push_back(val[bit.bit]);
|
||||
}
|
||||
}
|
||||
if (pdef.rdinitval == ResetValKind::NoUndef)
|
||||
|
@ -1926,7 +1926,7 @@ void MemMapping::emit_port(const MemConfig &cfg, std::vector<Cell*> &cells, cons
|
|||
if (!bit.valid) {
|
||||
hw_val.push_back(State::Sx);
|
||||
} else {
|
||||
hw_val.push_back(rport.arst_value.bits[bit.bit]);
|
||||
hw_val.push_back(rport.arst_value[bit.bit]);
|
||||
}
|
||||
}
|
||||
if (pdef.rdarstval == ResetValKind::NoUndef)
|
||||
|
@ -1939,7 +1939,7 @@ void MemMapping::emit_port(const MemConfig &cfg, std::vector<Cell*> &cells, cons
|
|||
if (!bit.valid) {
|
||||
hw_val.push_back(State::Sx);
|
||||
} else {
|
||||
hw_val.push_back(rport.srst_value.bits[bit.bit]);
|
||||
hw_val.push_back(rport.srst_value[bit.bit]);
|
||||
}
|
||||
}
|
||||
if (pdef.rdsrstval == ResetValKind::NoUndef)
|
||||
|
@ -2103,7 +2103,7 @@ void MemMapping::emit(const MemConfig &cfg) {
|
|||
if (hwa & 1 << i)
|
||||
addr += 1 << hw_addr_swizzle[i];
|
||||
if (addr >= mem.start_offset && addr < mem.start_offset + mem.size)
|
||||
initval.push_back(init_data.bits[(addr - mem.start_offset) * mem.width + bit.bit]);
|
||||
initval.push_back(init_data[(addr - mem.start_offset) * mem.width + bit.bit]);
|
||||
else
|
||||
initval.push_back(State::Sx);
|
||||
}
|
||||
|
|
|
@ -60,11 +60,11 @@ struct MemoryShareWorker
|
|||
bool merge_rst_value(Mem &mem, Const &res, int wide_log2, const Const &src1, int sub1, const Const &src2, int sub2) {
|
||||
res = Const(State::Sx, mem.width << wide_log2);
|
||||
for (int i = 0; i < GetSize(src1); i++)
|
||||
res[i + sub1 * mem.width] = src1[i];
|
||||
res.bits()[i + sub1 * mem.width] = src1[i];
|
||||
for (int i = 0; i < GetSize(src2); i++) {
|
||||
if (src2[i] == State::Sx)
|
||||
continue;
|
||||
auto &dst = res[i + sub2 * mem.width];
|
||||
auto &dst = res.bits()[i + sub2 * mem.width];
|
||||
if (dst == src2[i])
|
||||
continue;
|
||||
if (dst != State::Sx)
|
||||
|
|
|
@ -94,7 +94,7 @@ struct ExclusiveDatabase
|
|||
SigSpec nonconst_sig;
|
||||
pool<Const> const_values;
|
||||
|
||||
for (auto bit : sig.bits()) {
|
||||
for (auto bit : sig) {
|
||||
auto it = sig_cmp_prev.find(bit);
|
||||
if (it == sig_cmp_prev.end())
|
||||
return false;
|
||||
|
@ -152,7 +152,7 @@ struct MuxpackWorker
|
|||
SigSpec y_sig = sigmap(cell->getPort(ID::Y));
|
||||
|
||||
if (sig_chain_next.count(a_sig))
|
||||
for (auto a_bit : a_sig.bits())
|
||||
for (auto a_bit : a_sig)
|
||||
sigbit_with_non_chain_users.insert(a_bit);
|
||||
else {
|
||||
sig_chain_next[a_sig] = cell;
|
||||
|
@ -161,7 +161,7 @@ struct MuxpackWorker
|
|||
|
||||
if (!b_sig.empty()) {
|
||||
if (sig_chain_next.count(b_sig))
|
||||
for (auto b_bit : b_sig.bits())
|
||||
for (auto b_bit : b_sig)
|
||||
sigbit_with_non_chain_users.insert(b_bit);
|
||||
else {
|
||||
sig_chain_next[b_sig] = cell;
|
||||
|
@ -201,7 +201,7 @@ struct MuxpackWorker
|
|||
}
|
||||
else log_abort();
|
||||
|
||||
for (auto bit : a_sig.bits())
|
||||
for (auto bit : a_sig)
|
||||
if (sigbit_with_non_chain_users.count(bit))
|
||||
goto start_cell;
|
||||
|
||||
|
|
|
@ -393,8 +393,8 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool verbos
|
|||
RTLIL::Const &val = it2->second;
|
||||
SigSpec sig = assign_map(wire);
|
||||
for (int i = 0; i < GetSize(val) && i < GetSize(sig); i++)
|
||||
if (val.bits[i] != State::Sx)
|
||||
init_bits[sig[i]] = val.bits[i];
|
||||
if (val[i] != State::Sx)
|
||||
init_bits[sig[i]] = val[i];
|
||||
wire->attributes.erase(it2);
|
||||
}
|
||||
}
|
||||
|
@ -406,7 +406,7 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool verbos
|
|||
for (int i = 0; i < wire->width; i++) {
|
||||
auto it = init_bits.find(RTLIL::SigBit(wire, i));
|
||||
if (it != init_bits.end()) {
|
||||
val.bits[i] = it->second;
|
||||
val.bits()[i] = it->second;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool verbos
|
|||
if (wire->attributes.count(ID::init))
|
||||
initval = wire->attributes.at(ID::init);
|
||||
if (GetSize(initval) != GetSize(wire))
|
||||
initval.bits.resize(GetSize(wire), State::Sx);
|
||||
initval.bits().resize(GetSize(wire), State::Sx);
|
||||
if (initval.is_fully_undef())
|
||||
wire->attributes.erase(ID::init);
|
||||
|
||||
|
@ -457,7 +457,7 @@ bool rmunused_module_signals(RTLIL::Module *module, bool purge_mode, bool verbos
|
|||
if (s1[i] != s2[i]) {
|
||||
if (s2[i] == State::Sx && (initval[i] == State::S0 || initval[i] == State::S1)) {
|
||||
s2[i] = initval[i];
|
||||
initval[i] = State::Sx;
|
||||
initval.bits()[i] = State::Sx;
|
||||
}
|
||||
new_conn.first.append(s1[i]);
|
||||
new_conn.second.append(s2[i]);
|
||||
|
|
|
@ -361,9 +361,9 @@ struct OptDffWorker
|
|||
bool failed = false;
|
||||
for (int i = 0; i < ff.width; i++) {
|
||||
if (ff.sig_clr[i] == sig_arst && ff.sig_set[i] == val_neutral)
|
||||
val_arst.bits.push_back(State::S0);
|
||||
val_arst.bits().push_back(State::S0);
|
||||
else if (ff.sig_set[i] == sig_arst && ff.sig_clr[i] == val_neutral)
|
||||
val_arst.bits.push_back(State::S1);
|
||||
val_arst.bits().push_back(State::S1);
|
||||
else
|
||||
failed = true;
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ struct OptDffWorker
|
|||
groups[resets].push_back(i);
|
||||
} else
|
||||
remaining_indices.push_back(i);
|
||||
val_srst.bits.push_back(reset_val);
|
||||
val_srst.bits().push_back(reset_val);
|
||||
}
|
||||
|
||||
for (auto &it : groups) {
|
||||
|
@ -634,7 +634,7 @@ struct OptDffWorker
|
|||
new_ff.val_srst = Const();
|
||||
for (int i = 0; i < new_ff.width; i++) {
|
||||
int j = it.second[i];
|
||||
new_ff.val_srst.bits.push_back(val_srst[j]);
|
||||
new_ff.val_srst.bits().push_back(val_srst[j]);
|
||||
}
|
||||
ctrl_t srst = combine_resets(it.first, ff.is_fine);
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ void replace_undriven(RTLIL::Module *module, const CellTypes &ct)
|
|||
auto cursor = initbits.find(bit);
|
||||
if (cursor != initbits.end()) {
|
||||
revisit_initwires.insert(cursor->second.first);
|
||||
val[i] = cursor->second.second;
|
||||
val.bits()[i] = cursor->second.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ void replace_undriven(RTLIL::Module *module, const CellTypes &ct)
|
|||
Const initval = wire->attributes.at(ID::init);
|
||||
for (int i = 0; i < GetSize(initval) && i < GetSize(wire); i++) {
|
||||
if (SigBit(initval[i]) == sig[i])
|
||||
initval[i] = State::Sx;
|
||||
initval.bits()[i] = State::Sx;
|
||||
}
|
||||
if (initval.is_fully_undef()) {
|
||||
log_debug("Removing init attribute from %s/%s.\n", log_id(module), log_id(wire));
|
||||
|
@ -351,21 +351,21 @@ bool is_one_or_minus_one(const Const &value, bool is_signed, bool &is_negative)
|
|||
bool all_bits_one = true;
|
||||
bool last_bit_one = true;
|
||||
|
||||
if (GetSize(value.bits) < 1)
|
||||
if (GetSize(value) < 1)
|
||||
return false;
|
||||
|
||||
if (GetSize(value.bits) == 1) {
|
||||
if (value.bits[0] != State::S1)
|
||||
if (GetSize(value) == 1) {
|
||||
if (value[0] != State::S1)
|
||||
return false;
|
||||
if (is_signed)
|
||||
is_negative = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < GetSize(value.bits); i++) {
|
||||
if (value.bits[i] != State::S1)
|
||||
for (int i = 0; i < GetSize(value); i++) {
|
||||
if (value[i] != State::S1)
|
||||
all_bits_one = false;
|
||||
if (value.bits[i] != (i ? State::S0 : State::S1))
|
||||
if (value[i] != (i ? State::S0 : State::S1))
|
||||
last_bit_one = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ struct OptFfInvWorker
|
|||
Const mask = lut->getParam(ID::LUT);
|
||||
Const new_mask;
|
||||
for (int j = 0; j < (1 << GetSize(sig_a)); j++) {
|
||||
new_mask.bits.push_back(mask.bits[j ^ flip_mask]);
|
||||
new_mask.bits().push_back(mask[j ^ flip_mask]);
|
||||
}
|
||||
if (GetSize(sig_a) == 1 && new_mask.as_int() == 2) {
|
||||
module->connect(lut->getPort(ID::Y), ff.sig_q);
|
||||
|
@ -180,10 +180,10 @@ struct OptFfInvWorker
|
|||
Const mask = d_lut->getParam(ID::LUT);
|
||||
Const new_mask;
|
||||
for (int i = 0; i < GetSize(mask); i++) {
|
||||
if (mask.bits[i] == State::S0)
|
||||
new_mask.bits.push_back(State::S1);
|
||||
if (mask[i] == State::S0)
|
||||
new_mask.bits().push_back(State::S1);
|
||||
else
|
||||
new_mask.bits.push_back(State::S0);
|
||||
new_mask.bits().push_back(State::S0);
|
||||
}
|
||||
d_lut->setParam(ID::LUT, new_mask);
|
||||
if (d_lut->getParam(ID::WIDTH) == 1 && new_mask.as_int() == 2) {
|
||||
|
|
|
@ -493,7 +493,7 @@ struct OptLutWorker
|
|||
eval_inputs[lutM_new_inputs[i]] = (eval >> i) & 1;
|
||||
}
|
||||
eval_inputs[lutA_output] = evaluate_lut(lutA, eval_inputs);
|
||||
lutM_new_table[eval] = (RTLIL::State) evaluate_lut(lutB, eval_inputs);
|
||||
lutM_new_table.bits()[eval] = (RTLIL::State) evaluate_lut(lutB, eval_inputs);
|
||||
}
|
||||
|
||||
log_debug(" Cell A truth table: %s.\n", lutA->getParam(ID::LUT).as_string().c_str());
|
||||
|
|
|
@ -78,7 +78,7 @@ struct OptLutInsPass : public Pass {
|
|||
if (techname == "") {
|
||||
if (cell->type != ID($lut))
|
||||
continue;
|
||||
inputs = cell->getPort(ID::A).bits();
|
||||
inputs = cell->getPort(ID::A);
|
||||
output = cell->getPort(ID::Y);
|
||||
lut = cell->getParam(ID::LUT);
|
||||
} else if (techname == "xilinx" || techname == "gowin") {
|
||||
|
@ -213,7 +213,7 @@ struct OptLutInsPass : public Pass {
|
|||
}
|
||||
lidx |= val << j;
|
||||
}
|
||||
new_lut[i] = lut[lidx];
|
||||
new_lut.bits()[i] = lut[lidx];
|
||||
}
|
||||
// For lattice, and gowin do not replace with a const driver — the nextpnr
|
||||
// packer requires a complete set of LUTs for wide LUT muxes.
|
||||
|
|
|
@ -90,7 +90,7 @@ struct OptMemPass : public Pass {
|
|||
}
|
||||
for (auto &init : mem.inits) {
|
||||
for (int i = 0; i < GetSize(init.data); i++) {
|
||||
State bit = init.data.bits[i];
|
||||
State bit = init.data[i];
|
||||
int lane = i % mem.width;
|
||||
if (bit != State::Sx && bit != State::S0) {
|
||||
always_0[lane] = false;
|
||||
|
@ -182,9 +182,9 @@ struct OptMemPass : public Pass {
|
|||
for (auto i: swizzle) {
|
||||
int bidx = sub * mem.width + i;
|
||||
new_data.append(port.data[bidx]);
|
||||
new_init.bits.push_back(port.init_value.bits[bidx]);
|
||||
new_arst.bits.push_back(port.arst_value.bits[bidx]);
|
||||
new_srst.bits.push_back(port.srst_value.bits[bidx]);
|
||||
new_init.bits().push_back(port.init_value[bidx]);
|
||||
new_arst.bits().push_back(port.arst_value[bidx]);
|
||||
new_srst.bits().push_back(port.srst_value[bidx]);
|
||||
}
|
||||
}
|
||||
port.data = new_data;
|
||||
|
@ -197,11 +197,11 @@ struct OptMemPass : public Pass {
|
|||
Const new_en;
|
||||
for (int s = 0; s < GetSize(init.data); s += mem.width) {
|
||||
for (auto i: swizzle) {
|
||||
new_data.bits.push_back(init.data.bits[s + i]);
|
||||
new_data.bits().push_back(init.data[s + i]);
|
||||
}
|
||||
}
|
||||
for (auto i: swizzle) {
|
||||
new_en.bits.push_back(init.en.bits[i]);
|
||||
new_en.bits().push_back(init.en[i]);
|
||||
}
|
||||
init.data = new_data;
|
||||
init.en = new_en;
|
||||
|
|
|
@ -323,7 +323,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
|
||||
for (auto it : bits) {
|
||||
entry.first.append(it.first);
|
||||
entry.second.bits.push_back(it.second);
|
||||
entry.second.bits().push_back(it.second);
|
||||
}
|
||||
|
||||
eqdb[sigmap(cell->getPort(ID::Y)[0])] = entry;
|
||||
|
@ -344,7 +344,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
|
||||
for (auto it : bits) {
|
||||
entry.first.append(it.first);
|
||||
entry.second.bits.push_back(it.second);
|
||||
entry.second.bits().push_back(it.second);
|
||||
}
|
||||
|
||||
eqdb[sigmap(cell->getPort(ID::Y)[0])] = entry;
|
||||
|
@ -411,7 +411,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
for (int i : seldb.at(sig)) {
|
||||
Const val = eqdb.at(S[i]).second;
|
||||
int onebits = 0;
|
||||
for (auto b : val.bits)
|
||||
for (auto b : val)
|
||||
if (b == State::S1)
|
||||
onebits++;
|
||||
if (onebits > 1)
|
||||
|
@ -590,7 +590,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
|
||||
used_src_columns[best_src_col] = true;
|
||||
perm_new_from_old[dst_col] = best_src_col;
|
||||
perm_xormask[dst_col] = best_inv ? State::S1 : State::S0;
|
||||
perm_xormask.bits()[dst_col] = best_inv ? State::S1 : State::S0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
Const new_c(State::S0, GetSize(old_c));
|
||||
|
||||
for (int i = 0; i < GetSize(old_c); i++)
|
||||
new_c[i] = old_c[perm_new_from_old[i]];
|
||||
new_c.bits()[i] = old_c[perm_new_from_old[i]];
|
||||
|
||||
Const new_c_before_xor = new_c;
|
||||
new_c = const_xor(new_c, perm_xormask, false, false, GetSize(new_c));
|
||||
|
@ -686,7 +686,7 @@ struct Pmux2ShiftxPass : public Pass {
|
|||
if (!full_case) {
|
||||
Const enable_mask(State::S0, max_choice+1);
|
||||
for (auto &it : perm_choices)
|
||||
enable_mask[it.first.as_int()] = State::S1;
|
||||
enable_mask.bits()[it.first.as_int()] = State::S1;
|
||||
en = module->addWire(NEW_ID);
|
||||
module->addShift(NEW_ID, enable_mask, cmp, en, false, src);
|
||||
}
|
||||
|
|
|
@ -781,18 +781,18 @@ struct ShareWorker
|
|||
std::vector<RTLIL::SigBit> p_first_bits = p.first;
|
||||
for (int i = 0; i < GetSize(p_first_bits); i++) {
|
||||
RTLIL::SigBit b = p_first_bits[i];
|
||||
RTLIL::State v = p.second.bits[i];
|
||||
RTLIL::State v = p.second[i];
|
||||
if (p_bits.count(b) && p_bits.at(b) != v)
|
||||
return false;
|
||||
p_bits[b] = v;
|
||||
}
|
||||
|
||||
p.first = RTLIL::SigSpec();
|
||||
p.second.bits.clear();
|
||||
p.second.bits().clear();
|
||||
|
||||
for (auto &it : p_bits) {
|
||||
p.first.append(it.first);
|
||||
p.second.bits.push_back(it.second);
|
||||
p.second.bits().push_back(it.second);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -815,10 +815,10 @@ struct ShareWorker
|
|||
{
|
||||
auto otherval = val;
|
||||
|
||||
if (otherval.bits[i] == State::S0)
|
||||
otherval.bits[i] = State::S1;
|
||||
else if (otherval.bits[i] == State::S1)
|
||||
otherval.bits[i] = State::S0;
|
||||
if (otherval[i] == State::S0)
|
||||
otherval.bits()[i] = State::S1;
|
||||
else if (otherval[i] == State::S1)
|
||||
otherval.bits()[i] = State::S0;
|
||||
else
|
||||
continue;
|
||||
|
||||
|
@ -828,7 +828,7 @@ struct ShareWorker
|
|||
newsig.remove(i);
|
||||
|
||||
auto newval = val;
|
||||
newval.bits.erase(newval.bits.begin() + i);
|
||||
newval.bits().erase(newval.bits().begin() + i);
|
||||
|
||||
db[newsig].insert(newval);
|
||||
db[sig].erase(otherval);
|
||||
|
@ -907,14 +907,14 @@ struct ShareWorker
|
|||
if (used_in_a)
|
||||
for (auto p : c_patterns) {
|
||||
for (int i = 0; i < GetSize(sig_s); i++)
|
||||
p.first.append(sig_s[i]), p.second.bits.push_back(RTLIL::State::S0);
|
||||
p.first.append(sig_s[i]), p.second.bits().push_back(RTLIL::State::S0);
|
||||
if (sort_check_activation_pattern(p))
|
||||
activation_patterns_cache[cell].insert(p);
|
||||
}
|
||||
|
||||
for (int idx : used_in_b_parts)
|
||||
for (auto p : c_patterns) {
|
||||
p.first.append(sig_s[idx]), p.second.bits.push_back(RTLIL::State::S1);
|
||||
p.first.append(sig_s[idx]), p.second.bits().push_back(RTLIL::State::S1);
|
||||
if (sort_check_activation_pattern(p))
|
||||
activation_patterns_cache[cell].insert(p);
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ struct ShareWorker
|
|||
for (int i = 0; i < GetSize(p_first); i++)
|
||||
if (filter_bits.count(p_first[i]) == 0) {
|
||||
new_p.first.append(p_first[i]);
|
||||
new_p.second.bits.push_back(p.second.bits.at(i));
|
||||
new_p.second.bits().push_back(p.second.at(i));
|
||||
}
|
||||
|
||||
out.insert(new_p);
|
||||
|
|
|
@ -219,10 +219,10 @@ struct WreduceWorker
|
|||
|
||||
// Narrow ARST_VALUE parameter to new size.
|
||||
if (cell->parameters.count(ID::ARST_VALUE)) {
|
||||
rst_value.bits.resize(GetSize(sig_q));
|
||||
rst_value.bits().resize(GetSize(sig_q));
|
||||
cell->setParam(ID::ARST_VALUE, rst_value);
|
||||
} else if (cell->parameters.count(ID::SRST_VALUE)) {
|
||||
rst_value.bits.resize(GetSize(sig_q));
|
||||
rst_value.bits().resize(GetSize(sig_q));
|
||||
cell->setParam(ID::SRST_VALUE, rst_value);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void microchip_dsp_pack(microchip_dsp_pm &pm)
|
|||
continue;
|
||||
for (int i = c.offset; i < c.offset + c.width; i++) {
|
||||
log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
|
||||
it->second[i] = State::Sx;
|
||||
it->second.bits()[i] = State::Sx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -244,7 +244,7 @@ void microchip_dsp_packC(microchip_dsp_CREG_pm &pm)
|
|||
continue;
|
||||
for (int i = c.offset; i < c.offset + c.width; i++) {
|
||||
log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
|
||||
it->second[i] = State::Sx;
|
||||
it->second.bits()[i] = State::Sx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -339,11 +339,11 @@ void xilinx_dsp_pack(xilinx_dsp_pm &pm)
|
|||
|
||||
if (st.overflow->type == ID($ge)) {
|
||||
Const B = st.overflow->getPort(ID::B).as_const();
|
||||
log_assert(std::count(B.bits.begin(), B.bits.end(), State::S1) == 1);
|
||||
log_assert(std::count(B.begin(), B.end(), State::S1) == 1);
|
||||
// Since B is an exact power of 2, subtract 1
|
||||
// by inverting all bits up until hitting
|
||||
// that one hi bit
|
||||
for (auto &b : B.bits)
|
||||
for (auto &b : B.bits())
|
||||
if (b == State::S0) b = State::S1;
|
||||
else if (b == State::S1) {
|
||||
b = State::S0;
|
||||
|
@ -392,7 +392,7 @@ void xilinx_dsp_pack(xilinx_dsp_pm &pm)
|
|||
continue;
|
||||
for (int i = c.offset; i < c.offset+c.width; i++) {
|
||||
log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
|
||||
it->second[i] = State::Sx;
|
||||
it->second.bits()[i] = State::Sx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -579,7 +579,7 @@ void xilinx_dsp48a_pack(xilinx_dsp48a_pm &pm)
|
|||
continue;
|
||||
for (int i = c.offset; i < c.offset+c.width; i++) {
|
||||
log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
|
||||
it->second[i] = State::Sx;
|
||||
it->second.bits()[i] = State::Sx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -702,7 +702,7 @@ void xilinx_dsp_packC(xilinx_dsp_CREG_pm &pm)
|
|||
continue;
|
||||
for (int i = c.offset; i < c.offset+c.width; i++) {
|
||||
log_assert(it->second[i] == State::S0 || it->second[i] == State::Sx);
|
||||
it->second[i] = State::Sx;
|
||||
it->second.bits()[i] = State::Sx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -363,7 +363,7 @@ match overflow
|
|||
select GetSize(port(overflow, \Y)) <= 48
|
||||
select port(overflow, \B).is_fully_const()
|
||||
define <Const> B port(overflow, \B).as_const()
|
||||
select std::count(B.bits.begin(), B.bits.end(), State::S1) == 1
|
||||
select std::count(B.begin(), B.end(), State::S1) == 1
|
||||
index <SigSpec> port(overflow, \A) === sigP
|
||||
optional
|
||||
endmatch
|
||||
|
|
|
@ -40,7 +40,7 @@ void run_fixed(xilinx_srl_pm &pm)
|
|||
log_assert(Q.wire);
|
||||
auto it = Q.wire->attributes.find(ID::init);
|
||||
if (it != Q.wire->attributes.end()) {
|
||||
auto &i = it->second[Q.offset];
|
||||
auto &i = it->second.bits()[Q.offset];
|
||||
initval.append(i);
|
||||
i = State::Sx;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void run_variable(xilinx_srl_pm &pm)
|
|||
log_assert(Q.wire);
|
||||
auto it = Q.wire->attributes.find(ID::init);
|
||||
if (it != Q.wire->attributes.end()) {
|
||||
auto &i = it->second[Q.offset];
|
||||
auto &i = it->second.bits()[Q.offset];
|
||||
initval.append(i);
|
||||
i = State::Sx;
|
||||
}
|
||||
|
|
|
@ -53,11 +53,11 @@ void proc_init(RTLIL::Module *mod, SigMap &sigmap, RTLIL::Process *proc)
|
|||
Const value = valuesig.as_const();
|
||||
Const &wireinit = lhs_c.wire->attributes[ID::init];
|
||||
|
||||
while (GetSize(wireinit.bits) < lhs_c.wire->width)
|
||||
wireinit.bits.push_back(State::Sx);
|
||||
while (GetSize(wireinit) < lhs_c.wire->width)
|
||||
wireinit.bits().push_back(State::Sx);
|
||||
|
||||
for (int i = 0; i < lhs_c.width; i++) {
|
||||
auto &initbit = wireinit.bits[i + lhs_c.offset];
|
||||
auto &initbit = wireinit.bits()[i + lhs_c.offset];
|
||||
if (initbit != State::Sx && initbit != value[i])
|
||||
log_cmd_error("Conflicting initialization values for %s.\n", log_signal(lhs_c));
|
||||
initbit = value[i];
|
||||
|
|
|
@ -39,7 +39,7 @@ void proc_memwr(RTLIL::Module *mod, RTLIL::Process *proc, dict<IdString, int> &n
|
|||
Const priority_mask(State::S0, port_id);
|
||||
for (int i = 0; i < GetSize(prev_port_ids); i++)
|
||||
if (memwr.priority_mask[i] == State::S1)
|
||||
priority_mask[prev_port_ids[i]] = State::S1;
|
||||
priority_mask.bits()[prev_port_ids[i]] = State::S1;
|
||||
prev_port_ids.push_back(port_id);
|
||||
|
||||
RTLIL::Cell *cell = mod->addCell(NEW_ID, ID($memwr_v2));
|
||||
|
|
|
@ -97,10 +97,10 @@ struct RomWorker
|
|||
log_debug("rejecting switch: lhs not uniform\n");
|
||||
return;
|
||||
}
|
||||
val[it2->second] = it.second[i].data;
|
||||
val.bits()[it2->second] = it.second[i].data;
|
||||
}
|
||||
}
|
||||
for (auto bit: val.bits) {
|
||||
for (auto bit: val) {
|
||||
if (bit == State::Sm) {
|
||||
log_debug("rejecting switch: lhs not uniform\n");
|
||||
return;
|
||||
|
@ -113,8 +113,8 @@ struct RomWorker
|
|||
return;
|
||||
}
|
||||
Const c = addr.as_const();
|
||||
while (GetSize(c) && c.bits.back() == State::S0)
|
||||
c.bits.pop_back();
|
||||
while (GetSize(c) && c.back() == State::S0)
|
||||
c.bits().pop_back();
|
||||
if (GetSize(c) > swsigbits)
|
||||
continue;
|
||||
if (GetSize(c) > 30) {
|
||||
|
@ -160,11 +160,11 @@ struct RomWorker
|
|||
auto it = vals.find(i);
|
||||
if (it == vals.end()) {
|
||||
log_assert(got_default);
|
||||
for (auto bit: default_val.bits)
|
||||
init_data.bits.push_back(bit);
|
||||
for (auto bit: default_val)
|
||||
init_data.bits().push_back(bit);
|
||||
} else {
|
||||
for (auto bit: it->second.bits)
|
||||
init_data.bits.push_back(bit);
|
||||
for (auto bit: it->second)
|
||||
init_data.bits().push_back(bit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,13 +250,13 @@ struct VlogHammerReporter
|
|||
std::string module_name = module_names[mod].c_str();
|
||||
ConstEval ce(module);
|
||||
|
||||
std::vector<RTLIL::State> bits(patterns[idx].bits.begin(), patterns[idx].bits.begin() + total_input_width);
|
||||
std::vector<RTLIL::State> bits(patterns[idx].begin(), patterns[idx].begin() + total_input_width);
|
||||
for (int i = 0; i < int(inputs.size()); i++) {
|
||||
RTLIL::Wire *wire = module->wire(inputs[i]);
|
||||
for (int j = input_widths[i]-1; j >= 0; j--) {
|
||||
ce.set(RTLIL::SigSpec(wire, j), bits.back());
|
||||
recorded_set_vars.append(RTLIL::SigSpec(wire, j));
|
||||
recorded_set_vals.bits.push_back(bits.back());
|
||||
recorded_set_vals.bits().push_back(bits.back());
|
||||
bits.pop_back();
|
||||
}
|
||||
if (module == modules.front()) {
|
||||
|
@ -346,7 +346,7 @@ struct VlogHammerReporter
|
|||
log_error("Pattern %s is to short!\n", pattern.c_str());
|
||||
patterns.push_back(sig.as_const());
|
||||
if (invert_pattern) {
|
||||
for (auto &bit : patterns.back().bits)
|
||||
for (auto &bit : patterns.back().bits())
|
||||
if (bit == RTLIL::State::S0)
|
||||
bit = RTLIL::State::S1;
|
||||
else if (bit == RTLIL::State::S1)
|
||||
|
@ -557,7 +557,7 @@ struct EvalPass : public Pass {
|
|||
tab_line.clear();
|
||||
ce.pop();
|
||||
|
||||
tabvals = RTLIL::const_add(tabvals, RTLIL::Const(1), false, false, tabvals.bits.size());
|
||||
tabvals = RTLIL::const_add(tabvals, RTLIL::Const(1), false, false, tabvals.size());
|
||||
}
|
||||
while (tabvals.as_bool());
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void create_dff_dq_map(std::map<RTLIL::IdString, dff_map_info_t> &map, RTLIL::Mo
|
|||
info.arst_polarity = info.cell->parameters.at(ID::ARST_POLARITY).as_bool();
|
||||
std::vector<RTLIL::SigBit> sig_d = sigmap(info.cell->getPort(ID::D)).to_sigbit_vector();
|
||||
std::vector<RTLIL::SigBit> sig_q = sigmap(info.cell->getPort(ID::Q)).to_sigbit_vector();
|
||||
std::vector<RTLIL::State> arst_value = info.cell->parameters.at(ID::ARST_VALUE).bits;
|
||||
std::vector<RTLIL::State> arst_value = info.cell->parameters.at(ID::ARST_VALUE).to_bits();
|
||||
for (size_t i = 0; i < sig_d.size(); i++) {
|
||||
info.bit_d = sig_d.at(i);
|
||||
info.arst_value = arst_value.at(i);
|
||||
|
|
|
@ -363,7 +363,7 @@ struct PropagateWorker
|
|||
|
||||
for (auto wire : module->wires())
|
||||
if (wire->has_attribute(ID::replaced_by_gclk))
|
||||
replace_clk_bit(SigBit(wire), wire->attributes[ID::replaced_by_gclk].bits.at(0) == State::S1, false);
|
||||
replace_clk_bit(SigBit(wire), wire->attributes[ID::replaced_by_gclk].at(0) == State::S1, false);
|
||||
|
||||
for (auto cell : module->cells()) {
|
||||
if (cell->type.in(ID($not), ID($_NOT_))) {
|
||||
|
@ -622,7 +622,7 @@ struct FormalFfPass : public Pass {
|
|||
auto before = ff.val_init;
|
||||
for (int i = 0; i < ff.width; i++)
|
||||
if (ff.val_init[i] == State::Sx && !worker.is_initval_used(ff.sig_q[i]))
|
||||
ff.val_init[i] = State::S0;
|
||||
ff.val_init.bits()[i] = State::S0;
|
||||
|
||||
if (ff.val_init != before) {
|
||||
log("Setting unused undefined initial value of %s.%s (%s) from %s to %s\n",
|
||||
|
@ -745,7 +745,7 @@ struct FormalFfPass : public Pass {
|
|||
for (auto wire : module->wires()) {
|
||||
if (!wire->has_attribute(ID::replaced_by_gclk))
|
||||
continue;
|
||||
bool clk_pol = wire->attributes[ID::replaced_by_gclk].bits.at(0) == State::S1;
|
||||
bool clk_pol = wire->attributes[ID::replaced_by_gclk].at(0) == State::S1;
|
||||
|
||||
found.emplace_back(SigSpec(wire), clk_pol);
|
||||
}
|
||||
|
|
|
@ -629,9 +629,9 @@ struct SatHelper
|
|||
bool found_undef = false;
|
||||
|
||||
for (int i = 0; i < info.width; i++) {
|
||||
value.bits.push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
value.bits().push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
if (enable_undef && modelValues.at(modelExpressions.size()/2 + info.offset + i))
|
||||
value.bits.back() = RTLIL::State::Sx, found_undef = true;
|
||||
value.bits().back() = RTLIL::State::Sx, found_undef = true;
|
||||
}
|
||||
|
||||
if (info.timestep != last_timestep) {
|
||||
|
@ -740,9 +740,9 @@ struct SatHelper
|
|||
RTLIL::Const value;
|
||||
|
||||
for (int i = 0; i < info.width; i++) {
|
||||
value.bits.push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
value.bits().push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
if (enable_undef && modelValues.at(modelExpressions.size()/2 + info.offset + i))
|
||||
value.bits.back() = RTLIL::State::Sx;
|
||||
value.bits().back() = RTLIL::State::Sx;
|
||||
}
|
||||
|
||||
if (info.timestep != last_timestep) {
|
||||
|
@ -754,11 +754,11 @@ struct SatHelper
|
|||
}
|
||||
|
||||
if(info.width == 1) {
|
||||
fprintf(f, "%c%s\n", bitvals[value.bits[0]], vcdnames[info.description].c_str());
|
||||
fprintf(f, "%c%s\n", bitvals[value[0]], vcdnames[info.description].c_str());
|
||||
} else {
|
||||
fprintf(f, "b");
|
||||
for(int k=info.width-1; k >= 0; k --) //need to flip bit ordering for VCD
|
||||
fprintf(f, "%c", bitvals[value.bits[k]]);
|
||||
fprintf(f, "%c", bitvals[value[k]]);
|
||||
fprintf(f, " %s\n", vcdnames[info.description].c_str());
|
||||
}
|
||||
}
|
||||
|
@ -786,9 +786,9 @@ struct SatHelper
|
|||
{
|
||||
Const value;
|
||||
for (int i = 0; i < info.width; i++) {
|
||||
value.bits.push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
value.bits().push_back(modelValues.at(info.offset+i) ? RTLIL::State::S1 : RTLIL::State::S0);
|
||||
if (enable_undef && modelValues.at(modelExpressions.size()/2 + info.offset + i))
|
||||
value.bits.back() = RTLIL::State::Sx;
|
||||
value.bits().back() = RTLIL::State::Sx;
|
||||
}
|
||||
|
||||
wavedata[info.description].first = info.width;
|
||||
|
|
|
@ -135,7 +135,7 @@ void zinit(State &v)
|
|||
|
||||
void zinit(Const &v)
|
||||
{
|
||||
for (auto &bit : v.bits)
|
||||
for (auto &bit : v.bits())
|
||||
zinit(bit);
|
||||
}
|
||||
|
||||
|
@ -423,11 +423,11 @@ struct SimInstance
|
|||
|
||||
for (auto bit : sigmap(sig))
|
||||
if (bit.wire == nullptr)
|
||||
value.bits.push_back(bit.data);
|
||||
value.bits().push_back(bit.data);
|
||||
else if (state_nets.count(bit))
|
||||
value.bits.push_back(state_nets.at(bit));
|
||||
value.bits().push_back(state_nets.at(bit));
|
||||
else
|
||||
value.bits.push_back(State::Sz);
|
||||
value.bits().push_back(State::Sz);
|
||||
|
||||
if (shared->debug)
|
||||
log("[%s] get %s: %s\n", hiername().c_str(), log_signal(sig), log_signal(value));
|
||||
|
@ -486,9 +486,9 @@ struct SimInstance
|
|||
|
||||
int offset = (addr - state.mem->start_offset) * state.mem->width;
|
||||
for (int i = 0; i < GetSize(data); i++)
|
||||
if (0 <= i+offset && i+offset < state.mem->size * state.mem->width && data.bits[i] != State::Sa)
|
||||
if (state.data.bits[i+offset] != data.bits[i])
|
||||
dirty = true, state.data.bits[i+offset] = data.bits[i];
|
||||
if (0 <= i+offset && i+offset < state.mem->size * state.mem->width && data[i] != State::Sa)
|
||||
if (state.data[i+offset] != data[i])
|
||||
dirty = true, state.data.bits()[i+offset] = data[i];
|
||||
|
||||
if (dirty)
|
||||
dirty_memories.insert(memid);
|
||||
|
@ -499,8 +499,8 @@ struct SimInstance
|
|||
auto &state = mem_database[memid];
|
||||
if (offset >= state.mem->size * state.mem->width)
|
||||
log_error("Addressing out of bounds bit %d/%d of memory %s\n", offset, state.mem->size * state.mem->width, log_id(memid));
|
||||
if (state.data.bits[offset] != data) {
|
||||
state.data.bits[offset] = data;
|
||||
if (state.data[offset] != data) {
|
||||
state.data.bits()[offset] = data;
|
||||
dirty_memories.insert(memid);
|
||||
}
|
||||
}
|
||||
|
@ -717,10 +717,10 @@ struct SimInstance
|
|||
|
||||
for(int i=0;i<ff.past_d.size();i++) {
|
||||
if (current_clr[i] == (ff_data.pol_clr ? State::S1 : State::S0)) {
|
||||
current_q[i] = State::S0;
|
||||
current_q.bits()[i] = State::S0;
|
||||
}
|
||||
else if (current_set[i] == (ff_data.pol_set ? State::S1 : State::S0)) {
|
||||
current_q[i] = State::S1;
|
||||
current_q.bits()[i] = State::S1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -769,8 +769,8 @@ struct SimInstance
|
|||
int index = addr_int - mem.start_offset;
|
||||
if (index >= 0 && index < mem.size)
|
||||
for (int i = 0; i < (mem.width << port.wide_log2); i++)
|
||||
if (enable[i] == State::S1 && mdb.data.bits.at(index*mem.width+i) != data[i]) {
|
||||
mdb.data.bits.at(index*mem.width+i) = data[i];
|
||||
if (enable[i] == State::S1 && mdb.data.at(index*mem.width+i) != data[i]) {
|
||||
mdb.data.bits().at(index*mem.width+i) = data[i];
|
||||
dirty_memories.insert(mem.memid);
|
||||
did_something = true;
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ struct SimInstance
|
|||
if (w->attributes.count(ID::init) == 0)
|
||||
w->attributes[ID::init] = Const(State::Sx, GetSize(w));
|
||||
|
||||
w->attributes[ID::init][sig_q[i].offset] = initval[i];
|
||||
w->attributes[ID::init].bits()[sig_q[i].offset] = initval[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2542,7 +2542,7 @@ struct AIWWriter : public OutputWriter
|
|||
{
|
||||
auto val = it.second ? State::S1 : State::S0;
|
||||
SigBit bit = aiw_inputs.at(it.first);
|
||||
auto v = current[mapping[bit.wire]].bits.at(bit.offset);
|
||||
auto v = current[mapping[bit.wire]].at(bit.offset);
|
||||
if (v == val)
|
||||
skip = true;
|
||||
}
|
||||
|
@ -2552,7 +2552,7 @@ struct AIWWriter : public OutputWriter
|
|||
{
|
||||
if (aiw_inputs.count(i)) {
|
||||
SigBit bit = aiw_inputs.at(i);
|
||||
auto v = current[mapping[bit.wire]].bits.at(bit.offset);
|
||||
auto v = current[mapping[bit.wire]].at(bit.offset);
|
||||
if (v == State::S1)
|
||||
aiwfile << '1';
|
||||
else
|
||||
|
@ -2561,7 +2561,7 @@ struct AIWWriter : public OutputWriter
|
|||
}
|
||||
if (aiw_inits.count(i)) {
|
||||
SigBit bit = aiw_inits.at(i);
|
||||
auto v = current[mapping[bit.wire]].bits.at(bit.offset);
|
||||
auto v = current[mapping[bit.wire]].at(bit.offset);
|
||||
if (v == State::S1)
|
||||
aiwfile << '1';
|
||||
else
|
||||
|
|
|
@ -1217,7 +1217,7 @@ void reintegrate(RTLIL::Module *module, bool dff_mode)
|
|||
auto Qi = initmap(Q);
|
||||
auto it = Qi.wire->attributes.find(ID::init);
|
||||
if (it != Qi.wire->attributes.end())
|
||||
it->second[Qi.offset] = State::Sx;
|
||||
it->second.bits()[Qi.offset] = State::Sx;
|
||||
}
|
||||
else if (cell->type.in(ID($_AND_), ID($_NOT_)))
|
||||
module->remove(cell);
|
||||
|
@ -1528,7 +1528,7 @@ void reintegrate(RTLIL::Module *module, bool dff_mode)
|
|||
int i = 0;
|
||||
while (i < GetSize(mask)) {
|
||||
for (int j = 0; j < (1 << index); j++)
|
||||
std::swap(mask[i+j], mask[i+j+(1 << index)]);
|
||||
std::swap(mask.bits()[i+j], mask.bits()[i+j+(1 << index)]);
|
||||
i += 1 << (index+1);
|
||||
}
|
||||
A[index] = y_bit;
|
||||
|
@ -1543,7 +1543,7 @@ void reintegrate(RTLIL::Module *module, bool dff_mode)
|
|||
// and get cleaned away
|
||||
clone_lut:
|
||||
driver_mask = driver_lut->getParam(ID::LUT);
|
||||
for (auto &b : driver_mask.bits) {
|
||||
for (auto &b : driver_mask.bits()) {
|
||||
if (b == RTLIL::State::S0) b = RTLIL::State::S1;
|
||||
else if (b == RTLIL::State::S1) b = RTLIL::State::S0;
|
||||
}
|
||||
|
|
|
@ -118,13 +118,13 @@ struct DffinitPass : public Pass {
|
|||
for (int i = 0; i < GetSize(sig); i++) {
|
||||
if (initval[i] == State::Sx)
|
||||
continue;
|
||||
while (GetSize(value.bits) <= i)
|
||||
value.bits.push_back(State::S0);
|
||||
if (noreinit && value.bits[i] != State::Sx && value.bits[i] != initval[i])
|
||||
while (GetSize(value) <= i)
|
||||
value.bits().push_back(State::S0);
|
||||
if (noreinit && value[i] != State::Sx && value[i] != initval[i])
|
||||
log_error("Trying to assign a different init value for %s.%s.%s which technically "
|
||||
"have a conflicted init value.\n",
|
||||
log_id(module), log_id(cell), log_id(it.second));
|
||||
value.bits[i] = initval[i];
|
||||
value.bits()[i] = initval[i];
|
||||
}
|
||||
|
||||
if (highlow_mode && GetSize(value) != 0) {
|
||||
|
|
|
@ -869,17 +869,17 @@ struct DffLegalizePass : public Pass {
|
|||
if (ff.has_arst) {
|
||||
if (ff.val_arst[i] == State::Sx) {
|
||||
if (!(supported & (mask << 8)))
|
||||
ff.val_arst[i] = State::S0;
|
||||
ff.val_arst.bits()[i] = State::S0;
|
||||
if (!(supported & (mask << 4)))
|
||||
ff.val_arst[i] = State::S1;
|
||||
ff.val_arst.bits()[i] = State::S1;
|
||||
}
|
||||
}
|
||||
if (ff.has_srst) {
|
||||
if (ff.val_srst[i] == State::Sx) {
|
||||
if (!(supported & (mask << 8)))
|
||||
ff.val_srst[i] = State::S0;
|
||||
ff.val_srst.bits()[i] = State::S0;
|
||||
if (!(supported & (mask << 4)))
|
||||
ff.val_srst[i] = State::S1;
|
||||
ff.val_srst.bits()[i] = State::S1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1399,7 +1399,7 @@ struct FlowmapWorker
|
|||
log_signal(node), log_signal(undef), env.c_str());
|
||||
}
|
||||
|
||||
lut_table[i] = value.as_bool() ? State::S1 : State::S0;
|
||||
lut_table.bits()[i] = value.as_bool() ? State::S1 : State::S0;
|
||||
ce.pop();
|
||||
}
|
||||
|
||||
|
|
|
@ -684,7 +684,7 @@ struct TechmapWorker
|
|||
for (auto &bit : sigmap(conn.second)) {
|
||||
int val = unique_bit_id.at(bit);
|
||||
for (int i = 0; i < bits; i++) {
|
||||
value.bits.push_back((val & 1) != 0 ? State::S1 : State::S0);
|
||||
value.bits().push_back((val & 1) != 0 ? State::S1 : State::S0);
|
||||
val = val >> 1;
|
||||
}
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ struct TechmapPass : public Pass {
|
|||
|
||||
dict<IdString, pool<IdString>> celltypeMap;
|
||||
for (auto module : map->modules()) {
|
||||
if (module->attributes.count(ID::techmap_celltype) && !module->attributes.at(ID::techmap_celltype).bits.empty()) {
|
||||
if (module->attributes.count(ID::techmap_celltype) && !module->attributes.at(ID::techmap_celltype).empty()) {
|
||||
char *p = strdup(module->attributes.at(ID::techmap_celltype).decode_string().c_str());
|
||||
for (char *q = strtok(p, " \t\r\n"); q; q = strtok(nullptr, " \t\r\n")) {
|
||||
std::vector<std::string> queue;
|
||||
|
|
|
@ -73,10 +73,10 @@ struct ZinitPass : public Pass {
|
|||
|
||||
pool<int> bits;
|
||||
for (int i = 0; i < ff.width; i++) {
|
||||
if (ff.val_init.bits[i] == State::S1)
|
||||
if (ff.val_init[i] == State::S1)
|
||||
bits.insert(i);
|
||||
else if (ff.val_init.bits[i] != State::S0 && all_mode)
|
||||
ff.val_init.bits[i] = State::S0;
|
||||
else if (ff.val_init[i] != State::S0 && all_mode)
|
||||
ff.val_init.bits()[i] = State::S0;
|
||||
}
|
||||
ff.flip_bits(bits);
|
||||
ff.emit();
|
||||
|
|
|
@ -544,13 +544,13 @@ static void run_eval_test(RTLIL::Design *design, bool verbose, bool nosat, std::
|
|||
|
||||
RTLIL::Const in_value;
|
||||
for (int i = 0; i < GetSize(gold_wire); i++)
|
||||
in_value.bits.push_back(xorshift32(2) ? State::S1 : State::S0);
|
||||
in_value.bits().push_back(xorshift32(2) ? State::S1 : State::S0);
|
||||
|
||||
if (xorshift32(4) == 0) {
|
||||
int inv_chance = 1 + xorshift32(8);
|
||||
for (int i = 0; i < GetSize(gold_wire); i++)
|
||||
if (xorshift32(inv_chance) == 0)
|
||||
in_value.bits[i] = RTLIL::Sx;
|
||||
in_value.bits()[i] = RTLIL::Sx;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue