mirror of https://github.com/YosysHQ/yosys.git
cellhelp.py: Cells can have tags
Tags are added to the list of properties when exporting to `cells.json`.
This commit is contained in:
parent
9ce6952131
commit
b1025dbaa6
|
@ -766,6 +766,7 @@ struct SimHelper {
|
||||||
string code;
|
string code;
|
||||||
string group;
|
string group;
|
||||||
string ver;
|
string ver;
|
||||||
|
string tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool is_code_getter(string name) {
|
static bool is_code_getter(string name) {
|
||||||
|
@ -1013,12 +1014,20 @@ struct HelpPass : public Pass {
|
||||||
for (auto &output : ct.outputs)
|
for (auto &output : ct.outputs)
|
||||||
outputs.push_back(output.str());
|
outputs.push_back(output.str());
|
||||||
json.name("outputs"); json.value(outputs);
|
json.name("outputs"); json.value(outputs);
|
||||||
dict<string, bool> prop_dict = {
|
vector<string> properties;
|
||||||
{"is_evaluable", ct.is_evaluable},
|
// CellType properties
|
||||||
{"is_combinatorial", ct.is_combinatorial},
|
if (ct.is_evaluable) properties.push_back("is_evaluable");
|
||||||
{"is_synthesizable", ct.is_synthesizable},
|
if (ct.is_combinatorial) properties.push_back("is_combinatorial");
|
||||||
};
|
if (ct.is_synthesizable) properties.push_back("is_synthesizable");
|
||||||
json.name("properties"); json.value(prop_dict);
|
// SimHelper properties
|
||||||
|
size_t last = 0; size_t next = 0;
|
||||||
|
while ((next = ch.tags.find(", ", last)) != string::npos) {
|
||||||
|
properties.push_back(ch.tags.substr(last, next-last));
|
||||||
|
last = next + 2;
|
||||||
|
}
|
||||||
|
auto final_tag = ch.tags.substr(last);
|
||||||
|
if (final_tag.size()) properties.push_back(final_tag);
|
||||||
|
json.name("properties"); json.value(properties);
|
||||||
json.end_object();
|
json.end_object();
|
||||||
}
|
}
|
||||||
json.end_object();
|
json.end_object();
|
||||||
|
|
|
@ -14,13 +14,16 @@ class SimHelper:
|
||||||
code: list[str]
|
code: list[str]
|
||||||
group: str = ""
|
group: str = ""
|
||||||
ver: str = "1"
|
ver: str = "1"
|
||||||
|
tags: list[str]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.desc = []
|
self.desc = []
|
||||||
|
self.tags = []
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
printed_fields = [
|
printed_fields = [
|
||||||
"name", "title", "ports", "source", "desc", "code", "group", "ver",
|
"name", "title", "ports", "source", "desc", "code", "group", "ver",
|
||||||
|
"tags",
|
||||||
]
|
]
|
||||||
# generate C++ struct
|
# generate C++ struct
|
||||||
val = f"cell_help[{json.dumps(self.name)}] = "
|
val = f"cell_help[{json.dumps(self.name)}] = "
|
||||||
|
|
Loading…
Reference in New Issue