Skip to content

Commit

Permalink
Fix function information parameters check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansaya committed Feb 6, 2024
1 parent 48bd70d commit aed4d1e
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/HLS/memory/memory_allocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ void memory_allocation::finalize_memory_allocation()
bool has_misaligned_indirect_ref = HLSMgr->Rmem->has_packed_vars();
bool needMemoryMappedRegisters = false;
const auto call_graph_manager = HLSMgr->CGetCallGraphManager();
const auto root_functions = call_graph_manager->GetRootFunctions();
/// looking for the maximum data bus size needed
for(auto fun_id : func_list)
{
Expand All @@ -281,26 +282,16 @@ void memory_allocation::finalize_memory_allocation()
for(const auto function_parameter : function_parameters)
{
const auto pname = behavioral_helper->PrintVariable(function_parameter);
if(func_arch)
if(func_arch && root_functions.find(fun_id) != root_functions.end())
{
auto parm_arch = func_arch->parms.find(pname);
if(parm_arch != func_arch->parms.end())
THROW_ASSERT(func_arch->parms.find(pname) != func_arch->parms.end(),
"Parameter " + pname + " not found in function " + fname);
const auto& parm_attrs = func_arch->parms.at(pname);
const auto& iface_attrs = func_arch->ifaces.at(parm_attrs.at(FunctionArchitecture::parm_bundle));
const auto iface_mode = iface_attrs.at(FunctionArchitecture::iface_mode);
if(iface_mode != "default")
{
const auto& parm_attrs = parm_arch->second;
const auto& iface_attrs = func_arch->ifaces.at(parm_attrs.at(FunctionArchitecture::parm_bundle));
const auto iface_mode = iface_attrs.at(FunctionArchitecture::iface_mode);
if(iface_mode != "default")
{
continue;
}
}
else
{
// NOTE: Struct fileds may be promoted to separate function arguments disrupting the source-IR
// correspondence (which is fine and can be ignored since it will happen only on non-interfaced
// functions)
THROW_ASSERT(func_arch->parms.size() != function_parameters.size(),
"Parameter " + pname + " not found in function " + fname);
continue;
}
}
if(HLSMgr->Rmem->is_parm_decl_copied(function_parameter) &&
Expand Down

0 comments on commit aed4d1e

Please sign in to comment.