HAL
ram_port_component.cpp
Go to the documentation of this file.
2 
3 namespace hal
4 {
5  RAMPortComponent::RAMPortComponent(std::unique_ptr<GateTypeComponent> component,
6  const std::string& data_group,
7  const std::string& addr_group,
8  const BooleanFunction& clock_bf,
9  const BooleanFunction& enable_bf,
10  bool is_write)
11  : 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)
12  {
13  }
14 
16  {
17  return m_type;
18  }
19 
21  {
22  return component->get_type() == m_type;
23  }
24 
25  std::vector<GateTypeComponent*> RAMPortComponent::get_components(const std::function<bool(const GateTypeComponent*)>& filter) const
26  {
27  if (m_component != nullptr)
28  {
29  std::vector<GateTypeComponent*> res = m_component->get_components(filter);
30  if (filter)
31  {
32  if (filter(m_component.get()))
33  {
34  res.push_back(m_component.get());
35  }
36  }
37  else
38  {
39  res.push_back(m_component.get());
40  }
41 
42  return res;
43  }
44 
45  return {};
46  }
47 
48  const std::string& RAMPortComponent::get_data_group() const
49  {
50  return m_data_group;
51  }
52 
53  void RAMPortComponent::set_data_group(const std::string& data_group)
54  {
55  m_data_group = data_group;
56  }
57 
58  const std::string& RAMPortComponent::get_address_group() const
59  {
60  return m_addr_group;
61  }
62 
63  void RAMPortComponent::set_address_group(const std::string& addr_group)
64  {
65  m_addr_group = addr_group;
66  }
67 
69  {
70  return m_clock_bf;
71  }
72 
74  {
75  m_clock_bf = clock_bf.clone();
76  }
77 
79  {
80  return m_enable_bf;
81  }
82 
84  {
85  m_enable_bf = enable_bf.clone();
86  }
87 
89  {
90  return m_is_write;
91  }
92 
94  {
95  m_is_write = is_write;
96  }
97 } // namespace hal
BooleanFunction clone() const
virtual ComponentType get_type() const =0
void set_enable_function(const BooleanFunction &enable_bf)
void set_address_group(const std::string &addr_group)
void set_write_port(bool is_write)
const std::string & get_data_group() const
ComponentType get_type() const override
std::vector< GateTypeComponent * > get_components(const std::function< bool(const GateTypeComponent *)> &filter=nullptr) const override
const BooleanFunction & get_enable_function() const
static bool is_class_of(const GateTypeComponent *component)
const BooleanFunction & get_clock_function() const
const std::string & get_address_group() const
void set_clock_function(const BooleanFunction &clock_bf)
void set_data_group(const std::string &data_group)
RAMPortComponent(std::unique_ptr< GateTypeComponent > component, const std::string &data_group, const std::string &addr_group, const BooleanFunction &clock_bf, const BooleanFunction &enable_bf, bool is_write)