diff --git a/.vscode/launch.json b/.vscode/launch.json index 6c1b221017..4ed69db88d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1857,6 +1857,25 @@ "ignoreFailures": true } ] + }, + { + "name": "YosysVerx", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/dbuild/bin/surelog", + "args": ["-f", "YosysVerx.sl"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}/third_party/tests/YosysVerx", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] } ] } \ No newline at end of file diff --git a/src/DesignCompile/UhdmWriter.cpp b/src/DesignCompile/UhdmWriter.cpp index 0c68a5bb19..bf597195c6 100644 --- a/src/DesignCompile/UhdmWriter.cpp +++ b/src/DesignCompile/UhdmWriter.cpp @@ -1932,11 +1932,6 @@ bool UhdmWriter::writeElabGenScope(Serializer& s, ModuleInstance* instance, } } - if (mod) { - lateTypedefBinding(s, mod, m, componentMap); - lateBinding(s, mod, m, componentMap); - } - return true; } @@ -2893,7 +2888,27 @@ void UhdmWriter::lateBinding(UHDM::Serializer& s, DesignComponent* mod, parent = parent->VpiParent(); } if (ref->Actual_group()) continue; - + if (m->UhdmType() == uhdmmodule_inst) { + module_inst* minst = (module_inst*)m; + if (minst->Interfaces()) { + for (auto n : *minst->Interfaces()) { + if (n->VpiName() == name) { + ref->Actual_group(n); + break; + } + } + if (ref->Actual_group()) continue; + } + if (minst->Interface_arrays()) { + for (auto n : *minst->Interface_arrays()) { + if (n->VpiName() == name) { + ref->Actual_group(n); + break; + } + } + if (ref->Actual_group()) continue; + } + } if (m->UhdmType() == uhdmmodule_inst || m->UhdmType() == uhdminterface_inst || m->UhdmType() == uhdmprogram) { instance* inst = (instance*)m; @@ -3200,13 +3215,6 @@ bool UhdmWriter::writeElabModule(Serializer& s, ModuleInstance* instance, } } } - - if (mod) { - lateTypedefBinding(s, mod, m, componentMap); - lateBinding(s, mod, m, componentMap); - lateTypedefBinding(s, mod, m, componentMap); - } - return true; } @@ -3379,12 +3387,6 @@ bool UhdmWriter::writeElabInterface(Serializer& s, ModuleInstance* instance, } } } - - if (mod) { - lateTypedefBinding(s, mod, m, componentMap); - lateBinding(s, mod, m, componentMap); - } - return true; } @@ -3452,7 +3454,6 @@ void UhdmWriter::writeInstance(ModuleDefinition* mod, ModuleInstance* instance, VectorOfprimitive* subPrimitives = nullptr; VectorOfprimitive_array* subPrimitiveArrays = nullptr; VectorOfgen_scope_array* subGenScopeArrays = nullptr; - if (m->UhdmType() == uhdmmodule_inst) { writeElabModule(s, instance, (module_inst*)m, exprBuilder); } else if (m->UhdmType() == uhdmgen_scope) { @@ -3796,6 +3797,15 @@ void UhdmWriter::writeInstance(ModuleDefinition* mod, ModuleInstance* instance, } } } + + if (mod && netlist) { + scope* sc = dynamic_cast(m); + if (sc) { + lateTypedefBinding(s, mod, sc, componentMap); + lateBinding(s, mod, sc, componentMap); + lateTypedefBinding(s, mod, sc, componentMap); + } + } } vpiHandle UhdmWriter::write(PathId uhdmFileId) { diff --git a/tests/InterfInst/InterfInst.log b/tests/InterfInst/InterfInst.log new file mode 100644 index 0000000000..5d9106440d --- /dev/null +++ b/tests/InterfInst/InterfInst.log @@ -0,0 +1,574 @@ +[INF:CM0023] Creating log file ${SURELOG_DIR}/build/regression/InterfInst/slpp_all/surelog.log. + +AST_DEBUG_BEGIN +LIB: work +FILE: ${SURELOG_DIR}/tests/InterfInst/dut.sv +n<> u<0> t<_INVALID_> f<0> l<0:0> +n<> u<1> t p<126> s<125> l<2:1> el<1:2> +n<> u<2> t p<5> s<4> l<2:1> el<2:10> +n u<3> t p<4> l<2:11> el<2:22> +n<> u<4> t p<5> c<3> l<2:11> el<2:22> +n<> u<5> t p<19> c<2> s<17> l<2:1> el<2:23> +n<> u<6> t p<7> l<3:4> el<3:7> +n<> u<7> t p<11> c<6> s<10> l<3:4> el<3:7> +n u<8> t p<9> l<3:8> el<3:18> +n<> u<9> t p<10> c<8> l<3:8> el<3:18> +n<> u<10> t p<11> c<9> l<3:8> el<3:18> +n<> u<11> t p<12> c<7> l<3:4> el<3:19> +n<> u<12> t p<13> c<11> l<3:4> el<3:19> +n<> u<13> t p<14> c<12> l<3:4> el<3:19> +n<> u<14> t p<15> c<13> l<3:4> el<3:19> +n<> u<15> t p<16> c<14> l<3:4> el<3:19> +n<> u<16> t p<17> c<15> l<3:4> el<3:19> +n<> u<17> t p<19> c<16> s<18> l<3:4> el<3:19> +n<> u<18> t p<19> l<4:1> el<4:13> +n<> u<19> t p<20> c<5> l<2:1> el<4:13> +n<> u<20> t p<125> c<19> s<60> l<2:1> el<4:13> +n u<21> t p<39> s<22> l<6:1> el<6:7> +n u<22> t p<39> s<38> l<6:8> el<6:11> +n u<23> t p<24> l<6:12> el<6:23> +n<> u<24> t p<25> c<23> l<6:12> el<6:23> +n<> u<25> t p<26> c<24> l<6:12> el<6:23> +n<> u<26> t p<27> c<25> l<6:12> el<6:23> +n<> u<27> t p<29> c<26> s<28> l<6:12> el<6:23> +n u<28> t p<29> l<6:24> el<6:29> +n<> u<29> t p<38> c<27> s<37> l<6:12> el<6:29> +n<> u<30> t p<35> s<34> l<6:31> el<6:37> +n<> u<31> t p<32> l<6:38> el<6:41> +n<> u<32> t p<33> c<31> l<6:38> el<6:41> +n<> u<33> t p<34> c<32> l<6:38> el<6:41> +n<> u<34> t p<35> c<33> l<6:38> el<6:41> +n<> u<35> t p<37> c<30> s<36> l<6:31> el<6:41> +n u<36> t p<37> l<6:42> el<6:43> +n<> u<37> t p<38> c<35> l<6:31> el<6:43> +n<> u<38> t p<39> c<29> l<6:11> el<6:44> +n<> u<39> t p<59> c<21> s<57> l<6:1> el<6:45> +n u<40> t p<41> l<7:11> el<7:12> +n<> u<41> t p<44> c<40> s<43> l<7:11> el<7:12> +n<> u<42> t p<43> l<7:13> el<7:13> +n<> u<43> t p<44> c<42> l<7:13> el<7:13> +n<> u<44> t p<52> c<41> s<51> l<7:11> el<7:12> +n u<45> t p<49> s<46> l<7:15> el<7:20> +n u<46> t p<49> s<48> l<7:21> el<7:31> +n<> u<47> t p<48> l<7:31> el<7:31> +n<> u<48> t