mirror of https://github.com/YosysHQ/yosys.git
smtr: Refactor write back into _eval and _initial
Easier for comparisons, and the structure still works. (I don't remember why I moved away from it in the first place.)
This commit is contained in:
parent
d73c58fad1
commit
fa2d45a922
|
@ -210,14 +210,8 @@ struct SmtrModule {
|
||||||
state_struct.insert(state->name, state->sort);
|
state_struct.insert(state->name, state->sort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void write(std::ostream &out)
|
void write_eval(SExprWriter &w)
|
||||||
{
|
{
|
||||||
SExprWriter w(out);
|
|
||||||
|
|
||||||
input_struct.write_definition(w);
|
|
||||||
output_struct.write_definition(w);
|
|
||||||
state_struct.write_definition(w);
|
|
||||||
|
|
||||||
w.push();
|
w.push();
|
||||||
w.open(list("define", list(name, "inputs", "state")));
|
w.open(list("define", list(name, "inputs", "state")));
|
||||||
auto inlined = [&](Functional::Node n) {
|
auto inlined = [&](Functional::Node n) {
|
||||||
|
@ -240,7 +234,10 @@ struct SmtrModule {
|
||||||
output_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.output(name).value()); });
|
output_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.output(name).value()); });
|
||||||
state_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.state(name).next_value()); });
|
state_struct.write_value(w, [&](IdString name) { return node_to_sexpr(ir.state(name).next_value()); });
|
||||||
w.pop();
|
w.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_initial(SExprWriter &w)
|
||||||
|
{
|
||||||
w.push();
|
w.push();
|
||||||
auto initial = name + "_initial";
|
auto initial = name + "_initial";
|
||||||
w.open(list("define", initial));
|
w.open(list("define", initial));
|
||||||
|
@ -259,6 +256,18 @@ struct SmtrModule {
|
||||||
}
|
}
|
||||||
w.pop();
|
w.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write(std::ostream &out)
|
||||||
|
{
|
||||||
|
SExprWriter w(out);
|
||||||
|
|
||||||
|
input_struct.write_definition(w);
|
||||||
|
output_struct.write_definition(w);
|
||||||
|
state_struct.write_definition(w);
|
||||||
|
|
||||||
|
write_eval(w);
|
||||||
|
write_initial(w);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FunctionalSmtrBackend : public Backend {
|
struct FunctionalSmtrBackend : public Backend {
|
||||||
|
|
Loading…
Reference in New Issue