mirror of https://github.com/YosysHQ/yosys.git
merged clifford changes + removed regex
This commit is contained in:
parent
210dda286f
commit
2e44b1b73a
|
@ -95,29 +95,56 @@ struct BtorDumper
|
||||||
inter_wire_map[it->first].clear();
|
inter_wire_map[it->first].clear();
|
||||||
}
|
}
|
||||||
curr_cell.clear();
|
curr_cell.clear();
|
||||||
cell_type_translation = {
|
//assert
|
||||||
//assert
|
cell_type_translation["$assert"] = "root";
|
||||||
{"$assert","root"},
|
//unary
|
||||||
//unary
|
cell_type_translation["$not"] = "not";
|
||||||
{"$not","not"},{"$neg","neg"},{"$reduce_and","redand"},
|
cell_type_translation["$neg"] = "neg";
|
||||||
{"$reduce_or","redor"},{"$reduce_xor","redxor"},{"$reduce_bool","redor"},
|
cell_type_translation["$reduce_and"] = "redand";
|
||||||
//binary
|
cell_type_translation["$reduce_or"] = "redor";
|
||||||
{"$and","and"},{"$or","or"},{"$xor","xor"},{"$xnor","xnor"},
|
cell_type_translation["$reduce_xor"] = "redxor";
|
||||||
{"$shr","srl"},{"$shl","sll"},{"$sshr","sra"},{"$sshl","sll"},
|
cell_type_translation["$reduce_bool"] = "redor";
|
||||||
{"$lt","ult"},{"$le","ulte"},{"$gt","ugt"},{"$ge","ugte"},
|
//binary
|
||||||
{"$eq","eq"},{"$eqx","eq"},{"$ne","ne"},{"$nex","ne"},
|
cell_type_translation["$and"] = "and";
|
||||||
{"$add","add"},{"$sub","sub"},{"$mul","mul"},{"$mod","urem"},{"$div","udiv"},
|
cell_type_translation["$or"] = "or";
|
||||||
//mux
|
cell_type_translation["$xor"] = "xor";
|
||||||
{"$mux","cond"},
|
cell_type_translation["$xnor"] = "xnor";
|
||||||
//reg
|
cell_type_translation["$shr"] = "srl";
|
||||||
{"$dff","next"},{"$adff","next"},{"$dffsr","next"}
|
cell_type_translation["$shl"] = "sll";
|
||||||
//memories
|
cell_type_translation["$sshr"] = "sra";
|
||||||
};
|
cell_type_translation["$sshl"] = "sll";
|
||||||
s_cell_type_translation = {
|
cell_type_translation["$lt"] = "ult";
|
||||||
//binary
|
cell_type_translation["$le"] = "ulte";
|
||||||
{"$modx","srem"},{"$mody","smod"},{"$div","sdiv"},
|
cell_type_translation["$gt"] = "ugt";
|
||||||
{"$lt","slt"},{"$le","slte"},{"$gt","sgt"},{"$ge","sgte"}
|
cell_type_translation["$ge"] = "ugte";
|
||||||
};
|
cell_type_translation["$eq"] = "eq";
|
||||||
|
cell_type_translation["$eqx"] = "eq";
|
||||||
|
cell_type_translation["$ne"] = "ne";
|
||||||
|
cell_type_translation["$nex"] = "ne";
|
||||||
|
cell_type_translation["$add"] = "add";
|
||||||
|
cell_type_translation["$sub"] = "sub";
|
||||||
|
cell_type_translation["$mul"] = "mul";
|
||||||
|
cell_type_translation["$mod"] = "urem";
|
||||||
|
cell_type_translation["$div"] = "udiv";
|
||||||
|
//mux
|
||||||
|
cell_type_translation["$mux"] = "cond";
|
||||||
|
//reg
|
||||||
|
cell_type_translation["$dff"] = "next";
|
||||||
|
cell_type_translation["$adff"] = "next";
|
||||||
|
cell_type_translation["$dffsr"] = "next";
|
||||||
|
//memories
|
||||||
|
//nothing here
|
||||||
|
|
||||||
|
//signed cell type translation
|
||||||
|
//binary
|
||||||
|
s_cell_type_translation["$modx"] = "srem";
|
||||||
|
s_cell_type_translation["$mody"] = "smod";
|
||||||
|
s_cell_type_translation["$div"] = "sdiv";
|
||||||
|
s_cell_type_translation["$lt"] = "slt";
|
||||||
|
s_cell_type_translation["$le"] = "slte";
|
||||||
|
s_cell_type_translation["$gt"] = "sgt";
|
||||||
|
s_cell_type_translation["$ge"] = "sgte";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> cstr_buf;
|
std::vector<std::string> cstr_buf;
|
||||||
|
@ -823,15 +850,14 @@ struct BtorDumper
|
||||||
log("writing input\n");
|
log("writing input\n");
|
||||||
std::map<int, RTLIL::Wire*> inputs, outputs;
|
std::map<int, RTLIL::Wire*> inputs, outputs;
|
||||||
std::vector<RTLIL::Wire*> safety;
|
std::vector<RTLIL::Wire*> safety;
|
||||||
std::regex safety_regex("(safety)(.*)");
|
|
||||||
|
|
||||||
for (auto &wire_it : module->wires) {
|
for (auto &wire_it : module->wires) {
|
||||||
RTLIL::Wire *wire = wire_it.second;
|
RTLIL::Wire *wire = wire_it.second;
|
||||||
if (wire->port_input)
|
if (wire->port_input)
|
||||||
inputs[wire->port_id] = wire;
|
inputs[wire->port_id] = wire;
|
||||||
if (wire->port_output) {
|
if (wire->port_output) {
|
||||||
outputs[wire->port_id] = wire;
|
outputs[wire->port_id] = wire;
|
||||||
if (std::regex_match(cstr(wire->name), safety_regex ) )
|
if (wire->name.find("safety") != std::string::npos )
|
||||||
safety.push_back(wire);
|
safety.push_back(wire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue