3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-23 03:27:53 +00:00

Import more std:: stuff into Yosys namespace

This commit is contained in:
Clifford Wolf 2015-10-25 19:30:49 +01:00
parent da923c198e
commit 207736b4ee
39 changed files with 168 additions and 161 deletions

View file

@ -52,7 +52,7 @@ struct EdgetypePass : public Pass {
for (auto module : design->selected_modules())
{
SigMap sigmap(module);
dict<SigBit, pool<std::tuple<IdString, IdString, int>>> bit_sources, bit_sinks;
dict<SigBit, pool<tuple<IdString, IdString, int>>> bit_sources, bit_sinks;
pool<std::pair<IdString, IdString>> multibit_ports;
for (auto cell : module->selected_cells())
@ -67,9 +67,9 @@ struct EdgetypePass : public Pass {
for (int i = 0; i < GetSize(sig); i++) {
if (cell->output(port_name))
bit_sources[sig[i]].insert(std::tuple<IdString, IdString, int>(cell_type, port_name, i));
bit_sources[sig[i]].insert(tuple<IdString, IdString, int>(cell_type, port_name, i));
if (cell->input(port_name))
bit_sinks[sig[i]].insert(std::tuple<IdString, IdString, int>(cell_type, port_name, i));
bit_sinks[sig[i]].insert(tuple<IdString, IdString, int>(cell_type, port_name, i));
}
}

View file

@ -115,7 +115,7 @@ struct PluginPass : public Pass {
log("\n");
int max_alias_len = 1;
for (auto &it : loaded_plugin_aliases)
max_alias_len = std::max(max_alias_len, GetSize(it.first));
max_alias_len = max(max_alias_len, GetSize(it.first));
for (auto &it : loaded_plugin_aliases)
log("Alias: %-*s %s\n", max_alias_len, it.first.c_str(), it.second.c_str());
}

View file

@ -342,8 +342,8 @@ struct QwpWorker
double r = alt_mode ? alt_radius : radius;
if (std::isfinite(v)) {
v = std::min(v, c+r);
v = std::max(v, c-r);
v = min(v, c+r);
v = max(v, c-r);
} else {
v = c;
}
@ -524,15 +524,15 @@ struct QwpWorker
if (rel_pos < 0) {
node.pos = midpos + left_scale*rel_pos;
if (std::isfinite(node.pos)) {
node.pos = std::min(node.pos, midpos);
node.pos = std::max(node.pos, midpos - radius);
node.pos = min(node.pos, midpos);
node.pos = max(node.pos, midpos - radius);
} else
node.pos = midpos - radius/2;
} else {
node.pos = midpos + right_scale*rel_pos;
if (std::isfinite(node.pos)) {
node.pos = std::max(node.pos, midpos);
node.pos = std::min(node.pos, midpos + radius);
node.pos = max(node.pos, midpos);
node.pos = min(node.pos, midpos + radius);
} else
node.pos = midpos + radius/2;
}
@ -666,8 +666,8 @@ struct QwpWorker
double max_value = values.front();
for (auto &v : values) {
min_value = std::min(min_value, v);
max_value = std::max(max_value, v);
min_value = min(min_value, v);
max_value = max(max_value, v);
}
if (fabs(max_value - min_value) < 0.001) {
@ -679,8 +679,8 @@ struct QwpWorker
int max_bucket_val = 0;
for (auto &v : values) {
int idx = std::min(int(GetSize(buckets) * (v - min_value) / (max_value - min_value)), GetSize(buckets)-1);
max_bucket_val = std::max(max_bucket_val, ++buckets.at(idx));
int idx = min(int(GetSize(buckets) * (v - min_value) / (max_value - min_value)), GetSize(buckets)-1);
max_bucket_val = max(max_bucket_val, ++buckets.at(idx));
}
for (int i = 4; i >= 0; i--) {

View file

@ -69,10 +69,10 @@ struct SccWorker
for (auto nextCell : cellToNextCell[cell])
if (cellLabels.count(nextCell) == 0) {
run(nextCell, depth+1, maxDepth);
cellLabels[cell].second = std::min(cellLabels[cell].second, cellLabels[nextCell].second);
cellLabels[cell].second = min(cellLabels[cell].second, cellLabels[nextCell].second);
} else
if (cellsOnStack.count(nextCell) > 0 && (maxDepth < 0 || cellDepth[nextCell] + maxDepth > depth)) {
cellLabels[cell].second = std::min(cellLabels[cell].second, cellLabels[nextCell].second);
cellLabels[cell].second = min(cellLabels[cell].second, cellLabels[nextCell].second);
}
if (cellLabels[cell].first == cellLabels[cell].second)

View file

@ -140,8 +140,8 @@ struct SplitnetsPass : public Pass {
for (auto wire : module->wires())
if (wire->port_id != 0) {
normalized_port_factor = std::max(normalized_port_factor, wire->port_id+1);
normalized_port_factor = std::max(normalized_port_factor, GetSize(wire)+1);
normalized_port_factor = max(normalized_port_factor, wire->port_id+1);
normalized_port_factor = max(normalized_port_factor, GetSize(wire)+1);
}
for (auto wire : module->wires())

View file

@ -110,7 +110,7 @@ struct statdata_t
int width_a = it.second->hasPort("\\A") ? GetSize(it.second->getPort("\\A")) : 0;
int width_b = it.second->hasPort("\\B") ? GetSize(it.second->getPort("\\B")) : 0;
int width_y = it.second->hasPort("\\Y") ? GetSize(it.second->getPort("\\Y")) : 0;
cell_type = stringf("%s_%d", cell_type.c_str(), std::max<int>({width_a, width_b, width_y}));
cell_type = stringf("%s_%d", cell_type.c_str(), max<int>({width_a, width_b, width_y}));
}
else if (cell_type.in("$mux", "$pmux"))
cell_type = stringf("%s_%d", cell_type.c_str(), GetSize(it.second->getPort("\\Y")));