2 #include "fisch/vx/event.h"
3 #include "halco/common/geometry.h"
4 #include "halco/hicann-dls/vx/event.h"
5 #include "halco/hicann-dls/vx/highspeed_link.h"
6 #include "halco/hicann-dls/vx/readout.h"
13 #include "hate/visibility.h"
17 struct GENPYBIND(inline_base("*
")) SpikeLabel
18 : public halco::common::detail::BaseType<SpikeLabel, uint16_t>
20 constexpr explicit SpikeLabel(value_type const value = value_type()) : base_t(value) {}
23 GENPYBIND(getter_for(spl1_address))
24 halco::hicann_dls::vx::SPL1Address get_spl1_address() const SYMBOL_VISIBLE;
25 GENPYBIND(setter_for(spl1_address))
26 void set_spl1_address(halco::hicann_dls::vx::SPL1Address value) SYMBOL_VISIBLE;
29 GENPYBIND(getter_for(neuron_label))
30 halco::hicann_dls::vx::NeuronLabel get_neuron_label() const SYMBOL_VISIBLE;
31 GENPYBIND(setter_for(neuron_label))
32 void set_neuron_label(halco::hicann_dls::vx::NeuronLabel value) SYMBOL_VISIBLE;
35 struct GENPYBIND(inline_base("*
")) PADILabel
36 : public halco::common::detail::RantWrapper<PADILabel, uint_fast16_t, 0x3ff, 0>
38 constexpr explicit PADILabel(uintmax_t const val = 0) GENPYBIND(implicit_conversion) :
44 GENPYBIND(getter_for(padi_label))
45 PADILabel get_padi_label() const SYMBOL_VISIBLE;
46 GENPYBIND(setter_for(padi_label))
47 void set_padi_label(PADILabel value) SYMBOL_VISIBLE;
50 GENPYBIND(getter_for(neuron_event_output))
51 halco::hicann_dls::vx::NeuronEventOutputOnDLS get_neuron_event_output() const SYMBOL_VISIBLE;
52 GENPYBIND(setter_for(neuron_event_output))
53 void set_neuron_event_output(halco::hicann_dls::vx::NeuronEventOutputOnDLS value)
57 GENPYBIND(getter_for(neuron_backend_address_out))
58 NeuronBackendAddressOut get_neuron_backend_address_out() const SYMBOL_VISIBLE;
59 GENPYBIND(setter_for(neuron_backend_address_out))
60 void set_neuron_backend_address_out(NeuronBackendAddressOut value) SYMBOL_VISIBLE;
63 GENPYBIND(getter_for(row_select_address))
64 PADIEvent::RowSelectAddress get_row_select_address() const SYMBOL_VISIBLE;
65 GENPYBIND(setter_for(row_select_address))
66 void set_row_select_address(PADIEvent::RowSelectAddress) SYMBOL_VISIBLE;
69 GENPYBIND(getter_for(synapse_label))
70 SynapseLabelValue get_synapse_label() const SYMBOL_VISIBLE;
71 GENPYBIND(setter_for(synapse_label))
72 void set_synapse_label(SynapseLabelValue value) SYMBOL_VISIBLE;
75 #define SpikePackToChip(Num) \
76 class GENPYBIND(visible) SpikePack##Num##ToChip \
79 typedef halco::hicann_dls::vx::SpikePack##Num##ToChipOnDLS coordinate_type; \
80 typedef std::true_type is_leaf_node; \
82 typedef std::array<SpikeLabel, Num> labels_type; \
85 SpikePack##Num##ToChip() SYMBOL_VISIBLE; \
91 explicit SpikePack##Num##ToChip(labels_type const& labels) SYMBOL_VISIBLE; \
97 GENPYBIND(getter_for(labels)) \
98 labels_type get_labels() const SYMBOL_VISIBLE; \
104 GENPYBIND(setter_for(labels)) \
105 void set_labels(labels_type const& value) SYMBOL_VISIBLE; \
107 bool operator==(SpikePack##Num##ToChip const& other) const SYMBOL_VISIBLE; \
108 bool operator!=(SpikePack##Num##ToChip const& other) const SYMBOL_VISIBLE; \
110 GENPYBIND(stringstream) \
111 friend std::ostream& operator<<(std::ostream& os, SpikePack##Num##ToChip const& config) \
114 constexpr static size_t GENPYBIND(hidden) write_config_size_in_words = 1; \
115 constexpr static size_t GENPYBIND(hidden) read_config_size_in_words = 0; \
117 array<halco::hicann_dls::vx::SpikePack##Num##ToChipOnDLS, write_config_size_in_words> \
118 write_addresses(coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden); \
120 array<halco::hicann_dls::vx::SpikePack##Num##ToChipOnDLS, read_config_size_in_words> \
121 read_addresses(coordinate_type const& word) SYMBOL_VISIBLE GENPYBIND(hidden); \
123 array<fisch::vx::word_access_type::SpikePack##Num##ToChip, write_config_size_in_words> \
124 encode() const SYMBOL_VISIBLE GENPYBIND(hidden); \
125 void decode(std::array< \
126 fisch::vx::word_access_type::SpikePack##Num##ToChip, \
127 read_config_size_in_words> const& data) SYMBOL_VISIBLE GENPYBIND(hidden); \
130 friend class cereal::access; \
131 template <class Archive> \
132 void serialize(Archive& ar, std::uint32_t const version) SYMBOL_VISIBLE; \
134 labels_type m_impl; \
137 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(SpikePack##Num##ToChip) \
142 struct BackendContainerTrait<SpikePack##Num##ToChip> \
143 : public BackendContainerBase< \
144 SpikePack##Num##ToChip, \
145 fisch::vx::word_access_type::SpikePack##Num##ToChip> \
148 } // namespace detail
156 #undef SpikePackToChip
159 typedef fisch::vx::FPGATime FPGATime GENPYBIND(visible);
160 typedef fisch::vx::ChipTime ChipTime GENPYBIND(visible);
163 struct SpikeFromChipChecker;
170 class GENPYBIND(visible) SpikeFromChip
174 SpikeFromChip() = default;
182 SpikeFromChip(SpikeLabel const& label, FPGATime const& fpga_time, ChipTime const& chip_time) :
183 label(label), fpga_time(fpga_time), chip_time(chip_time)
190 SpikeFromChip(fisch::vx::SpikeFromChip const& data) :
191 label(data.label), fpga_time(data.fpga_time), chip_time(data.chip_time)
209 bool operator==(SpikeFromChip const& other) const SYMBOL_VISIBLE;
210 bool operator!=(SpikeFromChip const& other) const SYMBOL_VISIBLE;
212 GENPYBIND(stringstream)
213 friend std::ostream& operator<<(std::ostream& os, SpikeFromChip const& spike) SYMBOL_VISIBLE;
216 friend class cereal::access;
217 template <typename Archive>
218 void serialize(Archive& ar, std::uint32_t const version);
221 friend struct detail::SpikeFromChipChecker;
222 // packing of structs and pods seems different
223 struct __attribute__((packed)) GENPYBIND(hidden) SpikeFromChipDType
231 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(SpikeFromChip)
235 struct SpikeFromChipChecker {
236 static_assert(sizeof(SpikeFromChip::SpikeFromChipDType::label) == sizeof(SpikeFromChip::label));
238 sizeof(SpikeFromChip::SpikeFromChipDType::fpga_time) == sizeof(SpikeFromChip::fpga_time));
240 sizeof(SpikeFromChip::SpikeFromChipDType::chip_time) == sizeof(SpikeFromChip::chip_time));
241 static_assert(sizeof(SpikeFromChip::SpikeFromChipDType) == sizeof(SpikeFromChip));
243 offsetof(SpikeFromChip::SpikeFromChipDType, label) == offsetof(SpikeFromChip, label));
245 offsetof(SpikeFromChip::SpikeFromChipDType, fpga_time) ==
246 offsetof(SpikeFromChip, fpga_time));
248 offsetof(SpikeFromChip::SpikeFromChipDType, chip_time) ==
249 offsetof(SpikeFromChip, chip_time));
252 } // namespace detail
256 struct MADCSampleFromChipChecker;
263 class GENPYBIND(visible) MADCSampleFromChip
267 struct GENPYBIND(inline_base("*
")) Value
268 : public halco::common::detail::RantWrapper<Value, uint16_t, 0x3ff, 0>
270 constexpr explicit Value(uintmax_t const val = 0) : rant_t(val) {}
274 typedef halco::hicann_dls::vx::SourceMultiplexerOnReadoutSourceSelection Channel
275 GENPYBIND(opaque(false));
278 MADCSampleFromChip() = default;
289 Channel const& channel,
290 FPGATime const& fpga_time,
291 ChipTime const& chip_time) :
292 value(value), channel(channel), fpga_time(fpga_time), chip_time(chip_time)
299 MADCSampleFromChip(fisch::vx::MADCSampleFromChip const& data) :
301 channel(data.channel),
302 fpga_time(data.fpga_time),
303 chip_time(data.chip_time)
326 bool operator==(MADCSampleFromChip const& other) const SYMBOL_VISIBLE;
327 bool operator!=(MADCSampleFromChip const& other) const SYMBOL_VISIBLE;
329 GENPYBIND(stringstream)
330 friend std::ostream& operator<<(std::ostream& os, MADCSampleFromChip const& sample)
334 friend class cereal::access;
335 template <typename Archive>
336 void serialize(Archive& ar, std::uint32_t const version);
339 friend struct detail::MADCSampleFromChipChecker;
340 // packing of structs and pods seems different
341 struct __attribute__((packed)) GENPYBIND(hidden) MADCSampleFromChipDType
350 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(MADCSampleFromChip)
354 struct MADCSampleFromChipChecker
357 sizeof(MADCSampleFromChip::MADCSampleFromChipDType::value) ==
358 sizeof(MADCSampleFromChip::value));
360 sizeof(MADCSampleFromChip::MADCSampleFromChipDType::channel) ==
361 sizeof(MADCSampleFromChip::channel));
363 sizeof(MADCSampleFromChip::MADCSampleFromChipDType::fpga_time) ==
364 sizeof(MADCSampleFromChip::fpga_time));
366 sizeof(MADCSampleFromChip::MADCSampleFromChipDType::chip_time) ==
367 sizeof(MADCSampleFromChip::chip_time));
369 sizeof(MADCSampleFromChip::MADCSampleFromChipDType) == sizeof(MADCSampleFromChip));
371 offsetof(MADCSampleFromChip::MADCSampleFromChipDType, value) ==
372 offsetof(MADCSampleFromChip, value));
374 offsetof(MADCSampleFromChip::MADCSampleFromChipDType, channel) ==
375 offsetof(MADCSampleFromChip, channel));
377 offsetof(MADCSampleFromChip::MADCSampleFromChipDType, fpga_time) ==
378 offsetof(MADCSampleFromChip, fpga_time));
380 offsetof(MADCSampleFromChip::MADCSampleFromChipDType, chip_time) ==
381 offsetof(MADCSampleFromChip, chip_time));
384 } // namespace detail
390 class GENPYBIND(visible) HighspeedLinkNotification
394 HighspeedLinkNotification() = default;
400 HighspeedLinkNotification(fisch::vx::HighspeedLinkNotification const& data) SYMBOL_VISIBLE;
406 GENPYBIND(getter_for(phy))
407 halco::hicann_dls::vx::PhyStatusOnFPGA get_phy() const SYMBOL_VISIBLE;
413 GENPYBIND(setter_for(phy))
414 void set_phy(halco::hicann_dls::vx::PhyStatusOnFPGA value) SYMBOL_VISIBLE;
420 GENPYBIND(getter_for(link_up))
421 bool get_link_up() const SYMBOL_VISIBLE;
427 GENPYBIND(setter_for(link_up))
428 void set_link_up(bool value) SYMBOL_VISIBLE;
434 GENPYBIND(getter_for(decode_error))
435 bool get_decode_error() const SYMBOL_VISIBLE;
441 GENPYBIND(setter_for(decode_error))
442 void set_decode_error(bool value) SYMBOL_VISIBLE;
448 GENPYBIND(getter_for(crc_error))
449 bool get_crc_error() const SYMBOL_VISIBLE;
455 GENPYBIND(setter_for(crc_error))
456 void set_crc_error(bool value) SYMBOL_VISIBLE;
462 GENPYBIND(getter_for(crc_recover))
463 bool get_crc_recover() const SYMBOL_VISIBLE;
469 GENPYBIND(setter_for(crc_recover))
470 void set_crc_recover(bool value) SYMBOL_VISIBLE;
476 GENPYBIND(getter_for(check_error))
477 bool get_check_error() const SYMBOL_VISIBLE;
483 GENPYBIND(setter_for(check_error))
484 void set_check_error(bool value) SYMBOL_VISIBLE;
490 GENPYBIND(getter_for(fpga_time))
491 FPGATime get_fpga_time() const SYMBOL_VISIBLE;
497 GENPYBIND(setter_for(fpga_time))
498 void set_fpga_time(FPGATime value) SYMBOL_VISIBLE;
500 bool operator==(HighspeedLinkNotification const& other) const SYMBOL_VISIBLE;
501 bool operator!=(HighspeedLinkNotification const& other) const SYMBOL_VISIBLE;
503 GENPYBIND(stringstream)
504 friend std::ostream& operator<<(std::ostream& os, HighspeedLinkNotification const& sample)
508 friend class cereal::access;
509 template <typename Archive>
510 void serialize(Archive& ar, std::uint32_t const version);
512 halco::hicann_dls::vx::PhyStatusOnFPGA m_phy{};
513 bool m_link_up{false};
514 bool m_decode_error{false};
515 bool m_crc_error{false};
516 bool m_crc_recover{false};
517 bool m_check_error{false};
518 FPGATime m_fpga_time{};
521 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(HighspeedLinkNotification)
523 } // namespace haldls::vx
526 HALCO_GEOMETRY_HASH_CLASS(haldls::vx::SpikeLabel)
#define GENPYBIND_TAG_HALDLS_VX