MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / writeModule

Method writeModule

src/DesignCompile/UhdmWriter.cpp:1352–1574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1350}
1351
1352void UhdmWriter::writeModule(ModuleDefinition* mod, module_inst* m,
1353 Serializer& s, ModuleMap& moduleMap,
1354 ModPortMap& modPortMap, ModuleInstance* instance) {
1355 SignalBaseClassMap signalBaseMap;
1356 SignalMap portMap;
1357 SignalMap netMap;
1358
1359 m->VpiEndLabel(mod->getEndLabel());
1360
1361 // Let decls
1362 if (!mod->getLetStmts().empty()) {
1363 VectorOflet_decl* decls = s.MakeLet_declVec();
1364 m->Let_decls(decls);
1365 for (auto stmt : mod->getLetStmts()) {
1366 const_cast<let_decl*>(stmt.second->Decl())->VpiParent(m);
1367 decls->push_back((let_decl*)stmt.second->Decl());
1368 }
1369 }
1370 // Gen stmts
1371 if (mod->getGenStmts()) {
1372 m->Gen_stmts(mod->getGenStmts());
1373 for (auto stmt : *mod->getGenStmts()) {
1374 stmt->VpiParent(m);
1375 }
1376 }
1377 if (!mod->getPropertyDecls().empty()) {
1378 VectorOfproperty_decl* decls = s.MakeProperty_declVec();
1379 m->Property_decls(decls);
1380 for (auto decl : mod->getPropertyDecls()) {
1381 decl->VpiParent(m);
1382 decls->push_back(decl);
1383 }
1384 }
1385 if (!mod->getSequenceDecls().empty()) {
1386 VectorOfsequence_decl* decls = s.MakeSequence_declVec();
1387 m->Sequence_decls(decls);
1388 for (auto decl : mod->getSequenceDecls()) {
1389 decl->VpiParent(m);
1390 decls->push_back(decl);
1391 }
1392 }
1393
1394 // Typepecs
1395 VectorOftypespec* typespecs = s.MakeTypespecVec();
1396 m->Typespecs(typespecs);
1397 writeDataTypes(mod->getDataTypeMap(), m, typespecs, s, true);
1398 writeImportedSymbols(mod, s, typespecs);
1399 // Ports
1400 std::vector<Signal*>& orig_ports = mod->getPorts();
1401 VectorOfport* dest_ports = s.MakePortVec();
1402 VectorOfnet* dest_nets = s.MakeNetVec();
1403 writePorts(orig_ports, m, dest_ports, dest_nets, s, modPortMap, signalBaseMap,
1404 portMap, instance, mod);
1405 m->Ports(dest_ports);
1406 // Nets
1407 std::vector<Signal*> orig_nets = mod->getSignals();
1408 writeNets(mod, orig_nets, m, dest_nets, s, signalBaseMap, netMap, portMap,
1409 instance);

Callers

nothing calls this directly

Calls 15

mapLowConnsFunction · 0.85
DeclMethod · 0.80
getGenStmtsMethod · 0.80
getContAssignsMethod · 0.80
getProcessesMethod · 0.80
getParametersMethod · 0.80
getParam_assignsMethod · 0.80
getTask_funcsMethod · 0.80
InstanceMethod · 0.80
getAssertionsMethod · 0.80
getRefModulesMethod · 0.80
getModuleArraysMethod · 0.80

Tested by

no test coverage detected