34 #ifdef YOSYS_ENABLE_VERIFIC
36 #pragma clang diagnostic push
37 #pragma clang diagnostic ignored "-Woverloaded-virtual"
39 #include "veri_file.h"
40 #include "vhdl_file.h"
41 #include "VeriModule.h"
42 #include "VhdlUnits.h"
46 #pragma clang diagnostic pop
48 #ifdef VERIFIC_NAMESPACE
49 using namespace Verific ;
52 static void msg_func(msg_type_t msg_type,
const char *message_id, linefile_type linefile,
const char *msg, va_list
args)
54 log(
"VERIFIC-%s [%s] ",
55 msg_type == VERIFIC_NONE ?
"NONE" :
56 msg_type == VERIFIC_ERROR ?
"ERROR" :
57 msg_type == VERIFIC_WARNING ?
"WARNING" :
58 msg_type == VERIFIC_IGNORE ?
"IGNORE" :
59 msg_type == VERIFIC_INFO ?
"INFO" :
60 msg_type == VERIFIC_COMMENT ?
"COMMENT" :
61 msg_type == VERIFIC_PROGRAM_ERROR ?
"PROGRAM_ERROR" :
"UNKNOWN", message_id);
63 log(
"%s:%d: ", LineFile::GetFileName(linefile), LineFile::GetLineNo(linefile));
68 static void import_attributes(std::map<RTLIL::IdString, RTLIL::Const> &attributes, DesignObj *obj)
74 attributes[
"\\src"] =
stringf(
"%s:%d", LineFile::GetFileName(obj->Linefile()), LineFile::GetLineNo(obj->Linefile()));
77 FOREACH_ATTRIBUTE(obj, mi, attr)
78 attributes[RTLIL::
escape_id(attr->Key())] = RTLIL::Const(std::
string(attr->Value()));
81 static RTLIL::SigSpec operatorInput(Instance *inst, std::map<Net*, RTLIL::SigBit> &net_map)
84 for (
int i =
int(inst->InputSize())-1; i >= 0; i--)
85 if (inst->GetInputBit(i))
86 sig.
append(net_map.at(inst->GetInputBit(i)));
92 static RTLIL::SigSpec operatorInput1(Instance *inst, std::map<Net*, RTLIL::SigBit> &net_map)
95 for (
int i =
int(inst->Input1Size())-1; i >= 0; i--)
96 if (inst->GetInput1Bit(i))
97 sig.
append(net_map.at(inst->GetInput1Bit(i)));
103 static RTLIL::SigSpec operatorInput2(Instance *inst, std::map<Net*, RTLIL::SigBit> &net_map)
106 for (
int i =
int(inst->Input2Size())-1; i >= 0; i--)
107 if (inst->GetInput2Bit(i))
108 sig.
append(net_map.at(inst->GetInput2Bit(i)));
114 static RTLIL::SigSpec operatorInport(Instance *inst,
const char *portname, std::map<Net*, RTLIL::SigBit> &net_map)
116 PortBus *portbus = inst->View()->GetPortBus(portname);
119 for (
unsigned i = 0; i < portbus->Size(); i++) {
120 Net *net = inst->GetNet(portbus->ElementAtIndex(i));
124 else if (net->IsPwr())
127 sig.
append(net_map.at(net));
133 Port *port = inst->View()->GetPort(portname);
135 Net *net = inst->GetNet(port);
136 return net_map.at(net);
144 for (
int i =
int(inst->OutputSize())-1; i >= 0; i--)
145 if (inst->GetOutputBit(i)) {
146 sig.
append(net_map.at(inst->GetOutputBit(i)));
149 if (dummy_wire ==
NULL)
158 static bool import_netlist_instance_gates(
RTLIL::Module *module, std::map<Net*, RTLIL::SigBit> &net_map, Instance *inst)
160 if (inst->Type() == PRIM_AND) {
161 module->
addAndGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
165 if (inst->Type() == PRIM_NAND) {
167 module->
addAndGate(
NEW_ID, net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), tmp);
172 if (inst->Type() == PRIM_OR) {
173 module->
addOrGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
177 if (inst->Type() == PRIM_NOR) {
179 module->
addOrGate(
NEW_ID, net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), tmp);
184 if (inst->Type() == PRIM_XOR) {
185 module->
addXorGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
189 if (inst->Type() == PRIM_INV) {
194 if (inst->Type() == PRIM_MUX) {
195 module->
addMuxGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetControl()), net_map.at(inst->GetOutput()));
199 if (inst->Type() == PRIM_TRI) {
204 if (inst->Type() == PRIM_FADD)
206 RTLIL::SigSpec a = net_map.at(inst->GetInput1()), b = net_map.at(inst->GetInput2()), c = net_map.at(inst->GetCin());
220 if (inst->Type() == PRIM_DFFRS)
222 if (inst->GetSet()->IsGnd() && inst->GetReset()->IsGnd())
223 module->
addDffGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetClock()), net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()));
224 else if (inst->GetSet()->IsGnd())
226 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()),
false);
227 else if (inst->GetReset()->IsGnd())
229 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()),
true);
231 module->
addDffsrGate(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetClock()), net_map.at(inst->GetSet()), net_map.at(inst->GetReset()),
232 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()));
239 static bool import_netlist_instance_cells(
RTLIL::Module *module, std::map<Net*, RTLIL::SigBit> &net_map, Instance *inst)
241 if (inst->Type() == PRIM_AND) {
242 module->
addAnd(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
246 if (inst->Type() == PRIM_NAND) {
248 module->
addAnd(
NEW_ID, net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), tmp);
253 if (inst->Type() == PRIM_OR) {
254 module->
addOr(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
258 if (inst->Type() == PRIM_NOR) {
260 module->
addOr(
NEW_ID, net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), tmp);
265 if (inst->Type() == PRIM_XOR) {
266 module->
addXor(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
270 if (inst->Type() == PRIM_XNOR) {
271 module->
addXnor(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetOutput()));
275 if (inst->Type() == PRIM_INV) {
276 module->
addNot(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()));
280 if (inst->Type() == PRIM_MUX) {
281 module->
addMux(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), net_map.at(inst->GetControl()), net_map.at(inst->GetOutput()));
285 if (inst->Type() == PRIM_TRI) {
290 if (inst->Type() == PRIM_FADD)
295 y.
append(net_map.at(inst->GetCout()));
296 module->
addAdd(
NEW_ID, net_map.at(inst->GetInput1()), net_map.at(inst->GetInput2()), a_plus_b);
301 if (inst->Type() == PRIM_DFFRS)
303 if (inst->GetSet()->IsGnd() && inst->GetReset()->IsGnd())
304 module->
addDff(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetClock()), net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()));
305 else if (inst->GetSet()->IsGnd())
307 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()),
RTLIL::State::S0);
308 else if (inst->GetReset()->IsGnd())
310 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()),
RTLIL::State::S1);
312 module->
addDffsr(
RTLIL::escape_id(inst->Name()), net_map.at(inst->GetClock()), net_map.at(inst->GetSet()), net_map.at(inst->GetReset()),
313 net_map.at(inst->GetInput()), net_map.at(inst->GetOutput()));
317 #define IN operatorInput(inst, net_map)
318 #define IN1 operatorInput1(inst, net_map)
319 #define IN2 operatorInput2(inst, net_map)
320 #define OUT operatorOutput(inst, net_map, module)
321 #define SIGNED inst->View()->IsSigned()
323 if (inst->Type() == OPER_ADDER) {
325 if (inst->GetCout() !=
NULL)
326 out.
append(net_map.at(inst->GetCout()));
327 if (inst->GetCin()->IsGnd()) {
337 if (inst->Type() == OPER_MULTIPLIER) {
342 if (inst->Type() == OPER_DIVIDER) {
347 if (inst->Type() == OPER_MODULO) {
352 if (inst->Type() == OPER_REMAINDER) {
357 if (inst->Type() == OPER_SHIFT_LEFT) {
362 if (inst->Type() == OPER_SHIFT_RIGHT) {
363 Net *net_cin = inst->GetCin();
364 Net *net_a_msb = inst->GetInput1Bit(0);
365 if (net_cin->IsGnd())
367 else if (net_cin == net_a_msb)
370 log_error(
"Can't import Verific OPER_SHIFT_RIGHT instance %s: carry_in is neither 0 nor msb of left input\n", inst->Name());
374 if (inst->Type() == OPER_REDUCE_AND) {
379 if (inst->Type() == OPER_REDUCE_OR) {
384 if (inst->Type() == OPER_REDUCE_XOR) {
389 if (inst->Type() == OPER_REDUCE_XNOR) {
394 if (inst->Type() == OPER_LESSTHAN) {
395 Net *net_cin = inst->GetCin();
396 if (net_cin->IsGnd())
398 else if (net_cin->IsPwr())
401 log_error(
"Can't import Verific OPER_LESSTHAN instance %s: carry_in is neither 0 nor 1\n", inst->Name());
405 if (inst->Type() == OPER_WIDE_AND) {
410 if (inst->Type() == OPER_WIDE_OR) {
415 if (inst->Type() == OPER_WIDE_XOR) {
420 if (inst->Type() == OPER_WIDE_XNOR) {
425 if (inst->Type() == OPER_WIDE_BUF) {
430 if (inst->Type() == OPER_WIDE_INV) {
435 if (inst->Type() == OPER_MINUS) {
440 if (inst->Type() == OPER_UMINUS) {
445 if (inst->Type() == OPER_EQUAL) {
450 if (inst->Type() == OPER_NEQUAL) {
455 if (inst->Type() == OPER_WIDE_MUX) {
460 if (inst->Type() == OPER_WIDE_TRI) {
465 if (inst->Type() == OPER_WIDE_DFFRS) {
467 RTLIL::SigSpec sig_reset = operatorInport(inst,
"reset", net_map);
484 static void import_netlist(
RTLIL::Design *design, Netlist *nl, std::set<Netlist*> &nl_todo,
bool mode_gates)
486 std::string module_name = nl->IsOperator() ? std::string(
"$verific$") + nl->Owner()->Name() :
RTLIL::escape_id(nl->Owner()->Name());
488 if (design->
has(module_name)) {
489 if (!nl->IsOperator())
490 log_cmd_error(
"Re-definition of module `%s'.\n", nl->Owner()->Name());
495 module->
name = module_name;
500 std::map<Net*, RTLIL::SigBit> net_map;
511 FOREACH_PORT_OF_NETLIST(nl, mi, port)
519 import_attributes(wire->attributes, port);
521 wire->
port_id = nl->IndexOf(port) + 1;
523 if (port->GetDir() == DIR_INOUT || port->GetDir() == DIR_IN)
525 if (port->GetDir() == DIR_INOUT || port->GetDir() == DIR_OUT)
528 if (port->GetNet()) {
529 net = port->GetNet();
530 if (net_map.count(net) == 0)
533 module->
connect(net_map.at(net), wire);
535 module->
connect(wire, net_map.at(net));
539 FOREACH_PORTBUS_OF_NETLIST(nl, mi, portbus)
544 wire->
start_offset = std::min(portbus->LeftIndex(), portbus->RightIndex());
545 import_attributes(wire->attributes, portbus);
547 if (portbus->GetDir() == DIR_INOUT || portbus->GetDir() == DIR_IN)
549 if (portbus->GetDir() == DIR_INOUT || portbus->GetDir() == DIR_OUT)
552 for (
int i = portbus->LeftIndex();; i += portbus->IsUp() ? +1 : -1) {
553 if (portbus->ElementAtIndex(i) && portbus->ElementAtIndex(i)->GetNet()) {
554 net = portbus->ElementAtIndex(i)->GetNet();
556 if (net_map.count(net) == 0)
559 module->
connect(net_map.at(net), bit);
561 module->
connect(bit, net_map.at(net));
563 if (i == portbus->RightIndex())
570 FOREACH_NET_OF_NETLIST(nl, mi, net)
579 int number_of_bits = net->Size();
580 int bits_in_word = number_of_bits;
581 FOREACH_PORTREF_OF_NET(net, si, pr) {
582 if (pr->GetInst()->Type() == OPER_READ_PORT) {
583 bits_in_word = std::min<int>(bits_in_word, pr->GetInst()->OutputSize());
586 if (pr->GetInst()->Type() == OPER_WRITE_PORT || pr->GetInst()->Type() == OPER_CLOCKED_WRITE_PORT) {
587 bits_in_word = std::min<int>(bits_in_word, pr->GetInst()->Input2Size());
590 log_error(
"Verific RamNet %s is connected to unsupported instance type %s (%s).\n",
591 net->Name(), pr->GetInst()->View()->Owner()->Name(), pr->GetInst()->Name());
594 memory->
width = bits_in_word;
595 memory->
size = number_of_bits / bits_in_word;
599 if (net_map.count(net)) {
611 import_attributes(wire->attributes, net);
616 FOREACH_NETBUS_OF_NETLIST(nl, mi, netbus)
618 bool found_new_net =
false;
619 for (
int i = netbus->LeftIndex();; i += netbus->IsUp() ? +1 : -1) {
620 net = netbus->ElementAtIndex(i);
621 if (net_map.count(net) == 0)
622 found_new_net =
true;
623 if (i == netbus->RightIndex())
633 wire->
start_offset = std::min(netbus->LeftIndex(), netbus->RightIndex());
634 import_attributes(wire->attributes, netbus);
636 for (
int i = netbus->LeftIndex();; i += netbus->IsUp() ? +1 : -1) {
637 if (netbus->ElementAtIndex(i)) {
638 net = netbus->ElementAtIndex(i);
640 if (net_map.count(net) == 0)
643 module->
connect(bit, net_map.at(net));
645 if (i == netbus->RightIndex())
655 FOREACH_INSTANCE_OF_NETLIST(nl, mi, inst)
659 if (inst->Type() == PRIM_PWR) {
664 if (inst->Type() == PRIM_GND) {
669 if (inst->Type() == PRIM_X) {
674 if (inst->Type() == PRIM_Z) {
679 if (inst->Type() == OPER_READ_PORT)
682 if (memory->
width !=
int(inst->OutputSize()))
683 log_error(
"Import of asymetric memories from Verific is not supported yet: %s %s\n", inst->Name(), inst->GetInput()->Name());
701 if (inst->Type() == OPER_WRITE_PORT || inst->Type() == OPER_CLOCKED_WRITE_PORT)
704 if (memory->
width !=
int(inst->Input2Size()))
705 log_error(
"Import of asymetric memories from Verific is not supported yet: %s %s\n", inst->Name(), inst->GetInput()->Name());
722 if (inst->Type() == OPER_CLOCKED_WRITE_PORT) {
724 cell->
setPort(
"\\CLK", net_map.at(inst->GetClock()));
730 if (import_netlist_instance_cells(module, net_map, inst))
732 if (inst->IsOperator())
733 log_warning(
"Unsupported Verific operator: %s (fallback to gate level implementation provided by verific)\n", inst->View()->Owner()->Name());
735 if (import_netlist_instance_gates(module, net_map, inst))
739 if (inst->IsPrimitive())
740 log_error(
"Unsupported Verific primitive: %s\n", inst->View()->Owner()->Name());
742 nl_todo.insert(inst->View());
745 std::string(
"$verific$") + inst->View()->Owner()->Name() :
RTLIL::escape_id(inst->View()->Owner()->Name()));
747 FOREACH_PORTREF_OF_INST(inst, mi2, pr) {
749 const char *port_name = pr->GetPort()->Name();
751 if (pr->GetPort()->Bus()) {
752 port_name = pr->GetPort()->Bus()->Name();
753 port_offset = pr->GetPort()->Bus()->IndexOf(pr->GetPort()) -
754 std::min(pr->GetPort()->Bus()->LeftIndex(), pr->GetPort()->Bus()->RightIndex());
759 while (
GetSize(conn) <= port_offset) {
760 if (pr->GetPort()->GetDir() != DIR_IN)
764 conn.
replace(port_offset, net_map.at(pr->GetNet()));
780 log(
" verific {-vlog95|-vlog2k|-sv2005|-sv2009|-sv} <verilog-file>..\n");
782 log(
"Load the specified Verilog/SystemVerilog files into Verific.\n");
785 log(
" verific {-vhdl87|-vhdl93|-vhdl2k|-vhdl2008} <vhdl-file>..\n");
787 log(
"Load the specified VHDL files into Verific.\n");
790 log(
" verific -import [-gates] {-all | <top-module>..}\n");
792 log(
"Elaborate the design for the sepcified top modules, import to Yosys and\n");
793 log(
"reset the internal state of Verific. A gate-level netlist is created\n");
794 log(
"when called with -gates.\n");
796 log(
"Visit http://verific.com/ for more information on Verific.\n");
799 #ifdef YOSYS_ENABLE_VERIFIC
800 virtual void execute(std::vector<std::string> args,
RTLIL::Design *design)
802 log_header(
"Executing VERIFIC (loading Verilog and VHDL designs using Verific).\n");
804 Message::SetConsoleOutput(0);
805 Message::RegisterCallBackMsg(msg_func);
807 if (args.size() > 1 && args[1] ==
"-vlog95") {
808 for (
size_t argidx = 2; argidx < args.size(); argidx++)
809 if (!veri_file::Analyze(args[argidx].c_str(), veri_file::VERILOG_95))
810 log_cmd_error(
"Reading `%s' in VERILOG_95 mode failed.\n", args[argidx].c_str());
814 if (args.size() > 1 && args[1] ==
"-vlog2k") {
815 for (
size_t argidx = 2; argidx < args.size(); argidx++)
816 if (!veri_file::Analyze(args[argidx].c_str(), veri_file::VERILOG_2K))
817 log_cmd_error(
"Reading `%s' in VERILOG_2K mode failed.\n", args[argidx].c_str());
821 if (args.size() > 1 && args[1] ==
"-sv2005") {
822 for (
size_t argidx = 2; argidx < args.size(); argidx++)
823 if (!veri_file::Analyze(args[argidx].c_str(), veri_file::SYSTEM_VERILOG_2005))
824 log_cmd_error(
"Reading `%s' in SYSTEM_VERILOG_2005 mode failed.\n", args[argidx].c_str());
828 if (args.size() > 1 && args[1] ==
"-sv2009") {
829 for (
size_t argidx = 2; argidx < args.size(); argidx++)
830 if (!veri_file::Analyze(args[argidx].c_str(), veri_file::SYSTEM_VERILOG_2009))
831 log_cmd_error(
"Reading `%s' in SYSTEM_VERILOG_2009 mode failed.\n", args[argidx].c_str());
835 if (args.size() > 1 && args[1] ==
"-sv") {
836 for (
size_t argidx = 2; argidx < args.size(); argidx++)
837 if (!veri_file::Analyze(args[argidx].c_str(), veri_file::SYSTEM_VERILOG))
838 log_cmd_error(
"Reading `%s' in SYSTEM_VERILOG mode failed.\n", args[argidx].c_str());
842 if (args.size() > 1 && args[1] ==
"-vhdl87") {
843 vhdl_file::SetDefaultLibraryPath((
proc_share_dirname() +
"verific/vhdl_vdbs_1993").c_str());
844 for (
size_t argidx = 2; argidx < args.size(); argidx++)
845 if (!vhdl_file::Analyze(args[argidx].c_str(),
"work", vhdl_file::VHDL_87))
846 log_cmd_error(
"Reading `%s' in VHDL_87 mode failed.\n", args[argidx].c_str());
850 if (args.size() > 1 && args[1] ==
"-vhdl93") {
851 vhdl_file::SetDefaultLibraryPath((
proc_share_dirname() +
"verific/vhdl_vdbs_1993").c_str());
852 for (
size_t argidx = 2; argidx < args.size(); argidx++)
853 if (!vhdl_file::Analyze(args[argidx].c_str(),
"work", vhdl_file::VHDL_93))
854 log_cmd_error(
"Reading `%s' in VHDL_93 mode failed.\n", args[argidx].c_str());
858 if (args.size() > 1 && args[1] ==
"-vhdl2k") {
859 vhdl_file::SetDefaultLibraryPath((
proc_share_dirname() +
"verific/vhdl_vdbs_1993").c_str());
860 for (
size_t argidx = 2; argidx < args.size(); argidx++)
861 if (!vhdl_file::Analyze(args[argidx].c_str(),
"work", vhdl_file::VHDL_2K))
862 log_cmd_error(
"Reading `%s' in VHDL_2K mode failed.\n", args[argidx].c_str());
866 if (args.size() > 1 && args[1] ==
"-vhdl2008") {
867 vhdl_file::SetDefaultLibraryPath((
proc_share_dirname() +
"verific/vhdl_vdbs_2008").c_str());
868 for (
size_t argidx = 2; argidx < args.size(); argidx++)
869 if (!vhdl_file::Analyze(args[argidx].c_str(),
"work", vhdl_file::VHDL_2008))
870 log_cmd_error(
"Reading `%s' in VHDL_2008 mode failed.\n", args[argidx].c_str());
874 if (args.size() > 1 && args[1] ==
"-import")
876 std::set<Netlist*> nl_todo, nl_done;
877 bool mode_all =
false, mode_gates =
false;
880 for (; argidx < args.size(); argidx++) {
881 if (args[argidx] ==
"-all") {
885 if (args[argidx] ==
"-gates") {
892 if (argidx > args.size() && args[argidx].substr(0, 1) ==
"-")
893 cmd_error(args, argidx,
"unknown option");
897 if (argidx != args.size())
898 log_cmd_error(
"Got -all and an explicit list of top modules.\n");
902 FOREACH_VERILOG_MODULE(m1, mod)
903 args.push_back(mod->Name());
906 VhdlPrimaryUnit *primunit;
907 FOREACH_VHDL_LIBRARY(m1, lib)
908 FOREACH_VHDL_PRIMARY_UNIT(lib, m2, primunit) {
909 if (primunit->IsPackageDecl())
911 args.push_back(primunit->Name());
915 if (argidx == args.size())
918 for (; argidx < args.size(); argidx++) {
919 if (veri_file::GetModule(args[argidx].c_str())) {
920 if (!veri_file::Elaborate(args[argidx].c_str()))
921 log_cmd_error(
"Elaboration of top module `%s' failed.\n", args[argidx].c_str());
922 nl_todo.insert(Netlist::PresentDesign());
924 if (!vhdl_file::Elaborate(args[argidx].c_str()))
925 log_cmd_error(
"Elaboration of top module `%s' failed.\n", args[argidx].c_str());
926 nl_todo.insert(Netlist::PresentDesign());
930 while (!nl_todo.empty()) {
931 Netlist *nl = *nl_todo.begin();
932 if (nl_done.count(nl) == 0)
933 import_netlist(design, nl, nl_todo, mode_gates);
946 log_cmd_error(
"This version of Yosys is built without Verific support.\n");
RTLIL::Cell * addReduceXor(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
virtual void execute(std::vector< std::string >, RTLIL::Design *)
RTLIL::Cell * addXorGate(RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y)
RTLIL::Cell * addDiv(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
std::string stringf(const char *fmt,...)
void log_warning(const char *format,...)
RTLIL::Cell * addCell(RTLIL::IdString name, RTLIL::IdString type)
void add(RTLIL::Module *module)
void log_header(const char *format,...)
RTLIL::Cell * addDffGate(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity=true)
#define YOSYS_NAMESPACE_END
RTLIL::Cell * addNot(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addSshr(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
std::map< RTLIL::IdString, RTLIL::Memory * > memories
RTLIL::Cell * addEq(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
void log_error(const char *format,...)
std::map< RTLIL::IdString, RTLIL::Const > parameters
RTLIL::Cell * addAdd(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addReduceOr(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addNotGate(RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_y)
static std::string escape_id(std::string str)
RTLIL::Cell * addNeg(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addAnd(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addShr(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addXnor(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addMod(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addReduceAnd(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addDff(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity=true)
void connect(const RTLIL::SigSig &conn)
RTLIL::Cell * addAndGate(RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y)
RTLIL::Cell * addOrGate(RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y)
RTLIL_ATTRIBUTE_MEMBERS bool hasPort(RTLIL::IdString portname) const
const RTLIL::SigSpec & getPort(RTLIL::IdString portname) const
RTLIL::Cell * addShl(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
int GetSize(RTLIL::Wire *wire)
RTLIL::Cell * addLt(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
#define log_assert(_assert_expr_)
bool is_fully_const() const
RTLIL::Wire * addWire(RTLIL::IdString name, int width=1)
RTLIL::Cell * addMul(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addAdff(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_arst, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, RTLIL::Const arst_value, bool clk_polarity=true, bool arst_polarity=true)
RTLIL::Cell * addSub(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
static const char * id2cstr(const RTLIL::IdString &str)
void log_cmd_error(const char *format,...)
RTLIL::Cell * addDffsr(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity=true, bool set_polarity=true, bool clr_polarity=true)
bool has(RTLIL::IdString id) const
#define USING_YOSYS_NAMESPACE
RTLIL::Cell * addXor(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
virtual size_t count_id(RTLIL::IdString id)
void replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec &with)
#define YOSYS_NAMESPACE_BEGIN
RTLIL::IdString uniquify(RTLIL::IdString name)
RTLIL::Cell * addDffsrGate(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity=true, bool set_polarity=true, bool clr_polarity=true)
RTLIL::Cell * addMux(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s, RTLIL::SigSpec sig_y)
void log(const char *format,...)
RTLIL::Cell * addMuxGate(RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_s, RTLIL::SigBit sig_y)
RTLIL::SigSpec repeat(int num) const
RTLIL::Cell * addReduceXnor(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
std::string proc_share_dirname()
void append(const RTLIL::SigSpec &signal)
RTLIL::Cell * addNe(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addOr(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addPos(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y, bool is_signed=false)
RTLIL::Cell * addLe(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool is_signed=false)
void logv(const char *format, va_list ap)
RTLIL::Cell * addAdffGate(RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_arst, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool arst_value=false, bool clk_polarity=true, bool arst_polarity=true)