aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2019-04-22 14:18:15 +0000
committerwhitequark <whitequark@whitequark.org>2019-04-22 14:18:15 +0000
commitaeeefc32d8603b138f24824d01b29d28cb0f85cf (patch)
tree111ff3104e02f55f2cd2f30db227853f4e93648e
parentc0f9a74b121dd19e359038b6f6f76be0ffe3cc38 (diff)
downloadyosys-aeeefc32d8603b138f24824d01b29d28cb0f85cf.tar.gz
yosys-aeeefc32d8603b138f24824d01b29d28cb0f85cf.tar.bz2
yosys-aeeefc32d8603b138f24824d01b29d28cb0f85cf.zip
attrmap: extend -remove to allow removing attributes with any value.
Currently, `-remove foo` would only remove an attribute `foo = ""`, which doesn't work on an attribute like `src` that may have any value. Extend `-remove` to handle both cases. `-remove foo=""` has the old behavior, and `-remove foo` will remove the attribute with whatever value it may have, which is still compatible with the old behavior.
-rw-r--r--passes/techmap/attrmap.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/passes/techmap/attrmap.cc b/passes/techmap/attrmap.cc
index 0b5576b06..aa48e1125 100644
--- a/passes/techmap/attrmap.cc
+++ b/passes/techmap/attrmap.cc
@@ -111,9 +111,10 @@ struct AttrmapMap : AttrmapAction {
};
struct AttrmapRemove : AttrmapAction {
+ bool has_value;
string name, value;
bool apply(IdString &id, Const &val) YS_OVERRIDE {
- return !(match_name(name, id) && match_value(value, val));
+ return !(match_name(name, id) && (!has_value || match_value(value, val)));
}
};
@@ -235,6 +236,7 @@ struct AttrmapPass : public Pass {
}
auto action = new AttrmapRemove;
action->name = arg1;
+ action->has_value = (p != string::npos);
action->value = val1;
actions.push_back(std::unique_ptr<AttrmapAction>(action));
continue;