Bitstream Interpretation Library (BIL)  0.1
V5AddressLayout.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 #ifndef BIL_V5ADDRESSLAYOUT_HPP
8 #define BIL_V5ADDRESSLAYOUT_HPP
9 
13 
14 
15 namespace bil {
16 
27  public:
28 
29  /**********************************************************************/
30  /* CONSTRUCTION / DESTRUCTION */
31  /**********************************************************************/
32 
37 
45 
46 
47  /**********************************************************************/
48  /* UPPER ROW COUNT */
49  /**********************************************************************/
50 
52  static const unsigned ROWCOUNT_MAX = 31;
53 
61  void upperRowCount(unsigned count);
62 
67  unsigned upperRowCount() const;
68 
69 
70  /**********************************************************************/
71  /* LOWER ROW COUNT */
72  /**********************************************************************/
73 
81  void lowerRowCount(unsigned count);
82 
87  unsigned lowerRowCount() const;
88 
89 
90  /**********************************************************************/
91  /* COLUMN SEQUENCE */
92  /**********************************************************************/
93 
95  static const unsigned COLUMNCOUNT_MAX = 255;
96 
105  void columnSequence(const V5CfgColumnSequence& columns);
106 
113  const V5CfgColumnSequence& columnSequence() const;
114 
115 
116  /**********************************************************************/
117  /* QUERY FUNCTIONS */
118  /**********************************************************************/
119 
126  unsigned rowCount(bool lowerHalf) const;
127 
133  unsigned columnCount(V5CfgBlock::block_t block) const;
134 
142  unsigned frameCount(V5CfgBlock::block_t block, V5CfgColumn::column_t column) const;
143 
151  V5CfgColumn::column_t columnType(V5CfgBlock::block_t block, size_t columnIndex) const;
152 
153 
154  protected:
155 
161  unsigned countBRAMs(const V5CfgColumnSequence& columns) const;
162 
163 
164  private:
165 
166  friend bool operator== (const V5AddressLayout& al1, const V5AddressLayout& al2);
167 
168  friend void writeBinary(const V5AddressLayout& data, std::ostream& outputStream);
169  friend void readBinary(V5AddressLayout& data, std::istream& inputStream);
170 
171 
172  unsigned m_upperRowCount;
173  unsigned m_lowerRowCount;
174  V5CfgColumnSequence m_columns;
175  unsigned m_bramCount;
176 
177  };
178 
179 
181  inline bool operator== (const V5AddressLayout& al1, const V5AddressLayout& al2)
182  {
183  if (al1.m_upperRowCount != al2.m_upperRowCount) return false;
184  if (al1.m_lowerRowCount != al2.m_lowerRowCount) return false;
185  if (al1.m_bramCount != al2.m_bramCount) return false;
186  return al1.m_columns == al2.m_columns;
187  }
188 
190  inline bool operator!= (const V5AddressLayout& al1, const V5AddressLayout& al2)
191  {
192  return !(operator== (al1, al2));
193  }
194 
195 }
196 
197 #endif