From 8f3c92a4803f1067fe908635a0105a1988244b7c Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Sat, 13 Jan 2024 22:37:59 -0800 Subject: [PATCH] Multiple generate blocks --- src/DesignCompile/DesignElaboration.cpp | 49 +- tests/GenerateBlock2/GenerateBlock2.log | 816 ++++++++++++++++++ tests/GenerateBlock2/GenerateBlock2.sl | 1 + tests/GenerateBlock2/dut.sv | 21 + .../AmiqSimpleTestSuite.log | 6 +- .../tests/CoresSweRVMP/CoresSweRVMP.log | 6 +- third_party/tests/YosysDsp/YosysDsp.log | 2 +- third_party/tests/ariane/Ariane.log | 2 +- 8 files changed, 885 insertions(+), 18 deletions(-) create mode 100644 tests/GenerateBlock2/GenerateBlock2.log create mode 100644 tests/GenerateBlock2/GenerateBlock2.sl create mode 100644 tests/GenerateBlock2/dut.sv diff --git a/src/DesignCompile/DesignElaboration.cpp b/src/DesignCompile/DesignElaboration.cpp index 4bed16b55e..d4f79f85eb 100644 --- a/src/DesignCompile/DesignElaboration.cpp +++ b/src/DesignCompile/DesignElaboration.cpp @@ -851,7 +851,6 @@ void DesignElaboration::elaborateInstance_( std::vector subInstances = fC->sl_collect_all(nodeId, types, stopPoints); - bool elaborated = false; for (auto subInstanceId : subInstances) { VObjectType type = fC->Type(subInstanceId); std::vector subSubInstances; @@ -894,10 +893,45 @@ void DesignElaboration::elaborateInstance_( } else { subSubInstances.push_back(subInstanceId); } - elaborated = true; - NetlistElaboration* nelab = new NetlistElaboration(m_compileDesign); - nelab->elaborateInstance(parent); - delete nelab; + } + + NetlistElaboration* nelab = new NetlistElaboration(m_compileDesign); + nelab->elaborateInstance(parent); + delete nelab; + + for (auto subInstanceId : subInstances) { + VObjectType type = fC->Type(subInstanceId); + std::vector subSubInstances; + std::string instName; + if (type == VObjectType::paGenerate_region) { + NodeId Generate_item = fC->Child(subInstanceId); + if (fC->Type(Generate_item) != VObjectType::paGenerate_item) { + continue; + } + NodeId nameId = fC->Child(Generate_item); + if (fC->Name(nameId)) { + instName = fC->SymName(nameId); + subSubInstances.push_back(subInstanceId); + } else { + while (Generate_item) { + std::vector subIds = + fC->sl_collect_all(Generate_item, types, stopPoints); + if (!subIds.empty()) { + for (auto id : subIds) { + subSubInstances.push_back(id); + } + } else { + } + Generate_item = fC->Sibling(Generate_item); + if (Generate_item && + (fC->Type(Generate_item) == VObjectType::paENDGENERATE)) { + break; + } + } + } + } else { + subSubInstances.push_back(subInstanceId); + } for (auto subInstanceId : subSubInstances) { NodeId childId; @@ -1823,11 +1857,6 @@ void DesignElaboration::elaborateInstance_( } } } - if (!elaborated) { - NetlistElaboration* nelab = new NetlistElaboration(m_compileDesign); - nelab->elaborateInstance(parent); - delete nelab; - } } void DesignElaboration::reportElaboration_() { diff --git a/tests/GenerateBlock2/GenerateBlock2.log b/tests/GenerateBlock2/GenerateBlock2.log new file mode 100644 index 0000000000..57ae3b5158 --- /dev/null +++ b/tests/GenerateBlock2/GenerateBlock2.log @@ -0,0 +1,816 @@ +[INF:CM0023] Creating log file "${SURELOG_DIR}/build/regression/GenerateBlock2/slpp_all/surelog.log". +AST_DEBUG_BEGIN +LIB: work +FILE: ${SURELOG_DIR}/tests/GenerateBlock2/dut.sv +n<> u<0> t<_INVALID_> f<0> l<0:0> +n<> u<1> t p<158> s<157> l<2:1> el<1:2> +n u<2> t p<13> s<3> l<2:1> el<2:7> +n u<3> t p<13> s<12> l<2:8> el<2:11> +n<> u<4> t p<9> s<8> l<2:13> el<2:19> +n<> u<5> t p<6> l<2:20> el<2:23> +n<> u<6> t p<7> c<5> l<2:20> el<2:23> +n<> u<7> t p<8> c<6> l<2:20> el<2:23> +n<> u<8> t p<9> c<7> l<2:20> el<2:23> +n<> u<9> t p<11> c<4> s<10> l<2:13> el<2:23> +n u<10> t p<11> l<2:24> el<2:34> +n<> u<11> t p<12> c<9> l<2:13> el<2:34> +n<> u<12> t p<13> c<11> l<2:12> el<2:35> +n<> u<13> t p<15> c<2> s<14> l<2:1> el<2:36> +n<> u<14> t p<15> l<3:1> el<3:10> +n<> u<15> t p<16> c<13> l<2:1> el<3:10> +n<> u<16> t p<157> c<15> s<156> l<2:1> el<3:10> +n u<17> t p<21> s<18> l<5:1> el<5:7> +n u<18> t p<21> s<20> l<5:8> el<5:11> +n<> u<19> t p<20> l<5:13> el<5:13> +n<> u<20> t p<21> c<19> l<5:12> el<5:14> +n<> u<21> t p<155> c<17> s<38> l<5:1> el<5:15> +n<> u<22> t p<32> s<31> l<6:13> el<6:13> +n

u<23> t p<30> s<29> l<6:13> el<6:14> +n<> u<24> t p<25> l<6:17> el<6:21> +n<> u<25> t p<26> c<24> l<6:17> el<6:21> +n<> u<26> t p<27> c<25> l<6:17> el<6:21> +n<> u<27> t p<28> c<26> l<6:17> el<6:21> +n<> u<28> t p<29> c<27> l<6:17> el<6:21> +n<> u<29> t p<30> c<28> l<6:17> el<6:21> +n<> u<30> t p<31> c<23> l<6:13> el<6:21> +n<> u<31> t p<32> c<30> l<6:13> el<6:21> +n<> u<32> t p<33> c<22> l<6:3> el<6:21> +n<> u<33> t p<34> c<32> l<6:3> el<6:22> +n<> u<34> t p<35> c<33> l<6:3> el<6:22> +n<> u<35> t p<36> c<34> l<6:3> el<6:22> +n<> u<36> t p<37> c<35> l<6:3> el<6:22> +n<> u<37> t p<38> c<36> l<6:3> el<6:22> +n<> u<38> t p<155> c<37> s<62> l<6:3> el<6:22> +n

u<39> t p<40> l<8:9> el<8:10> +n<> u<40> t p<41> c<39> l<8:9> el<8:10> +n<> u<41> t p<42> c<40> l<8:9> el<8:10> +n<> u<42> t p<48> c<41> s<47> l<8:9> el<8:10> +n<> u<43> t p<44> l<8:14> el<8:18> +n<> u<44> t p<45> c<43> l<8:14> el<8:18> +n<> u<45> t p<46> c<44> l<8:14> el<8:18> +n<> u<46> t p<48> c<45> l<8:14> el<8:18> +n<> u<47> t p<48> s<46> l<8:11> el<8:13> +n<> u<48> t p<54> c<42> s<52> l<8:9> el<8:18> +n u<49> t p<51> s<50> l<8:28> el<8:31> +n<> u<50> t p<51> l<9:5> el<9:8> +n<> u<51> t p<52> c<49> l<8:20> el<9:8> +n<> u<52> t p<54> c<51> l<8:20> el<9:8> +n<> u<53> t p<54> s<48> l<8:5> el<8:7> +n<> u<54> t p<55> c<53> l<8:5> el<9:8> +n<> u<55> t p<56> c<54> l<8:5> el<9:8> +n<> u<56> t p<57> c<55> l<8:5> el<9:8> +n<> u<57> t p<58> c<56> l<8:5> el<9:8> +n<> u<58> t p<60> c<57> s<59> l<8:5> el<9:8> +n<> u<59> t p<60> l<10:3> el<10:14> +n<> u<60> t p<61> c<58> l<7:3> el<10:14> +n<> u<61> t p<62> c<60> l<7:3> el<10:14> +n<> u<62> t p<155> c<61> s<153> l<7:3> el<10:14> +n u<63> t p<64> l<12:14> el<12:22> +n<> u<64> t p<65> c<63> l<12:14> el<12:22> +n<> u<65> t p<66> c<64> l<12:5> el<12:23> +n<> u<66> t p<67> c<65> l<12:5> el<12:23> +n<> u<67> t p<68> c<66> l<12:5> el<12:23> +n<> u<68> t p<69> c<67> l<12:5> el<12:23> +n<> u<69> t p<151> c<68> s<90> l<12:5> el<12:23> +n<> u<70> t p<85> s<81> l<13:5> el<13:9> +n<2> u<71> t p<72> l<13:12> el<13:13> +n<> u<72> t p<73> c<71> l<13:12> el<13:13> +n<> u<73> t p<74> c<72> l<13:12> el<13:13> +n<> u<74> t p<79> c<73> s<78> l<13:12> el<13:13> +n<0> u<75> t p<76> l<13:14> el<13:15> +n<> u<76> t p<77> c<75> l<13:14> el<13:15> +n<> u<77> t p<78> c<76> l<13:14> el<13:15> +n<> u<78> t p<79> c<77> l<13:14> el<13:15> +n<> u<79> t p<80> c<74> l<13:12> el<13:15> +n<> u<80> t p<81> c<79> l<13:11> el<13:16> +n<> u<81> t p<85> c<80> s<84> l<13:11> el<13:16> +n u<82> t p<83> l<13:18> el<13:28> +n<> u<83> t p<84> c<82> l<13:18> el<13:28> +n<> u<84> t p<85> c<83> l<13:18> el<13:28> +n<> u<85> t p<86> c<70> l<13:5> el<13:29> +n<> u<86> t p<87> c<85> l<13:5> el<13:29> +n<> u<87> t p<88> c<86> l<13:5> el<13:29> +n<> u<88> t p<89> c<87> l<13:5> el<13:29> +n<> u<89> t p<90> c<88> l<13:5> el<13:29> +n<> u<90> t p<151> c<89> s<149> l<13:5> el<13:29> +n u<91> t p<96> s<95> l<14:10> el<14:18> +n<0> u<92> t p<93> l<14:21> el<14:22> +n<> u<93> t p<94> c<92> l<14:21> el<14:22> +n<> u<94> t p<95> c<93> l<14:21> el<14:22> +n<> u<95> t p<96> c<94> l<14:21> el<14:22> +n<> u<96> t p<146> c<91> s<106> l<14:10> el<14:22> +n u<97> t p<98> l<14:24> el<14:32> +n<> u<98> t p<99> c<97> l<14:24> el<14:32> +n<> u<99> t p<100> c<98> l<14:24> el<14:32> +n<> u<100> t p<106> c<99> s<105> l<14:24> el<14:32> +n<2> u<101> t p<102> l<14:35> el<14:36> +n<> u<102> t p<103> c<101> l<14:35> el<14:36> +n<> u<103> t p<104> c<102> l<14:35> el<14:36> +n<> u<104> t p<106> c<103> l<14:35> el<14:36> +n<> u<105> t p<106> s<104> l<14:33> el<14:34> +n<> u<106> t p<146> c<100> s<119> l<14:24> el<14:36> +n u<107> t p<119> s<108> l<14:38> el<14:46> +n<> u<108> t p<119> s<118> l<14:47> el<14:48> +n u<109> t p<110> l<14:49> el<14:57> +n<> u<110> t p<111> c<109> l<14:49> el<14:57> +n<> u<111> t p<112> c<110> l<14:49> el<14:57> +n<> u<112> t p<118> c<111> s<117> l<14:49> el<14:57> +n<1> u<113> t p<114> l<14:60> el<14:61> +n<> u<114> t p<115> c<113> l<14:60> el<14:61> +n<> u<115> t p<116> c<114> l<14:60> el<14:61> +n<> u<116> t p<118> c<115> l<14:60> el<14:61> +n<> u<117> t p<118> s<116> l<14:58> el<14:59> +n<> u<118> t p<119> c<112> l<14:49> el<14:61> +n<> u<119> t p<146> c<107> s<145> l<14:38> el<14:61> +n u<120> t p<144> s<142> l<15:13> el<15:20> +n u<121> t p<140> s<139> l<16:9> el<16:12> +n u<122> t p<123> l<16:13> el<16:18> +n<> u<123> t p<139> c<122> s<138> l<16:13> el<16:18> +n u<124> t p<137> s<135> l<17:12> el<17:22> +n u<125> t p<132> s<131> l<17:23> el<17:33> +n u<126> t p<127> l<17:34> el<17:42> +n<> u<127> t p<128> c<126> l<17:34> el<17:42> +n<> u<128> t p<129> c<127> l<17:34> el<17:42> +n<> u<129> t p<130> c<128> l<17:34> el<17:42> +n<> u<130> t p<131> c<129> l<17:33> el<17:43> +n<> u<131> t