From c66a6a7753dcc7a7ed5c85fbbe7be77d54aaf2c4 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Fri, 15 Dec 2023 18:19:17 -0800 Subject: [PATCH] Unbound for loop support --- src/DesignCompile/UhdmWriter.cpp | 12 +- tests/ConstCapital/ConstCapital.log | 4 +- tests/UnboundForLoop/UnboundForLoop.log | 873 ++++++++++++++++++ tests/UnboundForLoop/UnboundForLoop.sl | 1 + tests/UnboundForLoop/dut.sv | 9 + third_party/UHDM | 2 +- .../tests/CoresSweRVMP/CoresSweRVMP.log | 8 +- third_party/tests/Scr1/Scr1.log | 2 +- third_party/tests/Scr1SvTests/Scr1SvTests.log | 2 +- 9 files changed, 903 insertions(+), 10 deletions(-) create mode 100644 tests/UnboundForLoop/UnboundForLoop.log create mode 100644 tests/UnboundForLoop/UnboundForLoop.sl create mode 100644 tests/UnboundForLoop/dut.sv diff --git a/src/DesignCompile/UhdmWriter.cpp b/src/DesignCompile/UhdmWriter.cpp index 7e70ce6b56..1f9c459c95 100644 --- a/src/DesignCompile/UhdmWriter.cpp +++ b/src/DesignCompile/UhdmWriter.cpp @@ -3163,7 +3163,17 @@ void UhdmWriter::lateBinding(Serializer& s, DesignComponent* mod, scope* m) { const any* parent = ref->VpiParent(); while (parent) { - if (parent->UhdmType() == uhdmfunction) { + if (parent->UhdmType() == uhdmdesign) { + design* d = (design*) parent; + if (auto params = d->Parameters()) { + for (auto decl : *params) { + if (decl->VpiName() == name) { + ref->Actual_group(decl); + break; + } + } + } + } else if (parent->UhdmType() == uhdmfunction) { function* func = (function*)parent; if (parent->VpiName() == name) { if (const any* ret = func->Return()) { diff --git a/tests/ConstCapital/ConstCapital.log b/tests/ConstCapital/ConstCapital.log index b155155191..5e7f0438e6 100644 --- a/tests/ConstCapital/ConstCapital.log +++ b/tests/ConstCapital/ConstCapital.log @@ -208,7 +208,7 @@ design: (work@test) |vpiName:foo |vpiFullName:work@test.foo |vpiActual: - \_logic_net: (work@test.foo), line:10:5, endln:10:8 + \_parameter: (foo), line:1:15, endln:1:18 |vpiOperand: \_constant: , line:10:12, endln:10:20 |vpiParent: @@ -244,7 +244,7 @@ design: (work@test) |vpiName:foo2 |vpiFullName:work@test.foo2 |vpiActual: - \_logic_net: (work@test.foo2), line:15:5, endln:15:9 + \_parameter: (foo2), line:2:15, endln:2:19 |vpiOperand: \_constant: , line:15:13, endln:15:18 |vpiParent: diff --git a/tests/UnboundForLoop/UnboundForLoop.log b/tests/UnboundForLoop/UnboundForLoop.log new file mode 100644 index 0000000000..86ad711f0c --- /dev/null +++ b/tests/UnboundForLoop/UnboundForLoop.log @@ -0,0 +1,873 @@ +[INF:CM0023] Creating log file "${SURELOG_DIR}/build/regression/UnboundForLoop/slpp_all/surelog.log". +AST_DEBUG_BEGIN +LIB: work +FILE: ${SURELOG_DIR}/tests/UnboundForLoop/dut.sv +n<> u<0> t<_INVALID_> f<0> l<0:0> +n<> u<1> t p<134> s<133> l<1:1> el<1:0> +n u<2> t p<41> s<3> l<1:1> el<1:7> +n u<3> t p<41> s<40> l<1:8> el<1:22> +n<> u<4> t p<18> s<17> l<2:3> el<2:8> +n<> u<5> t p<17> s<16> l<2:9> el<2:13> +n<1> u<6> t p<7> l<2:15> el<2:16> +n<> u<7> t p<8> c<6> l<2:15> el<2:16> +n<> u<8> t p<9> c<7> l<2:15> el<2:16> +n<> u<9> t p<14> c<8> s<13> l<2:15> el<2:16> +n<0> u<10> t p<11> l<2:17> el<2:18> +n<> u<11> t p<12> c<10> l<2:17> el<2:18> +n<> u<12> t p<13> c<11> l<2:17> el<2:18> +n<> u<13> t p<14> c<12> l<2:17> el<2:18> +n<> u<14> t p<15> c<9> l<2:15> el<2:18> +n<> u<15> t p<16> c<14> l<2:14> el<2:19> +n<> u<16> t p<17> c<15> l<2:14> el<2:19> +n<> u<17> t p<18> c<5> l<2:9> el<2:19> +n<> u<18> t p<20> c<4> s<19> l<2:3> el<2:19> +n u<19> t p<20> l<2:20> el<2:21> +n<> u<20> t p<40> c<18> s<39> l<2:3> el<2:21> +n<> u<21> t p<37> s<36> l<3:3> el<3:9> +n<> u<22> t p<34> s<23> l<3:10> el<3:13> +n<> u<23> t p<34> s<33> l<3:14> el<3:20> +n<3> u<24> t p<25> l<3:22> el<3:23> +n<> u<25> t p<26> c<24> l<3:22> el<3:23> +n<> u<26> t p<27> c<25> l<3:22> el<3:23> +n<> u<27> t p<32> c<26> s<31> l<3:22> el<3:23> +n<0> u<28> t p<29> l<3:24> el<3:25> +n<> u<29> t p<30> c<28> l<3:24> el<3:25> +n<> u<30> t p<31> c<29> l<3:24> el<3:25> +n<> u<31> t p<32> c<30> l<3:24> el<3:25> +n<> u<32> t p<33> c<27> l<3:22> el<3:25> +n<> u<33> t p<34> c<32> l<3:21> el<3:26> +n<> u<34> t p<35> c<22> l<3:10> el<3:26> +n<> u<35> t p<36> c<34> l<3:10> el<3:26> +n<> u<36> t p<37> c<35> l<3:10> el<3:26> +n<> u<37> t p<39> c<21> s<38> l<3:3> el<3:26> +n u<38> t p<39> l<3:27> el<3:28> +n<> u<39> t p<40> c<37> l<3:3> el<3:28> +n<> u<40> t p<41> c<20> l<1:23> el<3:30> +n<> u<41> t p<131> c<2> s<53> l<1:1> el<3:31> +n<> u<42> t p<43> l<4:3> el<4:10> +n<> u<43> t p<47> c<42> s<46> l<4:3> el<4:10> +n u<44> t p<45> l<4:11> el<4:12> +n<> u<45> t p<46> c<44> l<4:11> el<4:12> +n<> u<46> t p<47> c<45> l<4:11> el<4:12> +n<> u<47> t p<48> c<43> l<4:3> el<4:13> +n<> u<48> t p<49> c<47> l<4:3> el<4:13> +n<> u<49> t p<50> c<48> l<4:3> el<4:13> +n<> u<50> t p<51> c<49> l<4:3> el<4:13> +n<> u<51> t p<52> c<50> l<4:3> el<4:13> +n<> u<52> t p<53> c<51> l<4:3> el<4:13> +n<> u<53> t p<131> c<52> s<129> l<4:3> el<4:13> +n<> u<54> t p<126> s<125> l<5:3> el<5:9> +n<> u<55> t p<56> l<5:10> el<5:13> +n<> u<56> t p<123> c<55> s<122> l<5:10> el<5:13> +n u<57> t p<58> l<6:9> el<6:10> +n<> u<58> t p<61> c<57> s<60> l<6:9> el<6:10> +n<> u<59> t p<60> l<6:10> el<6:10> +n<> u<60> t p<83> c<81> l<6:18> el<6:18> +n<> u<83> t p<95> c<80> s<84> l<6:17> el<6:18> +n<> u<84> t p<95> s<94> l<6:18> el<6:19> +n u<85> t p<86> l<6:19> el<6:20> +n<> u<86> t p<87> c<85> l<6:19> el<6:20> +n<> u<87> t p<88> c<86> l<6:19> el<6:20> +n<> u<88> t p<94> c<87> s<93> l<6:19> el<6:20> +n<1> u<89> t p<90> l<6:21> el<6:22> +n<> u<90> t p<91> c<89> l<6:21> el<6:22> +n<> u<91> t p<92> c<90> l<6:21> el<6:22> +n<> u<92> t p<94> c<91> l<6:21> el<6:22> +n<> u<93> t p<94> s<92> l<6:20> el<6:21> +n<> u<94> t p<95> c<88> l<6:19> el<6:22> +n<> u<95> t p<96> c<83> l<6:17> el<6:22> +n<> u<96> t p<97> c<95> l<6:17> el<6:22> +n<> u<97> t p<114> c<96> s<112> l<6:17> el<6:22> +n u<98> t p<99> l<6:24> el<6:25> +n<> u<99> t p<102> c<98> s<101> l<6:24> el<6:25> +n<> u<100> t p<101> l<6:26> el<6:26> +n<> u<101> t