HALDLS
timer.h
Go to the documentation of this file.
1 #pragma once
2 #include <array>
3 #include <iosfwd>
4 
5 #include "fisch/vx/word_access/type/timer.h"
6 #include "halco/common/geometry.h"
7 #include "halco/hicann-dls/vx/timing.h"
8 #include "haldls/cerealization.h"
9 #include "haldls/vx/genpybind.h"
10 #include "haldls/vx/traits.h"
11 #include "hate/visibility.h"
12 
13 namespace haldls {
14 namespace vx GENPYBIND_TAG_HALDLS_VX {
15 
19 class GENPYBIND(visible) Timer
20 {
21 public:
22  typedef halco::hicann_dls::vx::TimerOnDLS coordinate_type;
23  typedef std::true_type is_leaf_node;
24 
25  struct GENPYBIND(inline_base("*")) Value
26  : public halco::common::detail::BaseType<Value, uint32_t>
27  {
28  constexpr explicit Value(uintmax_t value = 0) GENPYBIND(implicit_conversion) : base_t(value)
29  {}
30 
31  static const Value fpga_clock_cycles_per_us SYMBOL_VISIBLE;
32  };
33 
38  explicit Timer(Value value = Value()) SYMBOL_VISIBLE;
39 
44  void set(Value value) SYMBOL_VISIBLE;
45 
46  bool operator==(Timer const& other) const SYMBOL_VISIBLE;
47  bool operator!=(Timer const& other) const SYMBOL_VISIBLE;
48 
49  GENPYBIND(stringstream)
50  friend std::ostream& operator<<(std::ostream& os, Timer const& config) SYMBOL_VISIBLE;
51 
52  static size_t constexpr write_config_size_in_words GENPYBIND(hidden) = 1;
53  static size_t constexpr read_config_size_in_words GENPYBIND(hidden) = 0;
54  static std::array<halco::hicann_dls::vx::TimerOnDLS, write_config_size_in_words>
55  write_addresses(coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden);
56  static std::array<halco::hicann_dls::vx::TimerOnDLS, read_config_size_in_words> read_addresses(
57  coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden);
58  std::array<fisch::vx::word_access_type::Timer, write_config_size_in_words> encode() const
59  SYMBOL_VISIBLE GENPYBIND(hidden);
60  void decode(std::array<fisch::vx::word_access_type::Timer, read_config_size_in_words> const&
61  data) SYMBOL_VISIBLE GENPYBIND(hidden);
62 
63 private:
64  friend class cereal::access;
65  template <typename Archive>
66  void serialize(Archive& ar, std::uint32_t const version);
67 
68  Value m_value;
69 };
70 
71 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(Timer)
72 
73 namespace detail {
74 
75 template <>
76 struct BackendContainerTrait<Timer>
77  : public BackendContainerBase<Timer, fisch::vx::word_access_type::Timer>
78 {};
79 
80 } // namespace detail
81 
82 } // namespace vx
83 } // namespace haldls
84 
85 namespace std {
86 
87 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::Timer::Value)
88 
89 } // namespace std
Container for resetting the FPGA playback timer.
Definition: timer.h:20
halco::hicann_dls::vx::TimerOnDLS coordinate_type
Definition: timer.h:22
std::true_type is_leaf_node
Definition: timer.h:23
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4