10 namespace bitorder_propagation
13 : m_module(
module), m_pin_group(pin_group), m_order(
std::move(order))
15 std::sort(m_order.begin(), m_order.end(), [](
const auto& lhs,
const auto& rhs) { return lhs.second < rhs.second; });
35 const auto it = std::find_if(m_order.begin(), m_order.end(), [
net](
const auto& entry) { return entry.first == net; });
36 return (it == m_order.end()) ? std::nullopt : std::optional<u32>(it->second);
41 const auto it = std::find_if(m_order.begin(), m_order.end(), [
index](
const auto& entry) { return entry.second == index; });
42 return (it == m_order.end()) ? nullptr : it->first;
47 return m_order.size();
53 for (
u32 i = 0; i < m_order.size(); i++)
55 if (m_order.at(i).second != i)
65 return (m_module == other.m_module) && (m_pin_group == other.m_pin_group) && (m_order == other.m_order);
70 return !(*
this == other);
80 if (lhs_module != rhs_module)
82 return lhs_module < rhs_module;
90 for (
auto& bit_order : bit_orders)
92 add(std::move(bit_order));
98 const auto it = std::lower_bound(m_bit_orders.begin(), m_bit_orders.end(), bit_order, [](
const BitOrder& lhs,
const BitOrder& rhs) {
99 return precedes(lhs, rhs.get_module(), rhs.get_pin_group());
102 if ((it != m_bit_orders.end()) && (it->get_module() == bit_order.
get_module()) && (it->get_pin_group() == bit_order.
get_pin_group()))
104 *it = std::move(bit_order);
108 m_bit_orders.insert(it, std::move(bit_order));
118 const auto it = std::lower_bound(m_bit_orders.begin(), m_bit_orders.end(), 0, [
module, pin_group](
const BitOrder& lhs,
int) {
119 return precedes(lhs, module, pin_group);
122 if ((it != m_bit_orders.end()) && (it->get_module() ==
module) && (it->get_pin_group() == pin_group))
131 return get(
module, pin_group) !=
nullptr;
136 return m_bit_orders.size();
141 return m_bit_orders.empty();
146 return m_bit_orders.begin();
151 return m_bit_orders.end();
This file contains the bit order of a module pin group and the collection of bit orders that a propag...
Module * get_module() const
bool operator==(const BitOrder &other) const
bool operator!=(const BitOrder &other) const
Net * get_net_at(u32 index) const
std::optional< u32 > get_index(const Net *net) const
bool is_continuous() const
const std::vector< std::pair< Net *, u32 > > & get_order() const
PinGroup< ModulePin > * get_pin_group() const
BitOrder(Module *module, PinGroup< ModulePin > *pin_group, std::vector< std::pair< Net *, u32 >> order)
bool contains(const Module *module, const PinGroup< ModulePin > *pin_group) const
const BitOrder * get(const Module *module, const PinGroup< ModulePin > *pin_group) const
std::vector< BitOrder >::const_iterator begin() const
std::vector< BitOrder >::const_iterator end() const
const std::vector< BitOrder > & get_bit_orders() const
void add(BitOrder bit_order)
const Module * module(const Gate *g, const NodeBoxes &boxes)