mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-05 19:00:26 +00:00
const: represent string constants as string, assert not accessed as bits
This commit is contained in:
parent
960bca0196
commit
498e0498c5
81 changed files with 764 additions and 690 deletions
|
@ -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].bits().begin(), patterns[idx].bits().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).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].bits().at(0) == State::S1, false);
|
||||
|
||||
for (auto cell : module->cells()) {
|
||||
if (cell->type.in(ID($not), ID($_NOT_))) {
|
||||
|
@ -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].bits().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.bits()[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.bits()[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;
|
||||
|
|
|
@ -134,7 +134,7 @@ void zinit(State &v)
|
|||
|
||||
void zinit(Const &v)
|
||||
{
|
||||
for (auto &bit : v.bits)
|
||||
for (auto &bit : v.bits())
|
||||
zinit(bit);
|
||||
}
|
||||
|
||||
|
@ -422,11 +422,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));
|
||||
|
@ -485,9 +485,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.bits()[i] != State::Sa)
|
||||
if (state.data.bits()[i+offset] != data.bits()[i])
|
||||
dirty = true, state.data.bits()[i+offset] = data.bits()[i];
|
||||
|
||||
if (dirty)
|
||||
dirty_memories.insert(memid);
|
||||
|
@ -498,8 +498,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.bits()[offset] != data) {
|
||||
state.data.bits()[offset] = data;
|
||||
dirty_memories.insert(memid);
|
||||
}
|
||||
}
|
||||
|
@ -768,8 +768,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.bits().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;
|
||||
}
|
||||
|
@ -2525,7 +2525,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]].bits().at(bit.offset);
|
||||
if (v == val)
|
||||
skip = true;
|
||||
}
|
||||
|
@ -2535,7 +2535,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]].bits().at(bit.offset);
|
||||
if (v == State::S1)
|
||||
aiwfile << '1';
|
||||
else
|
||||
|
@ -2544,7 +2544,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]].bits().at(bit.offset);
|
||||
if (v == State::S1)
|
||||
aiwfile << '1';
|
||||
else
|
||||
|
|
|
@ -185,25 +185,35 @@ struct SyntProperties : public Pass {
|
|||
log("\n");
|
||||
log(" synthprop [options]\n");
|
||||
log("\n");
|
||||
log("This creates synthesizable properties for the selected module.\n");
|
||||
log("This creates synthesizable properties for selected module.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" -name <portname>\n");
|
||||
log(" name of the output port for assertions (default: assertions).\n");
|
||||
log("\n");
|
||||
log("Name output port for assertions (default: assertions).\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" -map <filename>\n");
|
||||
log(" write the port mapping for synthesizable properties into the given file.\n");
|
||||
log("\n");
|
||||
log("Write port mapping for synthesizable properties.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" -or_outputs\n");
|
||||
log(" Or all outputs together to create a single output that goes high when\n");
|
||||
log(" any property is violated, instead of generating individual output bits.\n");
|
||||
log("\n");
|
||||
log("Or all outputs together to create a single output that goes high when any\n");
|
||||
log("property is violated, instead of generating individual output bits.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" -reset <portname>\n");
|
||||
log(" name of the top-level reset input. Latch a high state on the generated\n");
|
||||
log(" outputs until an asynchronous top-level reset input is activated.\n");
|
||||
log("\n");
|
||||
log("Name of top-level reset input. Latch a high state on the generated outputs\n");
|
||||
log("until an asynchronous top-level reset input is activated.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
log(" -resetn <portname>\n");
|
||||
log(" like above but with inverse polarity\n");
|
||||
log("\n");
|
||||
log("Name of top-level reset input (inverse polarity). Latch a high state on the\n");
|
||||
log("generated outputs until an asynchronous top-level reset input is activated.\n");
|
||||
log("\n");
|
||||
log("\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue