HALDLS
block.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <ostream>
4 
5 #include "fisch/vx/word_access/type/omnibus.h"
6 #include "halco/common/geometry.h"
7 #include "halco/hicann-dls/vx/omnibus.h"
8 #include "haldls/cerealization.h"
9 #include "haldls/vx/genpybind.h"
10 #include "haldls/vx/traits.h"
11 #include "hate/visibility.h"
12 #include "hxcomm/vx/target.h"
13 
14 namespace cereal {
15 class access;
16 } // namespace cereal
17 
19 
20 class GENPYBIND(visible) PollingOmnibusBlockConfig
21 {
22 public:
23  typedef halco::hicann_dls::vx::PollingOmnibusBlockConfigOnFPGA coordinate_type;
24  typedef std::true_type is_leaf_node;
25  constexpr static auto unsupported_read_targets GENPYBIND(hidden) = {
26  hxcomm::vx::Target::hardware, hxcomm::vx::Target::simulation};
27 
28  typedef halco::hicann_dls::vx::OmnibusAddress Address GENPYBIND(visible);
29  typedef fisch::vx::word_access_type::Omnibus::Word Value GENPYBIND(visible);
30 
32  PollingOmnibusBlockConfig() SYMBOL_VISIBLE;
33 
34  GENPYBIND(setter_for(address))
35  void set_address(Address value) SYMBOL_VISIBLE;
36  GENPYBIND(getter_for(address))
37  Address get_address() const SYMBOL_VISIBLE;
38 
39  GENPYBIND(setter_for(mask))
40  void set_mask(Value value) SYMBOL_VISIBLE;
41  GENPYBIND(getter_for(mask))
42  Value get_mask() const SYMBOL_VISIBLE;
43 
44  GENPYBIND(setter_for(target))
45  void set_target(Value value) SYMBOL_VISIBLE;
46  GENPYBIND(getter_for(target))
47  Value get_target() const SYMBOL_VISIBLE;
48 
49  bool operator==(PollingOmnibusBlockConfig const& other) const SYMBOL_VISIBLE;
50  bool operator!=(PollingOmnibusBlockConfig const& other) const SYMBOL_VISIBLE;
51 
52  GENPYBIND(stringstream)
53  friend std::ostream& operator<<(std::ostream& os, PollingOmnibusBlockConfig const& config)
54  SYMBOL_VISIBLE;
55 
56  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 3;
57  static std::array<halco::hicann_dls::vx::OmnibusAddress, config_size_in_words> addresses(
58  coordinate_type const& coord) SYMBOL_VISIBLE GENPYBIND(hidden);
59  std::array<fisch::vx::word_access_type::Omnibus, config_size_in_words> encode() const
60  SYMBOL_VISIBLE GENPYBIND(hidden);
61  void decode(std::array<fisch::vx::word_access_type::Omnibus, config_size_in_words> const& data)
62  SYMBOL_VISIBLE GENPYBIND(hidden);
63 
64 private:
65  friend class cereal::access;
66  template <typename Archive>
67  void serialize(Archive& ar, std::uint32_t);
68 
69  Address m_address;
70  Value m_mask;
71  Value m_target;
72 };
73 
74 namespace detail {
75 
76 template <>
78  : public BackendContainerBase<PollingOmnibusBlockConfig, fisch::vx::word_access_type::Omnibus>
79 {};
80 
81 } // namespace detail
82 
84 
85 
89 class GENPYBIND(visible) PollingOmnibusBlock
90 {
91 public:
92  typedef halco::hicann_dls::vx::PollingOmnibusBlockOnFPGA coordinate_type;
93  typedef std::true_type is_leaf_node;
94 
99  PollingOmnibusBlock(bool enable_expects_equality = true) SYMBOL_VISIBLE;
100 
107  GENPYBIND(getter_for(enable_expects_equality))
108  bool get_enable_expects_equality() const SYMBOL_VISIBLE;
109 
116  GENPYBIND(setter_for(enable_expects_equality))
117  void set_enable_expects_equality(bool value) SYMBOL_VISIBLE;
118 
119  GENPYBIND(stringstream)
120  friend std::ostream& operator<<(std::ostream& os, PollingOmnibusBlock const& config)
121  SYMBOL_VISIBLE;
122 
123  bool operator==(PollingOmnibusBlock const& other) const SYMBOL_VISIBLE;
124  bool operator!=(PollingOmnibusBlock const& other) const SYMBOL_VISIBLE;
125 
126  fisch::vx::word_access_type::PollingOmnibusBlock encode() const SYMBOL_VISIBLE
127  GENPYBIND(hidden);
128 
129 private:
130  friend class cereal::access;
131  template <class Archive>
132  void serialize(Archive& ar, std::uint32_t);
133 
134  bool m_enable_expects_equality;
135 };
136 
137 namespace detail {
138 
139 template <>
141  : public BackendContainerBase<
142  PollingOmnibusBlock,
143  fisch::vx::word_access_type::PollingOmnibusBlock>
144 {};
145 
146 } // namespace detail
147 
149 
150 } // namespace haldls::vx
#define EXTERN_INSTANTIATE_CEREAL_SERIALIZE(CLASS_NAME)
Definition: cerealization.h:75
halco::hicann_dls::vx::OmnibusAddress Address
Definition: block.h:28
fisch::vx::word_access_type::Omnibus::Word Value
Definition: block.h:29
halco::hicann_dls::vx::PollingOmnibusBlockConfigOnFPGA coordinate_type
Definition: block.h:23
PollingOmnibusBlockConfig() SYMBOL_VISIBLE
Default constructor.
Container for polling block operation on a Omnibus address.
Definition: block.h:90
halco::hicann_dls::vx::PollingOmnibusBlockOnFPGA coordinate_type
Definition: block.h:92
PollingOmnibusBlock(bool enable_expects_equality=true) SYMBOL_VISIBLE
Resolve block if value is true (*address & mask == target) or if value is false (*address & mask !...
std::true_type is_leaf_node
Definition: block.h:93
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4
Definition: arq.h:13
Backend container trait base.
Definition: traits.h:77