HALDLS
capmem.h
Go to the documentation of this file.
1 #pragma once
2 #include "halco/hicann-dls/vx/v3/capmem.h"
3 #include "halco/hicann-dls/vx/v3/coordinates.h"
4 #include "haldls/cerealization.h"
5 #include "haldls/vx/capmem.h"
6 #include "haldls/vx/genpybind.h"
7 
8 namespace fisch::vx {
9 class OmnibusChipOverJTAG;
10 class Omnibus;
11 } // namespace fisch::vx
12 
13 namespace haldls::vx {
14 CAPMEM_EXTERN_TEMPLATE(halco::hicann_dls::vx::v3::Coordinates)
15 } // namespace haldls::vx
16 
17 namespace std {
18 CAPMEM_HALCO_GEOMETRY_HASH(halco::hicann_dls::vx::v3::Coordinates)
19 } // namespace std
20 
22 
24 
25 GENPYBIND_MANUAL({
26  auto cls = pybind11::class_<::haldls::vx::v3::CapMemCell::value_type>(
27  parent, "_CapMemCell_value_type");
28  cls.def(
29  pybind11::init<::haldls::vx::v3::CapMemCell::Value>(),
30  pybind11::arg("value") = ::haldls::vx::v3::CapMemCell::Value(0))
31  .def(
32  pybind11::init<::haldls::vx::v3::CapMemCell::DisableRefresh>(), pybind11::arg("value"));
33  parent.attr("CapMemCell").attr("value_type") = parent.attr("_CapMemCell_value_type");
34 })
35 
36 using CapMemBlock GENPYBIND(opaque) =
38 using CapMemBlockConfig GENPYBIND(opaque) =
40 
41 class GENPYBIND(visible) ReferenceGeneratorConfig
42 {
43 public:
44  typedef halco::hicann_dls::vx::ReferenceGeneratorConfigOnDLS coordinate_type;
45  typedef std::true_type is_leaf_node;
46 
48  explicit ReferenceGeneratorConfig() SYMBOL_VISIBLE;
49 
50  struct GENPYBIND(inline_base("*")) CapMemAmplifier
51  : public halco::common::detail::RantWrapper<CapMemAmplifier, uint_fast8_t, 63, 0>
52  {
53  constexpr explicit CapMemAmplifier(uintmax_t const val = 40)
54  GENPYBIND(implicit_conversion) :
55  rant_t(val)
56  {}
57  };
58 
59  struct GENPYBIND(inline_base("*")) CapMemOffset
60  : public halco::common::detail::RantWrapper<CapMemOffset, uint_fast8_t, 63, 0>
61  {
62  constexpr explicit CapMemOffset(uintmax_t const val = 1) GENPYBIND(implicit_conversion) :
63  rant_t(val)
64  {}
65  };
66 
67  struct GENPYBIND(inline_base("*")) CapMemSlope
68  : public halco::common::detail::RantWrapper<CapMemSlope, uint_fast8_t, 63, 0>
69  {
70  constexpr explicit CapMemSlope(uintmax_t const val = 11) GENPYBIND(implicit_conversion) :
71  rant_t(val)
72  {}
73  };
74 
75  struct GENPYBIND(inline_base("*")) ReferenceControl
76  : public halco::common::detail::RantWrapper<ReferenceControl, uint_fast8_t, 63, 0>
77  {
78  constexpr explicit ReferenceControl(uintmax_t const val = 10)
79  GENPYBIND(implicit_conversion) :
80  rant_t(val)
81  {}
82  };
83 
84  struct GENPYBIND(inline_base("*")) ResistorControl
85  : public halco::common::detail::RantWrapper<ResistorControl, uint_fast8_t, 63, 0>
86  {
87  constexpr explicit ResistorControl(uintmax_t const val = 40)
88  GENPYBIND(implicit_conversion) :
89  rant_t(val)
90  {}
91  };
92 
93  typedef halco::common::typed_array<CapMemAmplifier, halco::hicann_dls::vx::CapMemBlockOnDLS>
94  capmem_amplifier_type GENPYBIND(opaque, expose_as(_capmem_amplifier_type));
95  typedef halco::common::typed_array<CapMemOffset, halco::hicann_dls::vx::CapMemBlockOnDLS>
96  capmem_offset_type GENPYBIND(opaque, expose_as(_capmem_offset_type));
97  typedef halco::common::typed_array<CapMemSlope, halco::hicann_dls::vx::CapMemBlockOnDLS>
98  capmem_slope_type GENPYBIND(opaque, expose_as(_capmem_slope_type));
99 
101  GENPYBIND(getter_for(enable_internal_reference))
102  bool const& get_enable_internal_reference() const SYMBOL_VISIBLE;
103  GENPYBIND(setter_for(enable_internal_reference))
104  void set_enable_internal_reference(bool value) SYMBOL_VISIBLE;
105 
107  GENPYBIND(getter_for(enable_reference_output))
108  bool const& get_enable_reference_output() const SYMBOL_VISIBLE;
109  GENPYBIND(setter_for(enable_reference_output))
110  void set_enable_reference_output(bool value) SYMBOL_VISIBLE;
111 
113  GENPYBIND(getter_for(enable_reference_input))
114  bool const& get_enable_reference_input() const SYMBOL_VISIBLE;
115  GENPYBIND(setter_for(enable_reference_input))
116  void set_enable_reference_input(bool value) SYMBOL_VISIBLE;
117 
119  GENPYBIND(getter_for(capmem_amplifier), return_value_policy(reference_internal))
120  capmem_amplifier_type const& get_capmem_amplifier() const SYMBOL_VISIBLE;
121  GENPYBIND(setter_for(capmem_amplifier))
122  void set_capmem_amplifier(capmem_amplifier_type const& value) SYMBOL_VISIBLE;
123 
125  GENPYBIND(getter_for(capmem_offset), return_value_policy(reference_internal))
126  capmem_offset_type const& get_capmem_offset() const SYMBOL_VISIBLE;
127  GENPYBIND(setter_for(capmem_offset))
128  void set_capmem_offset(capmem_offset_type const& value) SYMBOL_VISIBLE;
129 
131  GENPYBIND(getter_for(capmem_slope), return_value_policy(reference_internal))
132  capmem_slope_type const& get_capmem_slope() const SYMBOL_VISIBLE;
133  GENPYBIND(setter_for(capmem_slope))
134  void set_capmem_slope(capmem_slope_type const& value) SYMBOL_VISIBLE;
135 
137  GENPYBIND(getter_for(reference_control))
138  ReferenceControl get_reference_control() const SYMBOL_VISIBLE;
139  GENPYBIND(setter_for(reference_control))
140  void set_reference_control(ReferenceControl value) SYMBOL_VISIBLE;
141 
143  GENPYBIND(getter_for(resistor_control))
144  ResistorControl get_resistor_control() const SYMBOL_VISIBLE;
145  GENPYBIND(setter_for(resistor_control))
146  void set_resistor_control(ResistorControl value) SYMBOL_VISIBLE;
147 
150  GENPYBIND(getter_for(enable_reset))
151  bool const& get_enable_reset() const SYMBOL_VISIBLE;
152  GENPYBIND(setter_for(enable_reset))
153  void set_enable_reset(bool value) SYMBOL_VISIBLE;
154 
155  bool operator==(ReferenceGeneratorConfig const& other) const SYMBOL_VISIBLE;
156  bool operator!=(ReferenceGeneratorConfig const& other) const SYMBOL_VISIBLE;
157 
158  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 9;
159 
160  template <typename AddressT>
161  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& coord)
162  SYMBOL_VISIBLE GENPYBIND(hidden);
163 
164  template <typename WordT>
165  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
166 
167  template <typename WordT>
168  void decode(std::array<WordT, config_size_in_words> const& data) SYMBOL_VISIBLE
169  GENPYBIND(hidden);
170 
171  GENPYBIND(stringstream)
172  friend std::ostream& operator<<(std::ostream& os, ReferenceGeneratorConfig const& config)
173  SYMBOL_VISIBLE;
174 
175 private:
176  friend class cereal::access;
177  template <class Archive>
178  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
179 
180  bool m_enable_internal_reference;
181  bool m_enable_reference_output;
182  bool m_enable_reference_input;
183  capmem_amplifier_type m_capmem_amplifier;
184  capmem_offset_type m_capmem_offset;
185  capmem_slope_type m_capmem_slope;
186  ReferenceControl m_reference_control;
187  ResistorControl m_resistor_control;
188  bool m_enable_reset;
189 };
190 
191 } // namespace haldls::vx::v3
192 
193 namespace haldls::vx::detail {
194 
195 template <>
196 struct BackendContainerTrait<v3::ReferenceGeneratorConfig>
197  : public BackendContainerBase<
198  v3::ReferenceGeneratorConfig,
199  fisch::vx::word_access_type::Omnibus,
200  fisch::vx::word_access_type::OmnibusChipOverJTAG>
201 {};
202 
203 } // namespace haldls::vx::detail
204 
205 namespace std {
206 
207 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::v3::ReferenceGeneratorConfig::CapMemAmplifier)
208 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::v3::ReferenceGeneratorConfig::CapMemOffset)
209 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::v3::ReferenceGeneratorConfig::CapMemSlope)
210 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::v3::ReferenceGeneratorConfig::ReferenceControl)
211 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::v3::ReferenceGeneratorConfig::ResistorControl)
212 
213 } // namespace std
214 
215 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(haldls::vx::v3::ReferenceGeneratorConfig)
#define CAPMEM_EXTERN_TEMPLATE(Coordinates)
Definition: capmem.h:560
#define CAPMEM_HALCO_GEOMETRY_HASH(Coordinates)
Definition: capmem.h:626
ReferenceGeneratorConfig() SYMBOL_VISIBLE
Default config of reference generator.
std::true_type is_leaf_node
Definition: capmem.h:45
halco::hicann_dls::vx::ReferenceGeneratorConfigOnDLS coordinate_type
Definition: capmem.h:44
#define GENPYBIND_TAG_HALDLS_VX_V3
Definition: genpybind.h:6
Definition: arq.h:13
constexpr CapMemAmplifier(uintmax_t const val=40)
Definition: capmem.h:53