[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge pull request #1057 from alainmarcel/alainmarcel-patch-1
Browse files Browse the repository at this point in the history
hier path simplification
  • Loading branch information
alaindargelas committed Dec 9, 2023
2 parents 7b8baa3 + 1a4f62c commit 9055aae
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- mode:cmake -*-
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(UHDM VERSION 1.81)
project(UHDM VERSION 1.82)

# Detect build type, fallback to release and throw a warning if use didn't
# specify any
Expand Down
30 changes: 30 additions & 0 deletions templates/clone_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,28 @@ cont_assign* cont_assign::DeepClone(BaseClass* parent,
expr* lhs = nullptr;
if (auto obj = Lhs()) {
lhs = obj->DeepClone(clone, context);
if (lhs->UhdmType() == uhdmhier_path) {
hier_path* path = (hier_path*) lhs;
any* last = path->Path_elems()->back();
if (ref_obj* ro = any_cast<ref_obj*>(last)) {
if (net* n = any_cast<net*>(ro->Actual_group())) {
lhs = n;
}
}
}
clone->Lhs(lhs);
}
if (auto obj = Rhs()) {
expr* rhs = obj->DeepClone(clone, context);
if (rhs->UhdmType() == uhdmhier_path) {
hier_path* path = (hier_path*) rhs;
any* last = path->Path_elems()->back();
if (ref_obj* ro = any_cast<ref_obj*>(last)) {
if (ro->Actual_group()->UhdmType() == uhdmconstant) {
rhs = (expr*) ro->Actual_group();
}
}
}
clone->Rhs(rhs);
if (ref_obj* ro = any_cast<ref_obj*>(lhs)) {
if (struct_var* stv = ro->Actual_group<struct_var>()) {
Expand Down Expand Up @@ -1349,6 +1367,18 @@ hier_path* hier_path::DeepClone(BaseClass* parent,
}
}
}
if (!found && mod->Param_assigns()) {
for (auto pa : *mod->Param_assigns()) {
if (pa->Lhs()->VpiName() == name ||
pa->Lhs()->VpiName() == nameIndexed) {
if (ref_obj* cro = any_cast<ref_obj*>(current)) {
cro->Actual_group(pa->Rhs());
}
previous = pa;
found = true;
}
}
}
break;
}
case UHDM_OBJECT_TYPE::uhdmclass_var: {
Expand Down

0 comments on commit 9055aae

Please sign in to comment.