HALDLS
sram_controller.h
Go to the documentation of this file.
1 #pragma once
2 #include "haldls/cerealization.h"
3 #include "haldls/vx/common.h"
4 #include "haldls/vx/genpybind.h"
5 #include "haldls/vx/traits.h"
6 #include "hate/math.h"
7 #include "hate/visibility.h"
8 
9 namespace fisch::vx {
10 class Omnibus;
11 class OmnibusChipOverJTAG;
12 } // namespace fisch::vx
13 
14 namespace haldls {
15 namespace vx GENPYBIND_TAG_HALDLS_VX {
16 
17 namespace detail GENPYBIND_MODULE {
18 
31 // NOTE: This is not a complete container to be used directly but rather a base class for
32 // specialized containers for the different uses of the same controller type.
33 class GENPYBIND(visible) SRAMTimingConfig
34 {
35 public:
36  typedef std::true_type is_leaf_node;
37 
41  struct GENPYBIND(inline_base("*")) ReadDelay
42  : public halco::common::detail::
43  RantWrapper<ReadDelay, uint_fast16_t, hate::math::pow(2, 8) - 1, 0>
44  {
45  constexpr explicit ReadDelay(uintmax_t const val = 120) GENPYBIND(implicit_conversion) :
46  rant_t(val)
47  {}
48  };
49 
53  struct GENPYBIND(inline_base("*")) AddressSetupTime
54  : public halco::common::detail::
55  RantWrapper<AddressSetupTime, uint_fast16_t, hate::math::pow(2, 4) - 1, 0>
56  {
57  constexpr explicit AddressSetupTime(uintmax_t const val = 11)
58  GENPYBIND(implicit_conversion) :
59  rant_t(val)
60  {}
61  };
62 
66  struct GENPYBIND(inline_base("*")) EnableWidth
67  : public halco::common::detail::
68  RantWrapper<EnableWidth, uint_fast16_t, hate::math::pow(2, 4) - 1, 0>
69  {
70  constexpr explicit EnableWidth(uintmax_t const val = 11) GENPYBIND(implicit_conversion) :
71  rant_t(val)
72  {}
73  };
74 
76  SRAMTimingConfig() SYMBOL_VISIBLE;
77 
78  GENPYBIND(getter_for(read_delay))
79  ReadDelay get_read_delay() const SYMBOL_VISIBLE;
80  GENPYBIND(setter_for(read_delay))
81  void set_read_delay(ReadDelay value) SYMBOL_VISIBLE;
82 
83  GENPYBIND(getter_for(address_setup_time))
84  AddressSetupTime get_address_setup_time() const SYMBOL_VISIBLE;
85  GENPYBIND(setter_for(address_setup_time))
86  void set_address_setup_time(AddressSetupTime value) SYMBOL_VISIBLE;
87 
88  GENPYBIND(getter_for(enable_width))
89  EnableWidth get_enable_width() const SYMBOL_VISIBLE;
90  GENPYBIND(setter_for(enable_width))
91  void set_enable_width(EnableWidth value) SYMBOL_VISIBLE;
92 
93  bool operator==(SRAMTimingConfig const& other) const GENPYBIND(hidden) SYMBOL_VISIBLE;
94  bool operator!=(SRAMTimingConfig const& other) const GENPYBIND(hidden) SYMBOL_VISIBLE;
95 
96  static size_t constexpr config_size_in_words GENPYBIND(hidden) = 2;
97  template <typename WordT>
98  std::array<WordT, config_size_in_words> encode() const SYMBOL_VISIBLE GENPYBIND(hidden);
99  template <typename WordT>
100  void decode(std::array<WordT, config_size_in_words> const& data) SYMBOL_VISIBLE
101  GENPYBIND(hidden);
102 
103 private:
104  friend class cereal::access;
105  template <typename Archive>
106  void serialize(Archive& ar, std::uint32_t) SYMBOL_VISIBLE;
107 
108  ReadDelay m_read_delay;
109  AddressSetupTime m_address_setup_time;
110  EnableWidth m_enable_width;
111 };
112 
113 } // namespace detail
114 
115 EXTERN_INSTANTIATE_CEREAL_SERIALIZE(detail::SRAMTimingConfig)
116 
117 } // namespace vx
118 } // namespace haldls
Configuration of full-custom SRAM timing.
#define GENPYBIND_TAG_HALDLS_VX
Definition: genpybind.h:4
#define GENPYBIND_MODULE
Definition: genpybind.h:7