HAL  v4.5.0-251-g305763a14
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
latch_component.cpp
Go to the documentation of this file.
2 
3 #include <memory>
4 
5 namespace hal
6 {
7  LatchComponent::LatchComponent(std::unique_ptr<GateTypeComponent> component) : m_component(std::move(component))
8  {
9  }
10 
11  std::unique_ptr<LatchComponent> LatchComponent::create(std::unique_ptr<GateTypeComponent> component)
12  {
13  return std::unique_ptr<LatchComponent>(new LatchComponent(std::move(component)));
14  }
15 
16  LatchComponent::ComponentType LatchComponent::get_type() const
17  {
18  return m_type;
19  }
20 
21  bool LatchComponent::is_class_of(const GateTypeComponent* component)
22  {
23  return component->get_type() == m_type;
24  }
25 
26  std::vector<GateTypeComponent*> LatchComponent::get_components(const std::function<bool(const GateTypeComponent*)>& filter) const
27  {
28  if (m_component != nullptr)
29  {
30  std::vector<GateTypeComponent*> res = m_component->get_components(filter);
31  if (filter)
32  {
33  if (filter(m_component.get()))
34  {
35  res.push_back(m_component.get());
36  }
37  }
38  else
39  {
40  res.push_back(m_component.get());
41  }
42 
43  return res;
44  }
45 
46  return {};
47  }
48 
49  BooleanFunction LatchComponent::get_data_in_function() const
50  {
51  return m_data_in_bf.clone();
52  }
53 
54  void LatchComponent::set_data_in_function(const BooleanFunction& data_in_bf)
55  {
56  m_data_in_bf = data_in_bf.clone();
57  }
58 
59  BooleanFunction LatchComponent::get_enable_function() const
60  {
61  return m_enable_bf.clone();
62  }
63 
64  void LatchComponent::set_enable_function(const BooleanFunction& enable_bf)
65  {
66  m_enable_bf = enable_bf.clone();
67  }
68 
69  BooleanFunction LatchComponent::get_async_reset_function() const
70  {
71  return m_async_reset_bf.clone();
72  }
73 
74  void LatchComponent::set_async_reset_function(const BooleanFunction& async_reset_bf)
75  {
76  m_async_reset_bf = async_reset_bf.clone();
77  }
78 
79  BooleanFunction LatchComponent::get_async_set_function() const
80  {
81  return m_async_set_bf.clone();
82  }
83 
84  void LatchComponent::set_async_set_function(const BooleanFunction& async_set_bf)
85  {
86  m_async_set_bf = async_set_bf.clone();
87  }
88 
89  const std::pair<AsyncSetResetBehavior, AsyncSetResetBehavior>& LatchComponent::get_async_set_reset_behavior() const
90  {
91  return m_async_set_reset_behavior;
92  }
93 
94  void LatchComponent::set_async_set_reset_behavior(AsyncSetResetBehavior behav_state, AsyncSetResetBehavior behav_neg_state)
95  {
96  m_async_set_reset_behavior = std::make_pair(behav_state, behav_neg_state);
97  }
98 
99 } // namespace hal
BooleanFunction clone() const
virtual ComponentType get_type() const =0
Definition: defines.h:45