HALDLS
capmem.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <cstdint>
4 #include <ostream>
5 #include <sstream>
6 #include <variant>
7 
8 #include "halco/common/geometry.h"
9 #include "halco/common/iter_all.h"
10 #include "halco/common/typed_heap_array.h"
11 #include "halco/hicann-dls/vx/capmem.h"
12 #include "haldls/cerealization.h"
13 #include "haldls/vx/common.h"
14 #include "haldls/vx/genpybind.h"
15 #include "haldls/vx/traits.h"
16 #include "hate/join.h"
17 #include "hate/visibility.h"
18 
19 #ifndef __ppu__
20 #include "hxcomm/vx/target.h"
21 #endif
22 
23 namespace fisch::vx {
24 class OmnibusChipOverJTAG;
25 class Omnibus;
26 } // namespace fisch::vx
27 
28 namespace haldls {
29 namespace vx GENPYBIND_TAG_HALDLS_VX {
30 
31 template <typename Coordinates>
32 class CapMemCell;
33 
34 template <typename Coordinates>
35 class SYMBOL_VISIBLE CapMemCell : public DifferentialWriteTrait
36 {
37 public:
38  typedef typename Coordinates::CapMemCellOnDLS coordinate_type;
39  typedef std::true_type is_leaf_node;
40 
41  struct GENPYBIND(inline_base("*")) Value
42  : public halco::common::detail::RantWrapper<Value, uint_fast16_t, 1022, 0>
43  {
44  typedef typename halco::common::detail::RantWrapper<Value, uint_fast16_t, 1022, 0>::rant_t
45  rant_t;
46  // default constructor needed because std::variant checks std::is_default_constructible
47  // which is false for constructors with default arguments
48  constexpr explicit Value() : rant_t(0) {}
49  constexpr explicit Value(uintmax_t const val) GENPYBIND(implicit_conversion) : rant_t(val)
50  {}
51  };
52 
53  struct GENPYBIND(inline_base("*")) DisableRefresh
54  : public halco::common::detail::RantWrapper<DisableRefresh, uint_fast16_t, 1023, 1023>
55  {
56  typedef typename halco::common::detail::
57  RantWrapper<DisableRefresh, uint_fast16_t, 1023, 1023>::rant_t rant_t;
58  constexpr explicit DisableRefresh() : rant_t(1023) {}
59  constexpr explicit DisableRefresh(uintmax_t const val) : rant_t(val) {}
60  };
61 
62  typedef std::variant<Value, DisableRefresh> value_type;
63 
64  explicit CapMemCell(value_type const& value = Value()) : m_value(value) {}
65 
66  GENPYBIND(getter_for(value))
67  value_type get_value() const;
68  GENPYBIND(setter_for(value))
69  void set_value(value_type const& value);
70 
71  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 1;
72  template <typename AddressT>
73  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& cell)
74  GENPYBIND(hidden);
75  template <typename WordT>
76  std::array<WordT, config_size_in_words> encode() const GENPYBIND(hidden);
77  template <typename WordT>
78  void decode(std::array<WordT, config_size_in_words> const& data) GENPYBIND(hidden);
79 
80  GENPYBIND(stringstream)
81  friend std::ostream& operator<<(std::ostream& os, CapMemCell const& cell)
82  {
83  os << "CapMemCell(";
84  std::visit([&](auto const& v) { os << v; }, cell.m_value);
85  os << ")";
86  return os;
87  }
88 
89  bool operator==(CapMemCell const& other) const;
90  bool operator!=(CapMemCell const& other) const;
91 
92 private:
93  friend class cereal::access;
94  template <class Archive>
95  void serialize(Archive& ar, std::uint32_t const version);
96 
97  value_type m_value;
98 };
99 
100 template <typename Coordinates>
101 class CapMemBlock;
102 
103 template <typename Coordinates>
104 class SYMBOL_VISIBLE CapMemBlock : public DifferentialWriteTrait
105 {
106 public:
107  typedef typename Coordinates::CapMemBlockOnDLS coordinate_type;
108  typedef std::false_type has_local_data;
109 
110  CapMemBlock();
111 
112  typename CapMemCell<Coordinates>::value_type get_cell(
113  typename Coordinates::CapMemCellOnCapMemBlock const& cell) const;
114  void set_cell(
115  typename Coordinates::CapMemCellOnCapMemBlock const& cell,
116  typename CapMemCell<Coordinates>::value_type const& value);
117 
118  GENPYBIND(stringstream)
119  friend std::ostream& operator<<(std::ostream& os, CapMemBlock<Coordinates> const& block)
120  {
121  os << "CapMemBlock(\n";
122  for (auto const coord :
123  halco::common::iter_all<typename Coordinates::CapMemCellOnCapMemBlock>()) {
124  os << "\t" << coord << ": " << block.m_capmem_cells[coord] << "\n";
125  }
126  os << ")" << std::flush;
127  return os;
128  }
129 
130  bool operator==(CapMemBlock const& other) const;
131  bool operator!=(CapMemBlock const& other) const;
132 
133 private:
134  friend detail::VisitPreorderImpl<CapMemBlock>;
135  friend class cereal::access;
136  template <class Archive>
137  void serialize(Archive& ar, std::uint32_t const version);
138 
139  halco::common::
140  typed_heap_array<CapMemCell<Coordinates>, typename Coordinates::CapMemCellOnCapMemBlock>
141  m_capmem_cells;
142 };
143 
144 
145 template <typename Coordinates>
146 class CapMemBlockConfig;
147 
149 enum class GENPYBIND(expose_as(_CapMemBlockConfigVRefSelect))
150  CapMemBlockConfigVRefSelect : uint_fast8_t
151 {
152  disabled = 0,
153  v_ref_v = 1,
154  v_ref_i = 2
155 };
156 
157 std::ostream& operator<<(std::ostream& os, CapMemBlockConfigVRefSelect const& config)
158  SYMBOL_VISIBLE;
159 
161 enum class GENPYBIND(expose_as(_CapMemBlockConfigIOutSelect))
162  CapMemBlockConfigIOutSelect : uint_fast8_t
163 {
164  disabled = 0,
165  i_out_mux = 1,
166  i_out_ramp = 2
167 };
168 
169 std::ostream& operator<<(std::ostream& os, CapMemBlockConfigIOutSelect const& config)
170  SYMBOL_VISIBLE;
171 
172 template <typename Coordinates>
173 class SYMBOL_VISIBLE CapMemBlockConfig : public DifferentialWriteTrait
174 {
175 public:
176  typedef typename Coordinates::CapMemBlockConfigOnDLS coordinate_type;
177  typedef std::true_type is_leaf_node;
178 #ifndef __ppu__
179  constexpr static auto unsupported_read_targets GENPYBIND(hidden) = {
180  hxcomm::vx::Target::hardware};
181 #endif
182 
183  struct GENPYBIND(inline_base("*")) OutAmpBias
184  : public halco::common::detail::RantWrapper<OutAmpBias, uint_fast16_t, 15, 0>
185  {
186  typedef
187  typename halco::common::detail::RantWrapper<OutAmpBias, uint_fast16_t, 15, 0>::rant_t
188  rant_t;
189  constexpr explicit OutAmpBias() : rant_t(0) {}
190  constexpr explicit OutAmpBias(uintmax_t const val) GENPYBIND(implicit_conversion) :
191  rant_t(val)
192  {}
193  };
194  struct GENPYBIND(inline_base("*")) SourceFollowerBias
195  : public halco::common::detail::RantWrapper<SourceFollowerBias, uint_fast16_t, 15, 0>
196  {
197  typedef typename halco::common::detail::
198  RantWrapper<SourceFollowerBias, uint_fast16_t, 15, 0>::rant_t rant_t;
199  constexpr explicit SourceFollowerBias() : rant_t(0) {}
200  constexpr explicit SourceFollowerBias(uintmax_t const val) GENPYBIND(implicit_conversion) :
201  rant_t(val)
202  {}
203  };
204  struct GENPYBIND(inline_base("*")) LevelShifterBias
205  : public halco::common::detail::RantWrapper<LevelShifterBias, uint_fast16_t, 15, 0>
206  {
207  typedef typename halco::common::detail::
208  RantWrapper<LevelShifterBias, uint_fast16_t, 15, 0>::rant_t rant_t;
209  constexpr explicit LevelShifterBias() : rant_t(0) {}
210  constexpr explicit LevelShifterBias(uintmax_t const val) GENPYBIND(implicit_conversion) :
211  rant_t(val)
212  {}
213  };
214 
215  struct GENPYBIND(inline_base("*")) VGlobalBias
216  : public halco::common::detail::RantWrapper<VGlobalBias, uint_fast16_t, 15, 0>
217  {
218  typedef
219  typename halco::common::detail::RantWrapper<VGlobalBias, uint_fast16_t, 15, 0>::rant_t
220  rant_t;
221  constexpr explicit VGlobalBias() : rant_t(0) {}
222  constexpr explicit VGlobalBias(uintmax_t const val) GENPYBIND(implicit_conversion) :
223  rant_t(val)
224  {}
225  };
226  struct GENPYBIND(inline_base("*")) CurrentCellRes
227  : public halco::common::detail::RantWrapper<CurrentCellRes, uint_fast16_t, 63, 0>
228  {
229  typedef typename halco::common::detail::RantWrapper<CurrentCellRes, uint_fast16_t, 63, 0>::
230  rant_t rant_t;
231  constexpr explicit CurrentCellRes() : rant_t(0) {}
232  constexpr explicit CurrentCellRes(uintmax_t const val) GENPYBIND(implicit_conversion) :
233  rant_t(val)
234  {}
235  };
236  struct GENPYBIND(inline_base("*")) BoostFactor
237  : public halco::common::detail::RantWrapper<BoostFactor, uint_fast16_t, 15, 0>
238  {
239  typedef
240  typename halco::common::detail::RantWrapper<BoostFactor, uint_fast16_t, 15, 0>::rant_t
241  rant_t;
242  constexpr explicit BoostFactor() : rant_t(0) {}
243  constexpr explicit BoostFactor(uintmax_t const val) GENPYBIND(implicit_conversion) :
244  rant_t(val)
245  {}
246  };
247  struct GENPYBIND(inline_base("*")) PrescalePause
248  : public halco::common::detail::RantWrapper<PrescalePause, uint_fast16_t, 6, 0>
249  {
250  typedef
251  typename halco::common::detail::RantWrapper<PrescalePause, uint_fast16_t, 6, 0>::rant_t
252  rant_t;
253  constexpr explicit PrescalePause() : rant_t(0) {}
254  constexpr explicit PrescalePause(uintmax_t const val) GENPYBIND(implicit_conversion) :
255  rant_t(val)
256  {}
257  };
258  struct GENPYBIND(inline_base("*")) PrescaleRamp
259  : public halco::common::detail::RantWrapper<PrescaleRamp, uint_fast16_t, 6, 0>
260  {
261  typedef
262  typename halco::common::detail::RantWrapper<PrescaleRamp, uint_fast16_t, 6, 0>::rant_t
263  rant_t;
264  constexpr explicit PrescaleRamp() : rant_t(0) {}
265  constexpr explicit PrescaleRamp(uintmax_t const val) GENPYBIND(implicit_conversion) :
266  rant_t(val)
267  {}
268  };
269  struct GENPYBIND(inline_base("*")) SubCounter
270  : public halco::common::detail::
271  RantWrapper<SubCounter, uint_fast16_t, 65535 /* 2^16*-1 */, 0>
272  {
273  typedef typename halco::common::detail::
274  RantWrapper<SubCounter, uint_fast16_t, 65535 /* 2^16*-1 */, 0>::rant_t rant_t;
275  constexpr explicit SubCounter() : rant_t(0) {}
276  constexpr explicit SubCounter(uintmax_t const val) GENPYBIND(implicit_conversion) :
277  rant_t(val)
278  {}
279  };
280  struct GENPYBIND(inline_base("*")) PauseCounter
281  : public halco::common::detail::
282  RantWrapper<PauseCounter, uint_fast32_t, 4294967295 /* 2^32-1 */, 0>
283  {
284  typedef typename halco::common::detail::
285  RantWrapper<PauseCounter, uint_fast32_t, 4294967295 /* 2^32-1 */, 0>::rant_t rant_t;
286  constexpr explicit PauseCounter() : rant_t(0) {}
287  constexpr explicit PauseCounter(uintmax_t const val) GENPYBIND(implicit_conversion) :
288  rant_t(val)
289  {}
290  };
291  struct GENPYBIND(inline_base("*")) PulseA
292  : public halco::common::detail::RantWrapper<PulseA, uint_fast16_t, 65535, 0>
293  {
294  typedef typename halco::common::detail::RantWrapper<PulseA, uint_fast16_t, 65535, 0>::rant_t
295  rant_t;
296  constexpr explicit PulseA() : rant_t(0) {}
297  constexpr explicit PulseA(uintmax_t const val) GENPYBIND(implicit_conversion) : rant_t(val)
298  {}
299  };
300  struct GENPYBIND(inline_base("*")) PulseB
301  : public halco::common::detail::RantWrapper<PulseB, uint_fast16_t, 65535, 0>
302  {
303  typedef typename halco::common::detail::RantWrapper<PulseB, uint_fast16_t, 65535, 0>::rant_t
304  rant_t;
305  constexpr explicit PulseB() : rant_t(0) {}
306  constexpr explicit PulseB(uintmax_t const val) GENPYBIND(implicit_conversion) : rant_t(val)
307  {}
308  };
309  struct GENPYBIND(inline_base("*")) BoostA
310  : public halco::common::detail::RantWrapper<BoostA, uint_fast16_t, 65535, 0>
311  {
312  typedef typename halco::common::detail::RantWrapper<BoostA, uint_fast16_t, 65535, 0>::rant_t
313  rant_t;
314  constexpr explicit BoostA() : rant_t(0) {}
315  constexpr explicit BoostA(uintmax_t const val) GENPYBIND(implicit_conversion) : rant_t(val)
316  {}
317  };
318  struct GENPYBIND(inline_base("*")) BoostB
319  : public halco::common::detail::RantWrapper<BoostB, uint_fast16_t, 65535, 0>
320  {
321  typedef typename halco::common::detail::RantWrapper<BoostB, uint_fast16_t, 65535, 0>::rant_t
322  rant_t;
323  constexpr explicit BoostB() : rant_t(0) {}
324  constexpr explicit BoostB(uintmax_t const val) GENPYBIND(implicit_conversion) : rant_t(val)
325  {}
326  };
327 
328  typedef CapMemBlockConfigVRefSelect VRefSelect GENPYBIND(visible);
329  typedef CapMemBlockConfigIOutSelect IOutSelect GENPYBIND(visible);
330 
331  CapMemBlockConfig();
332 
333  GENPYBIND(getter_for(enable_capmem))
334  bool get_enable_capmem() const;
335  GENPYBIND(setter_for(enable_capmem))
336  void set_enable_capmem(bool const value);
337 
338  GENPYBIND(getter_for(debug_readout_enable))
339  bool get_debug_readout_enable() const;
340  GENPYBIND(setter_for(debug_readout_enable))
341  void set_debug_readout_enable(bool const value);
342 
343  GENPYBIND(getter_for(debug_capmem_coord))
344  typename Coordinates::CapMemCellOnCapMemBlock get_debug_capmem_coord() const;
345  GENPYBIND(setter_for(debug_capmem_coord))
346  void set_debug_capmem_coord(typename Coordinates::CapMemCellOnCapMemBlock const& value);
347 
348  GENPYBIND(getter_for(debug_v_ref_select))
349  VRefSelect get_debug_v_ref_select() const;
350  GENPYBIND(setter_for(debug_v_ref_select))
351  void set_debug_v_ref_select(VRefSelect const& value);
352 
353  GENPYBIND(getter_for(debug_i_out_select))
354  IOutSelect get_debug_i_out_select() const;
355  GENPYBIND(setter_for(debug_i_out_select))
356  void set_debug_i_out_select(IOutSelect const& value);
357 
358  GENPYBIND(getter_for(debug_out_amp_bias))
359  OutAmpBias get_debug_out_amp_bias() const;
360  GENPYBIND(setter_for(debug_out_amp_bias))
361  void set_debug_out_amp_bias(OutAmpBias const& value);
362 
363  GENPYBIND(getter_for(debug_source_follower_bias))
364  SourceFollowerBias get_debug_source_follower_bias() const;
365  GENPYBIND(setter_for(debug_source_follower_bias))
366  void set_debug_source_follower_bias(SourceFollowerBias const& value);
367 
368  GENPYBIND(getter_for(debug_level_shifter_bias))
369  LevelShifterBias get_debug_level_shifter_bias() const;
370  GENPYBIND(setter_for(debug_level_shifter_bias))
371  void set_debug_level_shifter_bias(LevelShifterBias const& value);
372 
373  GENPYBIND(getter_for(v_global_bias))
374  VGlobalBias get_v_global_bias() const;
375  GENPYBIND(setter_for(v_global_bias))
376  void set_v_global_bias(VGlobalBias const& value);
377 
378  GENPYBIND(getter_for(current_cell_res))
379  CurrentCellRes get_current_cell_res() const;
380  GENPYBIND(setter_for(current_cell_res))
381  void set_current_cell_res(CurrentCellRes const& value);
382 
383  GENPYBIND(getter_for(boost_factor))
384  BoostFactor get_boost_factor() const;
385  GENPYBIND(setter_for(boost_factor))
386  void set_boost_factor(BoostFactor const& value);
387 
388  GENPYBIND(getter_for(enable_boost))
389  bool get_enable_boost() const;
390  GENPYBIND(setter_for(enable_boost))
391  void set_enable_boost(bool const value);
392 
393  GENPYBIND(getter_for(enable_autoboost))
394  bool get_enable_autoboost() const;
395  GENPYBIND(setter_for(enable_autoboost))
396  void set_enable_autoboost(bool const value);
397 
398  GENPYBIND(getter_for(prescale_pause))
399  PrescalePause get_prescale_pause() const;
400  GENPYBIND(setter_for(prescale_pause))
401  void set_prescale_pause(PrescalePause const& value);
402 
403  GENPYBIND(getter_for(prescale_ramp))
404  PrescaleRamp get_prescale_ramp() const;
405  GENPYBIND(setter_for(prescale_ramp))
406  void set_prescale_ramp(PrescaleRamp const& value);
407 
408  GENPYBIND(getter_for(sub_counter))
409  SubCounter get_sub_counter() const;
410  GENPYBIND(setter_for(sub_counter))
411  void set_sub_counter(SubCounter const& value);
412 
413  GENPYBIND(getter_for(pause_counter))
414  PauseCounter get_pause_counter() const;
415  GENPYBIND(setter_for(pause_counter))
416  void set_pause_counter(PauseCounter const& value);
417 
418  GENPYBIND(getter_for(pulse_a))
419  PulseA get_pulse_a() const;
420  GENPYBIND(setter_for(pulse_a))
421  void set_pulse_a(PulseA const& value);
422 
423  GENPYBIND(getter_for(pulse_b))
424  PulseB get_pulse_b() const;
425  GENPYBIND(setter_for(pulse_b))
426  void set_pulse_b(PulseB const& value);
427 
428  GENPYBIND(getter_for(boost_a))
429  BoostA get_boost_a() const;
430  GENPYBIND(setter_for(boost_a))
431  void set_boost_a(BoostA const& value);
432 
433  GENPYBIND(getter_for(boost_b))
434  BoostB get_boost_b() const;
435  GENPYBIND(setter_for(boost_b))
436  void set_boost_b(BoostB const& value);
437 
438  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 10;
439  template <typename AddressT>
440  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& coord)
441  GENPYBIND(hidden);
442  template <typename WordT>
443  std::array<WordT, config_size_in_words> encode() const GENPYBIND(hidden);
444  template <typename WordT>
445  void decode(std::array<WordT, config_size_in_words> const& data) GENPYBIND(hidden);
446 
447  bool operator==(CapMemBlockConfig const& other) const;
448  bool operator!=(CapMemBlockConfig const& other) const;
449 
450  GENPYBIND(stringstream)
451  friend std::ostream& operator<<(std::ostream& os, CapMemBlockConfig<Coordinates> const& config)
452  {
453  std::stringstream ss;
454  ss << "CapMemBlockConfig(\n";
455  ss << std::boolalpha;
456  ss << "\tenable_capmem: \t" << config.m_enable_capmem << "\n";
457  ss << "\tdebug_readout_enable: \t" << config.m_debug_readout_enable << "\n";
458  ss << "\tdebug_capmem_coord: \t" << config.m_debug_capmem_coord << "\n";
459  ss << "\tdebug_v_ref_select: \t" << config.m_debug_v_ref_select << "\n";
460  ss << "\tdebug_i_out_select: \t" << config.m_debug_i_out_select << "\n";
461  ss << "\tdebug_out_amp_bias: \t" << config.m_debug_out_amp_bias << "\n";
462  ss << "\tdebug_source_follower_bias: \t" << config.m_debug_source_follower_bias << "\n";
463  ss << "\tdebug_level_shifter_bias: \t" << config.m_debug_level_shifter_bias << "\n";
464  ss << "\tv_global_bias: \t" << config.m_v_global_bias << "\n";
465  ss << "\tcurrent_cell_res: \t" << config.m_current_cell_res << "\n";
466  ss << "\tenable_boost: \t" << config.m_enable_boost << "\n";
467  ss << "\tboost_factor: \t" << config.m_boost_factor << "\n";
468  ss << "\tenable_autoboost: \t" << config.m_enable_autoboost << "\n";
469  ss << "\tprescale_pause: \t" << config.m_prescale_pause << "\n";
470  ss << "\tprescale_ramp: \t" << config.m_prescale_ramp << "\n";
471  ss << "\tsub_counter: \t" << config.m_sub_counter << "\n";
472  ss << "\tpause_counter: \t" << config.m_pause_counter << "\n";
473  ss << "\tpulse_a: \t" << config.m_pulse_a << "\n";
474  ss << "\tpulse_b: \t" << config.m_pulse_b << "\n";
475  ss << "\tboost_a: \t" << config.m_boost_a << "\n";
476  ss << "\tboost_b: \t" << config.m_boost_b << "\n";
477  ss << ")" << std::flush;
478  return (os << ss.str());
479  }
480 
481 private:
482  friend class cereal::access;
483  template <class Archive>
484  void serialize(Archive& ar, std::uint32_t const version);
485 
486  bool m_enable_capmem;
487  bool m_debug_readout_enable;
488  typename Coordinates::CapMemCellOnCapMemBlock m_debug_capmem_coord;
489  VRefSelect m_debug_v_ref_select;
490  IOutSelect m_debug_i_out_select;
491  OutAmpBias m_debug_out_amp_bias;
492  SourceFollowerBias m_debug_source_follower_bias;
493  LevelShifterBias m_debug_level_shifter_bias;
494  VGlobalBias m_v_global_bias;
495  CurrentCellRes m_current_cell_res;
496  bool m_enable_boost;
497  BoostFactor m_boost_factor;
498  bool m_enable_autoboost;
499  PrescalePause m_prescale_pause;
500  PrescaleRamp m_prescale_ramp;
501  SubCounter m_sub_counter;
502  PauseCounter m_pause_counter;
503  PulseA m_pulse_a;
504  PulseB m_pulse_b;
505  BoostA m_boost_a;
506  BoostB m_boost_b;
507 };
508 
509 namespace detail {
510 
511 template <typename Coordinates>
512 struct BackendContainerTrait<CapMemBlockConfig<Coordinates>>
513  : public BackendContainerBase<
514  CapMemBlockConfig<Coordinates>,
515  fisch::vx::word_access_type::Omnibus,
516  fisch::vx::word_access_type::OmnibusChipOverJTAG>
517 {};
518 
519 template <typename Coordinates>
520 struct BackendContainerTrait<CapMemBlock<Coordinates>>
521  : public BackendContainerBase<
522  CapMemBlock<Coordinates>,
523  fisch::vx::word_access_type::Omnibus,
524  fisch::vx::word_access_type::OmnibusChipOverJTAG>
525 {};
526 
527 template <typename Coordinates>
528 struct BackendContainerTrait<CapMemCell<Coordinates>>
529  : public BackendContainerBase<
530  CapMemCell<Coordinates>,
531  fisch::vx::word_access_type::Omnibus,
532  fisch::vx::word_access_type::OmnibusChipOverJTAG>
533 {};
534 
535 template <typename Coordinates>
536 struct VisitPreorderImpl<CapMemBlock<Coordinates>>
537 {
538  template <typename ContainerT, typename VisitorT>
539  static void call(
540  ContainerT& config,
541  typename CapMemBlock<Coordinates>::coordinate_type const& coord,
542  VisitorT&& visitor)
543  {
544  using halco::common::iter_all;
545 
546  visitor(coord, config);
547 
548  for (auto const cell : iter_all<typename Coordinates::CapMemCellOnCapMemBlock>()) {
549  // No std::forward for visitor argument, as we want to pass a reference to the
550  // nested visitor in any case, even if it was passed as an rvalue to this function.
551  visit_preorder(
552  config.m_capmem_cells[cell], typename Coordinates::CapMemCellOnDLS(cell, coord),
553  visitor);
554  }
555  }
556 };
557 
558 } // namespace detail
559 
560 #define CAPMEM_EXTERN_TEMPLATE(Coordinates) \
561  extern template class SYMBOL_VISIBLE CapMemCell<Coordinates>; \
562  extern template class SYMBOL_VISIBLE CapMemBlock<Coordinates>; \
563  extern template class SYMBOL_VISIBLE CapMemBlockConfig<Coordinates>; \
564  std::ostream& operator<<( \
565  std::ostream& os, typename CapMemCell<Coordinates>::value_type const& value) \
566  SYMBOL_VISIBLE GENPYBIND(hidden); \
567  \
568  extern template SYMBOL_VISIBLE std::array< \
569  halco::hicann_dls::vx::OmnibusAddress, CapMemCell<Coordinates>::config_size_in_words> \
570  CapMemCell<Coordinates>::addresses<halco::hicann_dls::vx::OmnibusAddress>( \
571  coordinate_type const& cell); \
572  extern template SYMBOL_VISIBLE std::array< \
573  fisch::vx::word_access_type::OmnibusChipOverJTAG, \
574  CapMemCell<Coordinates>::config_size_in_words> \
575  CapMemCell<Coordinates>::encode<fisch::vx::word_access_type::OmnibusChipOverJTAG>() const; \
576  extern template SYMBOL_VISIBLE std::array< \
577  fisch::vx::word_access_type::Omnibus, CapMemCell<Coordinates>::config_size_in_words> \
578  CapMemCell<Coordinates>::encode<fisch::vx::word_access_type::Omnibus>() const; \
579  extern template SYMBOL_VISIBLE void \
580  CapMemCell<Coordinates>::decode<fisch::vx::word_access_type::OmnibusChipOverJTAG>( \
581  std::array< \
582  fisch::vx::word_access_type::OmnibusChipOverJTAG, \
583  CapMemCell<Coordinates>::config_size_in_words> const& data); \
584  extern template SYMBOL_VISIBLE void \
585  CapMemCell<Coordinates>::decode<fisch::vx::word_access_type::Omnibus>( \
586  std::array< \
587  fisch::vx::word_access_type::Omnibus, \
588  CapMemCell<Coordinates>::config_size_in_words> const& data); \
589  \
590  extern template SYMBOL_VISIBLE std::array< \
591  halco::hicann_dls::vx::OmnibusChipOverJTAGAddress, \
592  CapMemCell<Coordinates>::config_size_in_words> \
593  CapMemCell<Coordinates>::addresses<halco::hicann_dls::vx::OmnibusChipOverJTAGAddress>( \
594  coordinate_type const& cell); \
595  \
596  extern template SYMBOL_VISIBLE std::array< \
597  halco::hicann_dls::vx::OmnibusChipOverJTAGAddress, \
598  CapMemBlockConfig<Coordinates>::config_size_in_words> \
599  CapMemBlockConfig<Coordinates>::addresses(coordinate_type const& coord); \
600  extern template SYMBOL_VISIBLE std::array< \
601  halco::hicann_dls::vx::OmnibusAddress, \
602  CapMemBlockConfig<Coordinates>::config_size_in_words> \
603  CapMemBlockConfig<Coordinates>::addresses(coordinate_type const& coord); \
604  extern template SYMBOL_VISIBLE std::array< \
605  fisch::vx::word_access_type::OmnibusChipOverJTAG, \
606  CapMemBlockConfig<Coordinates>::config_size_in_words> \
607  CapMemBlockConfig<Coordinates>::encode() const; \
608  extern template SYMBOL_VISIBLE std::array< \
609  fisch::vx::word_access_type::Omnibus, \
610  CapMemBlockConfig<Coordinates>::config_size_in_words> \
611  CapMemBlockConfig<Coordinates>::encode() const; \
612  extern template SYMBOL_VISIBLE void CapMemBlockConfig<Coordinates>::decode( \
613  std::array< \
614  fisch::vx::word_access_type::OmnibusChipOverJTAG, \
615  CapMemBlockConfig<Coordinates>::config_size_in_words> const& data); \
616  extern template SYMBOL_VISIBLE void CapMemBlockConfig<Coordinates>::decode( \
617  std::array< \
618  fisch::vx::word_access_type::Omnibus, \
619  CapMemBlockConfig<Coordinates>::config_size_in_words> const& data);
620 
621 } // namespace vx
622 } // namespace haldls
623 
624 namespace std {
625 
626 #define CAPMEM_HALCO_GEOMETRY_HASH(Coordinates) \
627  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemCell<Coordinates>::Value) \
628  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemCell<Coordinates>::DisableRefresh) \
629  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::OutAmpBias) \
630  HALCO_GEOMETRY_HASH_CLASS( \
631  typename haldls::vx::CapMemBlockConfig<Coordinates>::SourceFollowerBias) \
632  HALCO_GEOMETRY_HASH_CLASS( \
633  typename haldls::vx::CapMemBlockConfig<Coordinates>::LevelShifterBias) \
634  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::VGlobalBias) \
635  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::CurrentCellRes) \
636  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::BoostFactor) \
637  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::PrescalePause) \
638  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::PrescaleRamp) \
639  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::SubCounter) \
640  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::PauseCounter) \
641  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::PulseA) \
642  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::PulseB) \
643  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::BoostA) \
644  HALCO_GEOMETRY_HASH_CLASS(typename haldls::vx::CapMemBlockConfig<Coordinates>::BoostB)
645 
646 } // namespace std
Coordinates::CapMemCellOnDLS coordinate_type
Definition: capmem.h:38
std::true_type is_leaf_node
Definition: capmem.h:39
Trait signalling derived-from container type support differential write operation.
Definition: traits.h:17
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4
haldls::vx::CapMemCell< halco::hicann_dls::vx::v3::Coordinates > CapMemCell
Definition: capmem.h:23
haldls::vx::CapMemBlockConfig< halco::hicann_dls::vx::v2::Coordinates > CapMemBlockConfig
Definition: capmem.h:39
haldls::vx::CapMemBlock< halco::hicann_dls::vx::v2::Coordinates > CapMemBlock
Definition: capmem.h:37