HALDLS
current_dac.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <iosfwd>
4 
5 #include "halco/common/typed_array.h"
6 #include "halco/hicann-dls/vx/chip.h"
7 #include "halco/hicann-dls/vx/current_dac.h"
8 #include "halco/hicann-dls/vx/synapse.h"
9 #include "haldls/cerealization.h"
10 #include "haldls/vx/genpybind.h"
11 #include "haldls/vx/traits.h"
12 #include "hate/visibility.h"
13 
14 namespace fisch::vx {
15 
16 class OmnibusChipOverJTAG;
17 class Omnibus;
18 
19 } // namespace fisch::vx
20 
22 
26 class GENPYBIND(visible) CurrentDAC
27 {
28 public:
29  typedef halco::hicann_dls::vx::CurrentDACOnDLS coordinate_type;
30 
31  typedef std::true_type is_leaf_node;
32 
34  enum class Sign : uint_fast8_t
35  {
36  source = 0b00,
37  sink = 0b01
38  };
39 
40  typedef halco::common::typed_array<bool, halco::hicann_dls::vx::HemisphereOnDLS> HemisphereType
41  GENPYBIND(opaque(false));
42 
43  typedef halco::common::typed_array<bool, halco::hicann_dls::vx::SynapticInputOnNeuron>
44  SynapseTargetType GENPYBIND(opaque(false));
45 
47  struct GENPYBIND(inline_base("*")) Current
48  : public halco::common::detail::BaseType<Current, uint8_t>
49  {
50  constexpr explicit Current(uintmax_t const val = 0) GENPYBIND(implicit_conversion) :
51  base_t(val)
52  {}
53  };
54 
56  CurrentDAC() SYMBOL_VISIBLE;
57 
59  GENPYBIND(getter_for(enable_current))
60  bool get_enable_current() const SYMBOL_VISIBLE;
61  GENPYBIND(setter_for(enable_current))
62  void set_enable_current(bool value) SYMBOL_VISIBLE;
63 
65  GENPYBIND(getter_for(current))
66  Current get_current() const SYMBOL_VISIBLE;
67  GENPYBIND(setter_for(current))
68  void set_current(Current value) SYMBOL_VISIBLE;
69 
71  GENPYBIND(getter_for(sign))
72  Sign get_sign() const SYMBOL_VISIBLE;
73  GENPYBIND(setter_for(sign))
74  void set_sign(Sign value) SYMBOL_VISIBLE;
75 
77  GENPYBIND(getter_for(connect_neuron))
78  HemisphereType get_connect_neuron() const SYMBOL_VISIBLE;
79  GENPYBIND(setter_for(connect_neuron))
80  void set_connect_neuron(HemisphereType value) SYMBOL_VISIBLE;
81 
83  GENPYBIND(getter_for(connect_synapse))
84  SynapseTargetType get_connect_synapse() const SYMBOL_VISIBLE;
85  GENPYBIND(setter_for(connect_synapse))
86  void set_connect_synapse(SynapseTargetType value) SYMBOL_VISIBLE;
87 
88  bool operator==(CurrentDAC const& other) const SYMBOL_VISIBLE;
89  bool operator!=(CurrentDAC const& other) const SYMBOL_VISIBLE;
90 
91  GENPYBIND(stringstream)
92  friend std::ostream& operator<<(std::ostream& os, CurrentDAC const& config) SYMBOL_VISIBLE;
93 
94  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 1;
95 
96  template <typename AddressT>
97  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& coord)
98  SYMBOL_VISIBLE GENPYBIND(hidden);
99 
100  template <typename WordT>
101  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
102 
103  template <typename WordT>
104  void decode(std::array<WordT, config_size_in_words> const& words) SYMBOL_VISIBLE
105  GENPYBIND(hidden);
106 
107 private:
108  friend class cereal::access;
109  template <class Archive>
110  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
111 
112  Current m_current;
113  bool m_enable_current;
114  Sign m_sign;
115  HemisphereType m_connect_neuron;
116  SynapseTargetType m_connect_synapse;
117 };
118 
119 std::ostream& operator<<(std::ostream&, CurrentDAC::Sign const&) SYMBOL_VISIBLE;
120 
121 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(CurrentDAC)
122 
123 
124 namespace detail {
125 
126 template <>
127 struct BackendContainerTrait<CurrentDAC>
128  : public BackendContainerBase<
129  CurrentDAC,
130  fisch::vx::word_access_type::Omnibus,
131  fisch::vx::word_access_type::OmnibusChipOverJTAG>
132 {};
133 
134 } // namespace detail
135 
136 } // namespace haldls::vx
Configuration of the current DAC of the readout chain.
Definition: current_dac.h:27
halco::hicann_dls::vx::CurrentDACOnDLS coordinate_type
Definition: current_dac.h:29
Sign
Decide whether current is sourced or sinked.
Definition: current_dac.h:35
halco::common::typed_array< bool, halco::hicann_dls::vx::HemisphereOnDLS > HemisphereType
Definition: current_dac.h:41
halco::common::typed_array< bool, halco::hicann_dls::vx::SynapticInputOnNeuron > SynapseTargetType
Definition: current_dac.h:44
std::true_type is_leaf_node
Definition: current_dac.h:31
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4