HAL  v4.5.0-257-ge24279b4e
The Hardware Analyzer - a comprehensive reverse engineering and manipulation framework for gate-level netlists.
ram_port_component.cpp
Go to the documentation of this file.
2 
3 #include <memory>
4 
5 namespace hal
6 {
7  RAMPortComponent::RAMPortComponent(std::unique_ptr<GateTypeComponent> component,
8  const std::string& data_group,
9  const std::string& addr_group,
10  const BooleanFunction& clock_bf,
11  const BooleanFunction& enable_bf,
12  bool is_write)
13  : m_component(std::move(component)), m_data_group(data_group), m_addr_group(addr_group), m_clock_bf(clock_bf.clone()), m_enable_bf(enable_bf.clone()), m_is_write(is_write)
14  {
15  }
16 
17  std::unique_ptr<RAMPortComponent> RAMPortComponent::create(std::unique_ptr<GateTypeComponent> component,
18  const std::string& data_group,
19  const std::string& addr_group,
20  const BooleanFunction& clock_bf,
21  const BooleanFunction& enable_bf,
22  bool is_write)
23  {
24  return std::unique_ptr<RAMPortComponent>(new RAMPortComponent(std::move(component), data_group, addr_group, clock_bf.clone(), enable_bf.clone(), is_write));
25  }
26 
27  RAMPortComponent::ComponentType RAMPortComponent::get_type() const
28  {
29  return m_type;
30  }
31 
32  bool RAMPortComponent::is_class_of(const GateTypeComponent* component)
33  {
34  return component->get_type() == m_type;
35  }
36 
37  std::vector<GateTypeComponent*> RAMPortComponent::get_components(const std::function<bool(const GateTypeComponent*)>& filter) const
38  {
39  if (m_component != nullptr)
40  {
41  std::vector<GateTypeComponent*> res = m_component->get_components(filter);
42  if (filter)
43  {
44  if (filter(m_component.get()))
45  {
46  res.push_back(m_component.get());
47  }
48  }
49  else
50  {
51  res.push_back(m_component.get());
52  }
53 
54  return res;
55  }
56 
57  return {};
58  }
59 
60  const std::string& RAMPortComponent::get_data_group() const
61  {
62  return m_data_group;
63  }
64 
65  void RAMPortComponent::set_data_group(const std::string& data_group)
66  {
67  m_data_group = data_group;
68  }
69 
70  const std::string& RAMPortComponent::get_address_group() const
71  {
72  return m_addr_group;
73  }
74 
75  void RAMPortComponent::set_address_group(const std::string& addr_group)
76  {
77  m_addr_group = addr_group;
78  }
79 
80  const BooleanFunction& RAMPortComponent::get_clock_function() const
81  {
82  return m_clock_bf;
83  }
84 
85  void RAMPortComponent::set_clock_function(const BooleanFunction& clock_bf)
86  {
87  m_clock_bf = clock_bf.clone();
88  }
89 
90  const BooleanFunction& RAMPortComponent::get_enable_function() const
91  {
92  return m_enable_bf;
93  }
94 
95  void RAMPortComponent::set_enable_function(const BooleanFunction& enable_bf)
96  {
97  m_enable_bf = enable_bf.clone();
98  }
99 
100  bool RAMPortComponent::is_write_port() const
101  {
102  return m_is_write;
103  }
104 
105  void RAMPortComponent::set_write_port(bool is_write)
106  {
107  m_is_write = is_write;
108  }
109 } // namespace hal
BooleanFunction clone() const
virtual ComponentType get_type() const =0
Definition: defines.h:45