HALDLS
padi.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <iosfwd>
4 
5 #include "halco/common/geometry.h"
6 #include "halco/hicann-dls/vx/padi.h"
7 #include "haldls/cerealization.h"
8 #include "haldls/vx/genpybind.h"
9 #include "haldls/vx/synapse.h"
10 #include "haldls/vx/traits.h"
11 #include "hate/visibility.h"
12 
13 #ifndef __ppu__
14 #include "hxcomm/vx/target.h"
15 #endif
16 
17 namespace fisch::vx {
18 class OmnibusChipOverJTAG;
19 class Omnibus;
20 } // namespace fisch::vx
21 
22 namespace haldls {
23 namespace vx GENPYBIND_TAG_HALDLS_VX {
24 
32 class GENPYBIND(visible) PADIEvent
33 {
34 public:
35  typedef halco::hicann_dls::vx::PADIEventOnDLS coordinate_type;
36  typedef std::true_type is_leaf_node;
37 
39 
44  struct GENPYBIND(inline_base("*")) HagenAddress
45  : public halco::common::detail::RantWrapper<HagenAddress, uint_fast16_t, 1, 0>
46  {
47  constexpr explicit HagenAddress(uintmax_t const val = 0) GENPYBIND(implicit_conversion) :
48  rant_t(val)
49  {}
50  };
51 
56  struct GENPYBIND(inline_base("*")) HagenActivation
57  : public halco::common::detail::RantWrapper<HagenActivation, uint_fast16_t, 31, 0>
58  {
59  constexpr explicit HagenActivation(uintmax_t const val = 0) GENPYBIND(implicit_conversion) :
60  rant_t(val)
61  {}
62  };
63 
64  struct GENPYBIND(inline_base("*")) RowSelectAddress
65  : public halco::common::detail::RantWrapper<RowSelectAddress, uint_fast16_t, 31, 0>
66  {
67  constexpr explicit RowSelectAddress(uintmax_t const val = 0)
68  GENPYBIND(implicit_conversion) :
69  rant_t(val)
70  {}
71  };
72 
73  typedef halco::common::typed_array<bool, halco::hicann_dls::vx::PADIBusOnPADIBusBlock>
74  fire_bus_type GENPYBIND(opaque, expose_as(_fire_bus_type));
75 
76  PADIEvent() SYMBOL_VISIBLE;
77 
78  // accessors
79 
81  GENPYBIND(getter_for(fire_bus), return_value_policy(reference_internal))
82  fire_bus_type const& get_fire_bus() const SYMBOL_VISIBLE;
83  GENPYBIND(setter_for(fire_bus))
84  void set_fire_bus(fire_bus_type const& value) SYMBOL_VISIBLE;
85 
87  GENPYBIND(getter_for(event_address))
88  EventAddress get_event_address() const SYMBOL_VISIBLE;
89  GENPYBIND(setter_for(event_address))
90  void set_event_address(EventAddress const value) SYMBOL_VISIBLE;
91 
96  GENPYBIND(getter_for(hagen_address))
97  HagenAddress get_hagen_address() const SYMBOL_VISIBLE;
98  GENPYBIND(setter_for(hagen_address))
99  void set_hagen_address(HagenAddress const value) SYMBOL_VISIBLE;
100 
105  GENPYBIND(getter_for(hagen_activation))
106  HagenActivation get_hagen_activation() const SYMBOL_VISIBLE;
107  GENPYBIND(setter_for(hagen_activation))
108  void set_hagen_activation(HagenActivation const value) SYMBOL_VISIBLE;
109 
116  GENPYBIND(getter_for(row_select_address))
117  RowSelectAddress get_row_select_address() const SYMBOL_VISIBLE;
118  GENPYBIND(setter_for(row_select_address))
119  void set_row_select_address(RowSelectAddress const value) SYMBOL_VISIBLE;
120 
121  bool operator==(PADIEvent const& other) const SYMBOL_VISIBLE;
122  bool operator!=(PADIEvent const& other) const SYMBOL_VISIBLE;
123 
124  static size_t constexpr write_config_size_in_words GENPYBIND(hidden) = 1;
125  static size_t constexpr read_config_size_in_words GENPYBIND(hidden) = 0;
126  template <typename AddressT>
127  static std::array<AddressT, read_config_size_in_words> read_addresses(
128  coordinate_type const& coord) SYMBOL_VISIBLE GENPYBIND(hidden);
129  template <typename AddressT>
130  static std::array<AddressT, write_config_size_in_words> write_addresses(
131  coordinate_type const& coord) SYMBOL_VISIBLE GENPYBIND(hidden);
132  template <typename WordT>
133  std::array<WordT, write_config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
134  template <typename WordT>
135  void decode(std::array<WordT, read_config_size_in_words> const& data) SYMBOL_VISIBLE
136  GENPYBIND(hidden);
137 
138  GENPYBIND(stringstream)
139  friend std::ostream& operator<<(std::ostream& os, PADIEvent const& event) SYMBOL_VISIBLE;
140 
141 private:
142  friend class cereal::access;
143  template <class Archive>
144  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
145 
146  struct PADIEventBitfield;
147 
148  fire_bus_type m_fire_bus;
149  EventAddress m_event_address;
150  RowSelectAddress m_row_select_address;
151 };
152 
153 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(PADIEvent)
154 
161 class GENPYBIND(visible) CommonPADIBusConfig : public DifferentialWriteTrait
162 {
163 public:
164  typedef halco::hicann_dls::vx::CommonPADIBusConfigOnDLS coordinate_type;
165  typedef std::true_type is_leaf_node;
166 #ifndef __ppu__
167  constexpr static auto unsupported_read_targets GENPYBIND(hidden) = {
168  hxcomm::vx::Target::hardware};
169 #endif
170 
171  typedef halco::common::typed_array<bool, halco::hicann_dls::vx::PADIBusOnPADIBusBlock>
172  enable_spl1_type GENPYBIND(opaque(false), expose_as(_enable_spl1_type));
173 
174  typedef halco::common::typed_array<bool, halco::hicann_dls::vx::PADIBusOnPADIBusBlock>
175  enable_extended_timing_type
176  GENPYBIND(opaque(false), expose_as(_enable_extended_timing_type));
177 
178  struct GENPYBIND(inline_base("*")) DacenPulseExtension
179  : public halco::common::detail::RantWrapper<DacenPulseExtension, uint_fast16_t, 15, 0>
180  {
181  constexpr explicit DacenPulseExtension(uintmax_t const val = 0)
182  GENPYBIND(implicit_conversion) :
183  rant_t(val)
184  {}
185  };
186 
187  typedef halco::common::
188  typed_array<DacenPulseExtension, halco::hicann_dls::vx::PADIBusOnPADIBusBlock>
189  dacen_pulse_extension_type GENPYBIND(opaque, expose_as(_dacen_pulse_extension_type));
190 
191  CommonPADIBusConfig() SYMBOL_VISIBLE;
192 
193  // accessors
194 
199  GENPYBIND(getter_for(enable_spl1), return_value_policy(reference_internal))
200  enable_spl1_type const& get_enable_spl1() const SYMBOL_VISIBLE;
201  GENPYBIND(setter_for(enable_spl1))
202  void set_enable_spl1(enable_spl1_type const& value) SYMBOL_VISIBLE;
203 
210  GENPYBIND(getter_for(enable_extended_timing), return_value_policy(reference_internal))
211  enable_extended_timing_type const& get_enable_extended_timing() const SYMBOL_VISIBLE;
212  GENPYBIND(setter_for(enable_extended_timing))
213  void set_enable_extended_timing(enable_extended_timing_type const& value) SYMBOL_VISIBLE;
214 
221  GENPYBIND(getter_for(dacen_pulse_extension), return_value_policy(reference_internal))
222  dacen_pulse_extension_type const& get_dacen_pulse_extension() const SYMBOL_VISIBLE;
223  GENPYBIND(setter_for(dacen_pulse_extension))
224  void set_dacen_pulse_extension(dacen_pulse_extension_type const& value) SYMBOL_VISIBLE;
225 
226  bool operator==(CommonPADIBusConfig const& other) const SYMBOL_VISIBLE;
227  bool operator!=(CommonPADIBusConfig const& other) const SYMBOL_VISIBLE;
228 
229  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 1;
230  template <typename AddressT>
231  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& coord)
232  SYMBOL_VISIBLE GENPYBIND(hidden);
233  template <typename WordT>
234  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
235  template <typename WordT>
236  void decode(std::array<WordT, config_size_in_words> const& data) SYMBOL_VISIBLE
237  GENPYBIND(hidden);
238 
239  GENPYBIND(stringstream)
240  friend std::ostream& operator<<(std::ostream& os, CommonPADIBusConfig const& event)
241  SYMBOL_VISIBLE;
242 
243 private:
244  friend class cereal::access;
245  template <class Archive>
246  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
247 
248  struct CommonPADIBusConfigBitfield;
249 
250  enable_spl1_type m_enable_spl1;
251  enable_extended_timing_type m_enable_extended_timing;
252  dacen_pulse_extension_type m_dacen_pulse_extension;
253 };
254 
255 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(CommonPADIBusConfig)
256 
261 class GENPYBIND(visible) CommonSTPConfig : public DifferentialWriteTrait
262 {
263 public:
264  typedef halco::hicann_dls::vx::CommonSTPConfigOnDLS coordinate_type;
265  typedef std::true_type is_leaf_node;
266 #ifndef __ppu__
267  constexpr static auto unsupported_read_targets GENPYBIND(hidden) = {
268  hxcomm::vx::Target::hardware, hxcomm::vx::Target::simulation};
269 #endif
270 
271  struct GENPYBIND(inline_base("*")) RecoveryClockSpeed
272  : public halco::common::detail::RantWrapper<RecoveryClockSpeed, uint_fast16_t, 15, 0>
273  {
274  constexpr explicit RecoveryClockSpeed(uintmax_t const val = 0)
275  GENPYBIND(implicit_conversion) :
276  rant_t(val)
277  {}
278  };
279 
280  CommonSTPConfig() SYMBOL_VISIBLE;
281 
282  // accessors
283 
285  GENPYBIND(getter_for(enable_recovery_clock))
286  bool get_enable_recovery_clock() const SYMBOL_VISIBLE;
287  GENPYBIND(setter_for(enable_recovery_clock))
288  void set_enable_recovery_clock(bool const value) SYMBOL_VISIBLE;
289 
291  GENPYBIND(getter_for(recovery_clock_speed))
292  RecoveryClockSpeed get_recovery_clock_speed() const SYMBOL_VISIBLE;
293  GENPYBIND(setter_for(recovery_clock_speed))
294  void set_recovery_clock_speed(RecoveryClockSpeed const value) SYMBOL_VISIBLE;
295 
296  bool operator==(CommonSTPConfig const& other) const SYMBOL_VISIBLE;
297  bool operator!=(CommonSTPConfig const& other) const SYMBOL_VISIBLE;
298 
299  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 1;
300  template <typename AddressT>
301  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& coord)
302  SYMBOL_VISIBLE GENPYBIND(hidden);
303  template <typename WordT>
304  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
305  template <typename WordT>
306  void decode(std::array<WordT, config_size_in_words> const& data) SYMBOL_VISIBLE
307  GENPYBIND(hidden);
308 
309  GENPYBIND(stringstream)
310  friend std::ostream& operator<<(std::ostream& os, CommonSTPConfig const& event) SYMBOL_VISIBLE;
311 
312 private:
313  friend class cereal::access;
314  template <class Archive>
315  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
316 
317  struct CommonSTPConfigBitfield;
318 
319  bool m_enable_recovery_clock;
320  RecoveryClockSpeed m_recovery_clock_speed;
321 };
322 
323 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(CommonSTPConfig)
324 
325 namespace detail {
326 
327 template <>
328 struct BackendContainerTrait<PADIEvent>
329  : public BackendContainerBase<
330  PADIEvent,
331  fisch::vx::word_access_type::Omnibus,
332  fisch::vx::word_access_type::OmnibusChipOverJTAG>
333 {};
334 
335 template <>
336 struct BackendContainerTrait<CommonPADIBusConfig>
337  : public BackendContainerBase<
338  CommonPADIBusConfig,
339  fisch::vx::word_access_type::Omnibus,
340  fisch::vx::word_access_type::OmnibusChipOverJTAG>
341 {};
342 
343 template <>
344 struct BackendContainerTrait<CommonSTPConfig>
345  : public BackendContainerBase<
346  CommonSTPConfig,
347  fisch::vx::word_access_type::Omnibus,
348  fisch::vx::word_access_type::OmnibusChipOverJTAG>
349 {};
350 
351 } // namespace detail
352 
353 } // namespace vx
354 } // namespace haldls
A container for the PADI event trigger register.
Definition: padi.h:33
std::true_type is_leaf_node
Definition: padi.h:36
halco::hicann_dls::vx::PADIEventOnDLS coordinate_type
Definition: padi.h:35
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4
Value type of a single synapse label configuration.
Definition: synapse.h:46