verific - detect missing memory to prevent crash.
authorMiodrag Milanovic <mmicko@gmail.com>
Wed, 10 Jun 2020 09:27:44 +0000 (11:27 +0200)
committerMiodrag Milanovic <mmicko@gmail.com>
Wed, 10 Jun 2020 09:27:44 +0000 (11:27 +0200)
frontends/verific/verific.cc

index cb0368fd57ad05f6342efc75e1524a0ffbbdba1a..65e71876a6567aa02393e3fb9774da0c31830ddb 100644 (file)
@@ -1262,7 +1262,10 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::se
 
                if (inst->Type() == OPER_READ_PORT)
                {
-                       RTLIL::Memory *memory = module->memories.at(RTLIL::escape_id(inst->GetInput()->Name()));
+                       RTLIL::Memory *memory = module->memories.at(RTLIL::escape_id(inst->GetInput()->Name()), nullptr);
+                       if (!memory)
+                               log_error("Memory net '%s' missing, possibly no driver, use verific -flatten.\n", inst->GetInput()->Name());
+
                        int numchunks = int(inst->OutputSize()) / memory->width;
                        int chunksbits = ceil_log2(numchunks);
 
@@ -1289,7 +1292,9 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::se
 
                if (inst->Type() == OPER_WRITE_PORT || inst->Type() == OPER_CLOCKED_WRITE_PORT)
                {
-                       RTLIL::Memory *memory = module->memories.at(RTLIL::escape_id(inst->GetOutput()->Name()));
+                       RTLIL::Memory *memory = module->memories.at(RTLIL::escape_id(inst->GetOutput()->Name()), nullptr);
+                       if (!memory)
+                               log_error("Memory net '%s' missing, possibly no driver, use verific -flatten.\n", inst->GetInput()->Name());
                        int numchunks = int(inst->Input2Size()) / memory->width;
                        int chunksbits = ceil_log2(numchunks);