LOLA
readout_chain.h
Go to the documentation of this file.
1 #pragma once
2 
3 #ifndef CHIP_REVISION
4 #error "Requires CHIP_REVISION"
5 #endif
6 
7 #define ID(x) x
8 #define XSTR(x) #x
9 #define STR(x) XSTR(x)
10 // clang-format off
11 #define CONCAT(w, x, y, z) STR(ID(w)ID(/)ID(x)ID(/)ID(v)ID(y)ID(/)ID(z))
12 #include CONCAT(haldls,vx,CHIP_REVISION,capmem.h)
13 // clang-format on
14 #undef ID
15 #undef XSTR
16 #undef STR
17 #undef CONCAT
18 
19 #include "halco/common/typed_array.h"
20 #include "halco/hicann-dls/vx/readout.h"
21 #include "halco/hicann-dls/vx/current_dac.h"
22 #include "haldls/cerealization.h"
23 #include "haldls/vx/madc.h"
24 #include "haldls/vx/current_dac.h"
25 #include "haldls/vx/readout.h"
26 #include "hate/visibility.h"
27 #include "lola/vx/cerealization.h"
28 #include "lola/vx/genpybind.h"
29 
30 #if CHIP_REVISION == 2
31 #define GENPYBIND_TAG_LOLA_VX_VY GENPYBIND_TAG_LOLA_VX_V2
32 #define CHIP_REVISION_STR v2
33 #elif CHIP_REVISION == 3
34 #define GENPYBIND_TAG_LOLA_VX_VY GENPYBIND_TAG_LOLA_VX_V3
35 #define CHIP_REVISION_STR v3
36 #else
37 #error "Unknown CHIP_REVISION"
38 #endif
39 
40 namespace lola::vx::CHIP_REVISION_STR GENPYBIND_TAG_LOLA_VX_VY {
41 #undef GENPYBIND_TAG_LOLA_VX_VY
42 
46 class GENPYBIND(visible) ReadoutChain
47 {
48 public:
49  typedef halco::hicann_dls::vx::ReadoutChainOnDLS coordinate_type;
50  typedef std::false_type has_local_data;
51 
52  typedef haldls::vx::CHIP_REVISION_STR::CapMemCell::Value AnalogValue GENPYBIND(visible);
53  typedef haldls::vx::CHIP_REVISION_STR::CapMemCell::DisableRefresh AnalogDisableRefresh
54  GENPYBIND(visible);
55  typedef haldls::vx::CHIP_REVISION_STR::CapMemCell::value_type AnalogValueVariant;
56 
57  ReadoutChain() = default;
58 
66  typedef halco::common::typed_array<
67  haldls::vx::ReadoutSourceSelection::SourceMultiplexer,
68  halco::hicann_dls::vx::SourceMultiplexerOnReadoutSourceSelection>
69  InputMux GENPYBIND(opaque(false));
70 
78  struct GENPYBIND(visible) BufferToPadT
79  {
80  BufferToPadT() SYMBOL_VISIBLE;
81 
85  bool enable;
86 
90  AnalogValueVariant amp_i_bias;
91 
92  bool operator==(BufferToPadT const& other) const SYMBOL_VISIBLE;
93  bool operator!=(BufferToPadT const& other) const SYMBOL_VISIBLE;
94  GENPYBIND(stringstream)
95  friend std::ostream& operator<<(std::ostream& os, BufferToPadT const& config)
96  SYMBOL_VISIBLE;
97  };
98 
99  typedef halco::common::
100  typed_array<BufferToPadT, halco::hicann_dls::vx::SourceMultiplexerOnReadoutSourceSelection>
101  BufferToPad GENPYBIND(opaque(false));
102 
109  struct GENPYBIND(visible) DynamicMux
110  {
111  DynamicMux() = default;
112 
113  typedef haldls::vx::MADCConfig::ActiveMuxInputSelectLength InputSelectLength
114  GENPYBIND(visible);
115  typedef haldls::vx::MADCConfig::input_selection_type InputSelect GENPYBIND(visible);
119  bool enable_amplifiers{true};
120 
124  InputSelect initially_selected_input{};
125 
130  InputSelectLength input_select_length{};
131 
136 
137  bool operator==(DynamicMux const& other) const SYMBOL_VISIBLE;
138  bool operator!=(DynamicMux const& other) const SYMBOL_VISIBLE;
139  GENPYBIND(stringstream)
140  friend std::ostream& operator<<(std::ostream& os, DynamicMux const& config) SYMBOL_VISIBLE;
141  };
142 
143  typedef haldls::vx::MADCConfig::hemisphere_type HemisphereType GENPYBIND(visible);
144  typedef haldls::vx::MADCConfig::synapse_target_type SynapseTargetType GENPYBIND(visible);
145 
152  struct GENPYBIND(visible) PseudoDifferentialConverter
153  {
155 
159  HemisphereType enable_reference{{false, false}};
160 
165 
170 
171  bool operator==(PseudoDifferentialConverter const& other) const SYMBOL_VISIBLE;
172  bool operator!=(PseudoDifferentialConverter const& other) const SYMBOL_VISIBLE;
173  GENPYBIND(stringstream)
174  friend std::ostream& operator<<(std::ostream& os, PseudoDifferentialConverter const& config)
175  SYMBOL_VISIBLE;
176  };
177 
181  struct GENPYBIND(visible) MADCInputCrossbar
182  {
183  MADCInputCrossbar() SYMBOL_VISIBLE;
184 
188  bool connect_source_measure_unit;
189 
193  bool connect_dynamic_mux;
194 
198  bool connect_pad_mux;
199 
203  bool connect_madc_preamp;
204 
205 
206  bool operator==(MADCInputCrossbar const& other) const SYMBOL_VISIBLE;
207  bool operator!=(MADCInputCrossbar const& other) const SYMBOL_VISIBLE;
208  GENPYBIND(stringstream)
209  friend std::ostream& operator<<(std::ostream& os, MADCInputCrossbar const& config)
210  SYMBOL_VISIBLE;
211  };
212 
213 
214  typedef haldls::vx::MADCConfig::SamplingWindowTiming SamplingWindowTiming GENPYBIND(visible);
215 
219  struct GENPYBIND(visible) MADCPreamp
220  {
221  MADCPreamp() = default;
222 
223  typedef haldls::vx::MADCConfig::PreampGainCapacitorSize GainCapacitorSize
224  GENPYBIND(visible);
225 
229  GainCapacitorSize gain_cap_size{};
230 
234  SamplingWindowTiming sampling_window_start{3};
235 
239  SamplingWindowTiming sampling_window_end{8};
240 
245 
250 
251  bool operator==(MADCPreamp const& other) const SYMBOL_VISIBLE;
252  bool operator!=(MADCPreamp const& other) const SYMBOL_VISIBLE;
253  GENPYBIND(stringstream)
254  friend std::ostream& operator<<(std::ostream& os, MADCPreamp const& config) SYMBOL_VISIBLE;
255  };
256 
260  struct GENPYBIND(visible) MADCDebugCrossbar
261  {
262  MADCDebugCrossbar() SYMBOL_VISIBLE;
263 
264  typedef haldls::vx::MADCConfig::PreampGainCapacitorSize GainCapacitorSize
265  GENPYBIND(visible);
266 
270  bool connect_preamp_to_madc;
271 
275  bool connect_pads_to_madc;
276 
280  bool connect_preamp_to_pads;
281 
282  bool operator==(MADCDebugCrossbar const& other) const SYMBOL_VISIBLE;
283  bool operator!=(MADCDebugCrossbar const& other) const SYMBOL_VISIBLE;
284  GENPYBIND(stringstream)
285  friend std::ostream& operator<<(std::ostream& os, MADCDebugCrossbar const& config)
286  SYMBOL_VISIBLE;
287  };
288 
292  struct GENPYBIND(visible) MADC
293  {
294  MADC() = default;
295 
296  typedef haldls::vx::MADCConfig::SampleDurationAdjust SampleDurationAdjust
297  GENPYBIND(visible);
298  typedef haldls::vx::MADCConfig::SARResetWait SARResetWait GENPYBIND(visible);
299  typedef haldls::vx::MADCConfig::SARResetLength SARResetLength GENPYBIND(visible);
300  typedef haldls::vx::MADCConfig::PowerupWaitValue PowerupWaitValue GENPYBIND(visible);
301  typedef haldls::vx::MADCConfig::CalibrationWaitValue CalibrationWaitValue
302  GENPYBIND(visible);
303  typedef haldls::vx::MADCConfig::NumberOfSamples NumberOfSamples GENPYBIND(visible);
304  typedef haldls::vx::MADCConfig::MADCClockScaleValue ClockScaleValue GENPYBIND(visible);
305  typedef haldls::vx::MADCConfig::ConversionCyclesOffset ConversionCyclesOffset
306  GENPYBIND(visible);
307 
313  SampleDurationAdjust sample_duration_adjust{SampleDurationAdjust()};
314 
318  bool enable_sar_reset_on_fall{false};
319  SARResetWait sar_reset_wait{};
320  SARResetLength sar_reset_length{};
321 
327  PowerupWaitValue powerup_wait_value{};
328 
334  ConversionCyclesOffset conversion_cycles_offset{};
335 
339  bool enable_calibration{false};
340 
344  CalibrationWaitValue calibration_wait_value{};
345 
351  NumberOfSamples number_of_samples{};
352 
353  /*
354  * Let the MADC sample on the positive clock edge.
355  */
356  bool sample_on_positive_edge{true};
357 
358  /*
359  * Enable dummy data generation.
360  * If enabled, the MADC will stream out the last 10 bit of the sample
361  * counter value as a test pattern (sawtooth).
362  */
363  bool enable_dummy_data{false};
364 
369  bool enable_madc_clock_scaling{false};
370 
375  ClockScaleValue clock_scale_value{};
376 
381 
382  bool operator==(MADC const& other) const SYMBOL_VISIBLE;
383  bool operator!=(MADC const& other) const SYMBOL_VISIBLE;
384  GENPYBIND(stringstream)
385  friend std::ostream& operator<<(std::ostream& os, MADC const& config) SYMBOL_VISIBLE;
386  };
387 
394  typedef halco::common::typed_array<
395  haldls::vx::PadMultiplexerConfig,
396  halco::hicann_dls::vx::PadMultiplexerConfigOnDLS>
397  PadMux GENPYBIND(opaque(false));
398 
405  struct GENPYBIND(visible) SourceMeasureUnit
406  {
407  SourceMeasureUnit() = default;
408 
412  SamplingWindowTiming sampling_window_start{9};
413 
417  SamplingWindowTiming sampling_window_end{14};
418 
422  HemisphereType connect_neuron_stimulus{{false, false}};
423 
427  SynapseTargetType connect_synapse_debug{{false, false}};
428 
432  AnalogValueVariant test_voltage{AnalogValue{400}};
433 
437  AnalogValueVariant buffer_i_bias{};
438 
443 
447  AnalogValueVariant amp_i_bias{};
448 
449  bool operator==(SourceMeasureUnit const& other) const SYMBOL_VISIBLE;
450  bool operator!=(SourceMeasureUnit const& other) const SYMBOL_VISIBLE;
451  GENPYBIND(stringstream)
452  friend std::ostream& operator<<(std::ostream& os, SourceMeasureUnit const& config)
453  SYMBOL_VISIBLE;
454  };
455 
462  struct GENPYBIND(visible) CurrentDAC
463  {
464  typedef haldls::vx::CurrentDAC::Current Current GENPYBIND(visible);
465  typedef haldls::vx::CurrentDAC::Sign Sign GENPYBIND(visible);
466 
467  CurrentDAC() SYMBOL_VISIBLE;
468 
472  bool enable_current;
473 
477  Current current;
478 
482  Sign sign;
483 
487  HemisphereType connect_neuron_stimulus;
488 
492  SynapseTargetType connect_synapse_debug;
493 
498 
502  AnalogValueVariant i_bias_casc;
503 
504  bool operator==(CurrentDAC const& other) const SYMBOL_VISIBLE;
505  bool operator!=(CurrentDAC const& other) const SYMBOL_VISIBLE;
506  GENPYBIND(stringstream)
507  friend std::ostream& operator<<(std::ostream& os, CurrentDAC const& config) SYMBOL_VISIBLE;
508  };
509 
510  InputMux input_mux;
511  BufferToPad buffer_to_pad;
512  DynamicMux dynamic_mux;
513  PseudoDifferentialConverter pseudo_diff_converter;
514  MADCInputCrossbar madc_input_crossbar;
515  MADCPreamp madc_preamp;
516  MADCDebugCrossbar madc_debug_crossbar;
517  MADC madc;
518  PadMux pad_mux;
519  SourceMeasureUnit source_measure_unit;
520  CurrentDAC current_dac;
521 
522  bool operator==(ReadoutChain const& other) const SYMBOL_VISIBLE;
523  bool operator!=(ReadoutChain const& other) const SYMBOL_VISIBLE;
524 
525  GENPYBIND(stringstream)
526  friend std::ostream& operator<<(std::ostream& os, ReadoutChain const& config) SYMBOL_VISIBLE;
527 
528 private:
529  friend haldls::vx::detail::VisitPreorderImpl<ReadoutChain>;
530 };
531 
532 std::ostream& operator<<(std::ostream& os, ReadoutChain::InputMux const& config) SYMBOL_VISIBLE;
533 std::ostream& operator<<(std::ostream& os, ReadoutChain::BufferToPad const& config) SYMBOL_VISIBLE;
534 std::ostream& operator<<(std::ostream& os, ReadoutChain::PadMux const& config) SYMBOL_VISIBLE;
535 
536 
537 } // lola::vx::CHIP_REVISION_STR
538 
539 #include "lola/vx/readout_chain.tcc"
Configuration of all circuits composing the analog readout chain.
Definition: readout_chain.h:47
haldls::vx::CHIP_REVISION_STR::CapMemCell::DisableRefresh AnalogDisableRefresh
Definition: readout_chain.h:54
haldls::vx::MADCConfig::SamplingWindowTiming SamplingWindowTiming
haldls::vx::CHIP_REVISION_STR::CapMemCell::Value AnalogValue
Definition: readout_chain.h:52
haldls::vx::MADCConfig::synapse_target_type SynapseTargetType
halco::hicann_dls::vx::ReadoutChainOnDLS coordinate_type
Definition: readout_chain.h:49
halco::common::typed_array< haldls::vx::ReadoutSourceSelection::SourceMultiplexer, halco::hicann_dls::vx::SourceMultiplexerOnReadoutSourceSelection > InputMux
Configuration of the multiplexer for the different input signals from chip.
Definition: readout_chain.h:69
haldls::vx::MADCConfig::hemisphere_type HemisphereType
halco::common::typed_array< haldls::vx::PadMultiplexerConfig, halco::hicann_dls::vx::PadMultiplexerConfigOnDLS > PadMux
Configuration of the Pad multiplexers.
halco::common::typed_array< BufferToPadT, halco::hicann_dls::vx::SourceMultiplexerOnReadoutSourceSelection > BufferToPad
haldls::vx::CHIP_REVISION_STR::CapMemCell::value_type AnalogValueVariant
Definition: readout_chain.h:55
Definition: cadc.h:465
Configuration of the buffer connection the pads.
Definition: readout_chain.h:79
Configuration of the current DAC of the readout chain.
Configuration of the Dynamic multiplexer.
haldls::vx::MADCConfig::input_selection_type InputSelect
bool operator==(DynamicMux const &other) const SYMBOL_VISIBLE
haldls::vx::MADCConfig::ActiveMuxInputSelectLength InputSelectLength
bool operator!=(DynamicMux const &other) const SYMBOL_VISIBLE
Configuration of the crossbar connecting the MADC to debug pads.
haldls::vx::MADCConfig::PreampGainCapacitorSize GainCapacitorSize
haldls::vx::MADCConfig::SampleDurationAdjust SampleDurationAdjust
haldls::vx::MADCConfig::SARResetLength SARResetLength
haldls::vx::MADCConfig::PowerupWaitValue PowerupWaitValue
haldls::vx::MADCConfig::ConversionCyclesOffset ConversionCyclesOffset
bool operator!=(MADC const &other) const SYMBOL_VISIBLE
haldls::vx::MADCConfig::NumberOfSamples NumberOfSamples
haldls::vx::MADCConfig::MADCClockScaleValue ClockScaleValue
haldls::vx::MADCConfig::SARResetWait SARResetWait
bool operator==(MADC const &other) const SYMBOL_VISIBLE
haldls::vx::MADCConfig::CalibrationWaitValue CalibrationWaitValue
Configuration of the crossbar connecting the MADC to the different measure/readout circuits.
Configuration of the MADC preamplifier.
bool operator!=(MADCPreamp const &other) const SYMBOL_VISIBLE
haldls::vx::MADCConfig::PreampGainCapacitorSize GainCapacitorSize
bool operator==(MADCPreamp const &other) const SYMBOL_VISIBLE
Configuration of the pseudo differential converter.
bool operator!=(PseudoDifferentialConverter const &other) const SYMBOL_VISIBLE
bool operator==(PseudoDifferentialConverter const &other) const SYMBOL_VISIBLE
Configuration of the source measure unit.
bool operator==(SourceMeasureUnit const &other) const SYMBOL_VISIBLE
bool operator!=(SourceMeasureUnit const &other) const SYMBOL_VISIBLE