Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SJulianS committed May 29, 2024
1 parent c72abb4 commit 9941fce
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 9 deletions.
2 changes: 2 additions & 0 deletions plugins/hawkeye/include/hawkeye/candidate_search.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ namespace hal
CHECK_SCC
} components = Components::NONE;

std::vector<std::vector<std::string>> equivalent_types = {};

u32 timeout = 10;
u32 min_register_size = 10;
};
Expand Down
8 changes: 7 additions & 1 deletion plugins/hawkeye/python/python_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ namespace hal
:type: hawkeye.DetectionConfiguration.Control
)");

py::enum_<hawkeye::DetectionConfiguration::Components> py_hawkeye_detection_configuration_components(py_hawkeye_detection_configuration, "Components", R"(TODO)");
py::enum_<hawkeye::DetectionConfiguration::Components> py_hawkeye_detection_configuration_components(py_hawkeye_detection_configuration, "Components", R"(TODO)");

py_hawkeye_detection_configuration_components.value("NONE", hawkeye::DetectionConfiguration::Components::NONE, R"(TODO)")
.value("CHECK_SCC", hawkeye::DetectionConfiguration::Components::CHECK_SCC, R"(TODO)")
Expand All @@ -267,6 +267,12 @@ namespace hal
:type: hawkeye.DetectionConfiguration.Components
)");

py_hawkeye_detection_configuration.def_readwrite("equivalent_types", &hawkeye::DetectionConfiguration::equivalent_types, R"(
TODO
:type: list[list[str]]
)");

py_hawkeye_detection_configuration.def_readwrite("timeout", &hawkeye::DetectionConfiguration::timeout, R"(
TODO
Expand Down
49 changes: 41 additions & 8 deletions plugins/hawkeye/src/candidate_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,42 @@ namespace hal
}
else if (config.control == DetectionConfiguration::Control::CHECK_TYPE)
{
std::map<const GateType*, std::set<const GateType*>> allowed_gate_type_map;
const auto* gl = nl->get_gate_library();
for (const auto& gt_list : config.equivalent_types)
{
std::set<const GateType*> types;
for (const auto& gt_name : gt_list)
{
types.insert(gl->get_gate_type_by_name(gt_name));
}

for (const auto* gt : types)
{
allowed_gate_type_map[gt] = types;
}
}

for (const auto& [src, dsts] : ff_map)
{
for (auto* dst : dsts)
{
if (src->get_type() != dst->get_type())
const auto* src_type = src->get_type();
const auto* dst_type = dst->get_type();
if (src_type != dst_type)
{
continue;
if (const auto src_it = allowed_gate_type_map.find(src_type); src_it != allowed_gate_type_map.end())
{
const auto& allowed_gates = std::get<1>(*src_it);
if (allowed_gates.find(dst_type) == allowed_gates.end())
{
continue;
}
}
else
{
continue;
}
}

filtered_map[src].insert(dst);
Expand All @@ -388,6 +417,8 @@ namespace hal
std::unordered_map<const Gate*, std::map<PinType, const Net*>> control_map;
for (const auto* gate : start_gates)
{
control_map[gate] = std::map<PinType, const Net*>();

for (const auto& ep : gate->get_fan_in_endpoints())
{
if (auto pin_type = ep->get_pin()->get_type(); control_types.find(pin_type) != control_types.end())
Expand Down Expand Up @@ -415,6 +446,8 @@ namespace hal
std::unordered_map<const Gate*, std::set<PinType>> control_map;
for (const auto* gate : start_gates)
{
control_map[gate] = std::set<PinType>();

for (const auto& ep : gate->get_fan_in_endpoints())
{
auto sources = ep->get_net()->get_sources();
Expand All @@ -438,10 +471,10 @@ namespace hal
{
for (auto* dst : dsts)
{
if (src->get_type() != dst->get_type())
{
continue;
}
// if (src->get_type() != dst->get_type())
// {
// continue;
// }

if (control_map.at(src) != control_map.at(dst))
{
Expand Down Expand Up @@ -487,7 +520,7 @@ namespace hal
}

u32 size = igraph_vector_int_size(&out_set);
if (size < config.min_register_size)
if (size <= config.min_register_size)
{
continue;
}
Expand Down Expand Up @@ -527,7 +560,7 @@ namespace hal
}

u32 size = igraph_vector_int_size(&out_set);
if (size < config.min_register_size)
if (size <= config.min_register_size)
{
continue;
}
Expand Down

0 comments on commit 9941fce

Please sign in to comment.