| 4283 | } |
| 4284 | |
| 4285 | void writePrimTerms(ModuleInstance* instance, primitive* prim, |
| 4286 | int32_t vpiGateType, Serializer& s) { |
| 4287 | Netlist* netlist = instance->getNetlist(); |
| 4288 | VectorOfprim_term* terms = s.MakePrim_termVec(); |
| 4289 | prim->Prim_terms(terms); |
| 4290 | if (netlist->ports()) { |
| 4291 | uint32_t index = 0; |
| 4292 | VectorOfport* ports = netlist->ports(); |
| 4293 | for (auto port : *ports) { |
| 4294 | prim_term* term = s.MakePrim_term(); |
| 4295 | terms->push_back(term); |
| 4296 | expr* hconn = (expr*)port->High_conn(); |
| 4297 | hconn->VpiParent(prim); |
| 4298 | term->Expr(hconn); |
| 4299 | term->VpiFile(port->VpiFile()); |
| 4300 | term->VpiLineNo(port->VpiLineNo()); |
| 4301 | term->VpiColumnNo(port->VpiColumnNo()); |
| 4302 | term->VpiEndLineNo(port->VpiEndLineNo()); |
| 4303 | term->VpiEndColumnNo(port->VpiEndColumnNo()); |
| 4304 | term->VpiDirection(port->VpiDirection()); |
| 4305 | term->VpiParent(prim); |
| 4306 | term->VpiTermIndex(index); |
| 4307 | if (vpiGateType == vpiBufPrim || vpiGateType == vpiNotPrim) { |
| 4308 | if (index < ports->size() - 1) { |
| 4309 | term->VpiDirection(vpiOutput); |
| 4310 | } else { |
| 4311 | term->VpiDirection(vpiInput); |
| 4312 | } |
| 4313 | } else if (vpiGateType == vpiTranif1Prim || |
| 4314 | vpiGateType == vpiTranif0Prim || |
| 4315 | vpiGateType == vpiRtranif1Prim || |
| 4316 | vpiGateType == vpiRtranif0Prim || vpiGateType == vpiTranPrim || |
| 4317 | vpiGateType == vpiRtranPrim) { |
| 4318 | if (index < ports->size() - 1) { |
| 4319 | term->VpiDirection(vpiInout); |
| 4320 | } else { |
| 4321 | term->VpiDirection(vpiInput); |
| 4322 | } |
| 4323 | } else { |
| 4324 | if (index == 0) { |
| 4325 | term->VpiDirection(vpiOutput); |
| 4326 | } else { |
| 4327 | term->VpiDirection(vpiInput); |
| 4328 | } |
| 4329 | } |
| 4330 | index++; |
| 4331 | } |
| 4332 | } |
| 4333 | } |
| 4334 | |
| 4335 | void UhdmWriter::writeInstance(ModuleDefinition* mod, ModuleInstance* instance, |
| 4336 | any* m, CompileDesign* compileDesign, |
no test coverage detected