HALDLS
systime.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <iosfwd>
4 
5 #include "halco/hicann-dls/vx/timing.h"
6 #include "haldls/vx/common.h"
7 #include "haldls/vx/genpybind.h"
8 #include "haldls/vx/traits.h"
9 #include "hate/visibility.h"
10 
11 #ifndef __ppu__
12 #include "haldls/cerealization.h"
13 #endif
14 
15 namespace fisch::vx {
16 class Omnibus;
17 class OmnibusChipOverJTAG;
18 } // namespace fisch::vx
19 
20 namespace haldls {
21 namespace vx GENPYBIND_TAG_HALDLS_VX {
22 
27 class GENPYBIND(visible) SystimeSyncBase
28 {
29 public:
30  typedef halco::hicann_dls::vx::SystimeSyncBaseOnDLS coordinate_type;
31  typedef std::true_type is_leaf_node;
32 
33  struct GENPYBIND(inline_base("*")) Value
34  : public halco::common::detail::RantWrapper<Value, uint64_t, 0x7ffffffffff, 0>
35  {
36  constexpr explicit Value(uintmax_t const val = 0) GENPYBIND(implicit_conversion) :
37  rant_t(val)
38  {}
39  };
40 
41  explicit SystimeSyncBase(Value const value = Value()) SYMBOL_VISIBLE;
42 
43  GENPYBIND(getter_for(value))
44  Value get_value() const SYMBOL_VISIBLE;
45  GENPYBIND(setter_for(value))
46  void set_value(Value const& value) SYMBOL_VISIBLE;
47 
48  bool operator==(SystimeSyncBase const& other) const SYMBOL_VISIBLE;
49  bool operator!=(SystimeSyncBase const& other) const SYMBOL_VISIBLE;
50 
51  GENPYBIND(stringstream)
52  friend std::ostream& operator<<(std::ostream& os, SystimeSyncBase const& config) SYMBOL_VISIBLE;
53 
54  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 2;
55  template <typename AddressT>
56  static std::array<AddressT, config_size_in_words> addresses(coordinate_type const& word)
57  SYMBOL_VISIBLE GENPYBIND(hidden);
58  template <typename WordT>
59  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
60  template <typename WordT>
61  void decode(std::array<WordT, config_size_in_words> const& data) SYMBOL_VISIBLE
62  GENPYBIND(hidden);
63 
64 private:
65  friend class cereal::access;
66  template <class Archive>
67  void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE;
68 
69  Value m_value;
70 };
71 
72 #ifndef __ppu__
73 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(SystimeSyncBase)
74 #endif
75 
76 namespace detail {
77 
78 template <>
79 struct BackendContainerTrait<SystimeSyncBase>
80  : public BackendContainerBase<
81  SystimeSyncBase,
82  fisch::vx::word_access_type::Omnibus,
83  fisch::vx::word_access_type::OmnibusChipOverJTAG>
84 {};
85 
86 } // namespace detail
87 
88 
89 #ifndef __ppu__
95 class GENPYBIND(visible) SystimeSync
96 {
97 public:
98  typedef halco::hicann_dls::vx::SystimeSyncOnFPGA coordinate_type;
99  typedef std::true_type is_leaf_node;
100 
101  SystimeSync(bool do_sync = true) SYMBOL_VISIBLE;
102 
108  GENPYBIND(getter_for(do_sync))
109  bool get_do_sync() const SYMBOL_VISIBLE;
110 
116  GENPYBIND(setter_for(do_sync))
117  void set_do_sync(bool value) SYMBOL_VISIBLE;
118 
119  GENPYBIND(stringstream)
120  friend std::ostream& operator<<(std::ostream& os, SystimeSync const& systime_sync)
121  SYMBOL_VISIBLE;
122 
123  bool operator==(SystimeSync const& other) const SYMBOL_VISIBLE;
124  bool operator!=(SystimeSync const& other) const SYMBOL_VISIBLE;
125 
126  static size_t constexpr read_config_size_in_words GENPYBIND(hidden) = 0;
127  static size_t constexpr write_config_size_in_words GENPYBIND(hidden) = 1;
128  static std::array<coordinate_type, read_config_size_in_words> read_addresses(
129  coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden) SYMBOL_VISIBLE;
130  static std::array<coordinate_type, write_config_size_in_words> write_addresses(
131  coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden) SYMBOL_VISIBLE;
132  std::array<fisch::vx::word_access_type::SystimeSync, write_config_size_in_words> encode() const
133  SYMBOL_VISIBLE GENPYBIND(hidden) SYMBOL_VISIBLE;
134  void decode(
135  std::array<fisch::vx::word_access_type::SystimeSync, read_config_size_in_words> const& data)
136  SYMBOL_VISIBLE GENPYBIND(hidden);
137 
138 private:
139  bool m_do_sync;
140 
141  friend class cereal::access;
142  template <class Archive>
143  void serialize(Archive& ar, std::uint32_t const version);
144 };
145 
146 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(SystimeSync)
147 
148 namespace detail {
149 
150 template <>
151 struct BackendContainerTrait<SystimeSync>
152  : public BackendContainerBase<SystimeSync, fisch::vx::word_access_type::SystimeSync>
153 {};
154 
155 } // namespace detail
156 #endif
157 
158 } // namespace vx
159 } // namespace haldls
160 
161 namespace std {
162 
163 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::SystimeSyncBase::Value)
164 
165 } // namespace std
Container for configuring the initial counter value of the systime counter in the chip and in the FPG...
Definition: systime.h:28
std::true_type is_leaf_node
Definition: systime.h:31
halco::hicann_dls::vx::SystimeSyncBaseOnDLS coordinate_type
Definition: systime.h:30
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4