Skip to content

Commit

Permalink
fixed multiple DANA runs with different configs
Browse files Browse the repository at this point in the history
  • Loading branch information
SJulianS committed Apr 29, 2024
1 parent 5f59f81 commit 8041b76
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ namespace hal
namespace pass_collection
{
std::vector<PassConfiguration> get_passes(const Configuration& config, const std::vector<std::vector<pass_id>>& previous_passes);
void clear();
} // namespace pass_collection

} // namespace processing
} // namespace dataflow
} // namespace processing
} // namespace dataflow
} // namespace hal
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
// MIT License
//
//
// Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
// Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
// Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
// Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand All @@ -37,6 +37,7 @@ namespace hal
namespace processing
{
processing::Result run(const processing::Configuration& config, const std::shared_ptr<Grouping>& initial_grouping);
void clear();
} // namespace processing
} // namespace dataflow
} // namespace dataflow
} // namespace hal
4 changes: 3 additions & 1 deletion plugins/dataflow_analysis/src/api/dataflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace hal

std::shared_ptr<dataflow::Grouping> initial_grouping = nullptr;
auto netlist_abstr = dataflow::pre_processing::run(config, initial_grouping);
std::shared_ptr<dataflow::Grouping> final_grouping;
std::shared_ptr<dataflow::Grouping> final_grouping = nullptr;

u32 iteration = 0;
while (true)
Expand All @@ -73,6 +73,8 @@ namespace hal
iteration++;
}

dataflow::processing::clear();

total_time = (double)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::high_resolution_clock::now() - begin_time).count() / 1000;

log_info("dataflow", "dataflow processing finished in {:3.2f}s", total_time);
Expand Down
11 changes: 8 additions & 3 deletions plugins/dataflow_analysis/src/processing/pass_collection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace hal
std::vector<PassConfiguration> m_all_passes;
std::vector<PassConfiguration> m_intermediate_passes;
std::unordered_map<pass_id, std::unordered_set<pass_id>> m_useless_follow_ups;
bool m_initialized;
bool m_initialized = false;

PassConfiguration group_by_ctrl_sigs;

Expand Down Expand Up @@ -129,7 +129,12 @@ namespace hal
return passes;
}

void clear()
{
m_initialized = false;
}

} // namespace pass_collection
} // namespace processing
} // namespace dataflow
} // namespace processing
} // namespace dataflow
} // namespace hal
12 changes: 9 additions & 3 deletions plugins/dataflow_analysis/src/processing/processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ namespace hal
}
}

std::vector<std::pair<std::shared_ptr<Grouping>, PassConfiguration>> generate_pass_combinations(Context& ctx, const Configuration& config, const std::shared_ptr<Grouping>& initial_grouping)
std::vector<std::pair<std::shared_ptr<Grouping>, PassConfiguration>>
generate_pass_combinations(Context& ctx, const Configuration& config, const std::shared_ptr<Grouping>& initial_grouping)
{
// create current layer of pass combinations;
std::vector<std::pair<std::shared_ptr<Grouping>, PassConfiguration>> output;
Expand Down Expand Up @@ -258,10 +259,15 @@ namespace hal
}
log_info("dataflow", " total: {} unique states", ctx.result.unique_groupings.size());
}

return ctx.result;
}

void clear()
{
pass_collection::clear();
}

} // namespace processing
} // namespace dataflow
} // namespace dataflow
} // namespace hal

0 comments on commit 8041b76

Please sign in to comment.