esiaccel 0.1.5.dev66__cp39-cp39-win_amd64.whl → 0.1.5.dev450__cp39-cp39-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. esiaccel/CosimBackend.dll +0 -0
  2. esiaccel/CosimBackend.lib +0 -0
  3. esiaccel/ESICppRuntime.dll +0 -0
  4. esiaccel/ESICppRuntime.lib +0 -0
  5. esiaccel/EsiCosimDpiServer.dll +0 -0
  6. esiaccel/EsiCosimDpiServer.lib +0 -0
  7. esiaccel/MtiPli.dll +0 -0
  8. esiaccel/MtiPli.lib +0 -0
  9. esiaccel/__init__.py +22 -4
  10. esiaccel/abseil_dll.dll +0 -0
  11. esiaccel/accelerator.py +37 -5
  12. esiaccel/cares.dll +0 -0
  13. esiaccel/codegen.py +3 -3
  14. esiaccel/cosim/Cosim_Endpoint.sv +61 -32
  15. esiaccel/cosim/driver.cpp +6 -6
  16. esiaccel/cosim/driver.sv +14 -0
  17. esiaccel/cosim/questa.py +141 -0
  18. esiaccel/cosim/simulator.py +382 -0
  19. esiaccel/cosim/verilator.py +92 -0
  20. esiaccel/esi-cosim.py +3 -322
  21. esiaccel/esiCppAccel.cp39-win_amd64.pyd +0 -0
  22. esiaccel/esiquery.exe +0 -0
  23. esiaccel/include/esi/Accelerator.h +1 -14
  24. esiaccel/include/esi/CLI.h +5 -5
  25. esiaccel/include/esi/Common.h +17 -1
  26. esiaccel/include/esi/Context.h +17 -9
  27. esiaccel/include/esi/Manifest.h +0 -2
  28. esiaccel/include/esi/Services.h +60 -22
  29. esiaccel/include/esi/Types.h +107 -10
  30. esiaccel/include/esi/Values.h +313 -0
  31. esiaccel/libcrypto-3-x64.dll +0 -0
  32. esiaccel/libprotobuf.dll +0 -0
  33. esiaccel/libssl-3-x64.dll +0 -0
  34. esiaccel/re2.dll +0 -0
  35. esiaccel/types.py +13 -5
  36. esiaccel/utils.py +11 -1
  37. esiaccel/zlib1.dll +0 -0
  38. {esiaccel-0.1.5.dev66.dist-info → esiaccel-0.1.5.dev450.dist-info}/METADATA +1 -1
  39. esiaccel-0.1.5.dev450.dist-info/RECORD +54 -0
  40. esiaccel-0.1.5.dev66.dist-info/RECORD +0 -43
  41. {esiaccel-0.1.5.dev66.dist-info → esiaccel-0.1.5.dev450.dist-info}/WHEEL +0 -0
  42. {esiaccel-0.1.5.dev66.dist-info → esiaccel-0.1.5.dev450.dist-info}/entry_points.txt +0 -0
  43. {esiaccel-0.1.5.dev66.dist-info → esiaccel-0.1.5.dev450.dist-info}/licenses/LICENSE +0 -0
  44. {esiaccel-0.1.5.dev66.dist-info → esiaccel-0.1.5.dev450.dist-info}/top_level.txt +0 -0
@@ -16,11 +16,18 @@
16
16
  #ifndef ESI_TYPES_H
17
17
  #define ESI_TYPES_H
18
18
 
19
+ #include <algorithm>
20
+ #include <any>
19
21
  #include <cstdint>
20
22
  #include <map>
23
+ #include <span>
24
+ #include <stdexcept>
21
25
  #include <string>
22
26
  #include <vector>
23
27
 
28
+ #include "esi/Common.h"
29
+ #include "esi/Values.h" // For BitVector / Int / UInt
30
+
24
31
  namespace esi {
25
32
 
26
33
  /// Root class of the ESI type system.
@@ -33,6 +40,52 @@ public:
33
40
  ID getID() const { return id; }
34
41
  virtual std::ptrdiff_t getBitWidth() const { return -1; }
35
42
 
43
+ /// Serialize an object to a MutableBitVector (LSB-first stream). The object
44
+ /// should be passed via std::any. Implementations append fields in the order
45
+ /// they are iterated (the first serialized field occupies the
46
+ /// least-significant bits of the result).
47
+ virtual MutableBitVector serialize(const std::any &obj) const {
48
+ throw std::runtime_error("Serialization not implemented for type " + id);
49
+ }
50
+
51
+ /// Deserialize from a BitVector stream (LSB-first). Implementations consume
52
+ /// bits from 'data' in-place (via logical right shifts) and return the
53
+ /// reconstructed value. Remaining bits stay in 'data'.
54
+ virtual std::any deserialize(BitVector &data) const {
55
+ throw std::runtime_error("Deserialization not implemented for type " + id);
56
+ }
57
+
58
+ // Deserialize from a MessageData buffer. Maps the MessageData onto a
59
+ // MutableBitVector, and proceeds with regular MutableBitVector
60
+ // deserialization.
61
+ std::any deserialize(const MessageData &data) const {
62
+ auto bv = MutableBitVector(std::vector<uint8_t>(data.getData()));
63
+ return deserialize(bv);
64
+ }
65
+
66
+ /// Ensure that a std::any object is valid for this type. Throws
67
+ /// std::runtime_error if the object is not valid.
68
+ virtual void ensureValid(const std::any &obj) const {
69
+ throw std::runtime_error("Validation not implemented for type " + id);
70
+ }
71
+
72
+ // Check if a std::any object is valid for this type. Returns an optional
73
+ // error message if the object is not valid, else, std::nullopt.
74
+ std::optional<std::string> isValid(const std::any &obj) const {
75
+ try {
76
+ ensureValid(obj);
77
+ return std::nullopt;
78
+ } catch (const std::runtime_error &e) {
79
+ return e.what();
80
+ }
81
+ }
82
+
83
+ // Dump a textual representation of this type to the provided stream.
84
+ void dump(std::ostream &os);
85
+
86
+ // Return a textual representation of this type.
87
+ std::string toString();
88
+
36
89
  protected:
37
90
  ID id;
38
91
  };
@@ -54,12 +107,7 @@ public:
54
107
  const ChannelVector &getChannels() const { return channels; }
55
108
  std::ptrdiff_t getBitWidth() const override { return -1; };
56
109
 
57
- std::pair<const Type *, Direction> findChannel(std::string name) const {
58
- for (auto [channelName, dir, type] : channels)
59
- if (channelName == name)
60
- return std::make_pair(type, dir);
61
- throw std::runtime_error("Channel '" + name + "' not found in bundle");
62
- }
110
+ std::pair<const Type *, Direction> findChannel(std::string name) const;
63
111
 
64
112
  protected:
65
113
  ChannelVector channels;
@@ -69,10 +117,15 @@ protected:
69
117
  /// carry one values of one type.
70
118
  class ChannelType : public Type {
71
119
  public:
120
+ using Type::deserialize;
72
121
  ChannelType(const ID &id, const Type *inner) : Type(id), inner(inner) {}
73
122
  const Type *getInner() const { return inner; }
74
123
  std::ptrdiff_t getBitWidth() const override { return inner->getBitWidth(); };
75
124
 
125
+ void ensureValid(const std::any &obj) const override;
126
+ MutableBitVector serialize(const std::any &obj) const override;
127
+ std::any deserialize(BitVector &data) const override;
128
+
76
129
  private:
77
130
  const Type *inner;
78
131
  };
@@ -80,9 +133,14 @@ private:
80
133
  /// The "void" type is a special type which can be used to represent no type.
81
134
  class VoidType : public Type {
82
135
  public:
136
+ using Type::deserialize;
83
137
  VoidType(const ID &id) : Type(id) {}
84
138
  // 'void' is 1 bit by convention.
85
139
  std::ptrdiff_t getBitWidth() const override { return 1; };
140
+
141
+ void ensureValid(const std::any &obj) const override;
142
+ MutableBitVector serialize(const std::any &obj) const override;
143
+ std::any deserialize(BitVector &data) const override;
86
144
  };
87
145
 
88
146
  /// The "any" type is a special type which can be used to represent any type, as
@@ -112,6 +170,11 @@ private:
112
170
  class BitsType : public BitVectorType {
113
171
  public:
114
172
  using BitVectorType::BitVectorType;
173
+ using Type::deserialize;
174
+
175
+ void ensureValid(const std::any &obj) const override;
176
+ MutableBitVector serialize(const std::any &obj) const override;
177
+ std::any deserialize(BitVector &data) const override;
115
178
  };
116
179
 
117
180
  /// Integers are bit vectors which may be signed or unsigned and are interpreted
@@ -125,21 +188,32 @@ public:
125
188
  class SIntType : public IntegerType {
126
189
  public:
127
190
  using IntegerType::IntegerType;
191
+ using Type::deserialize;
192
+
193
+ void ensureValid(const std::any &obj) const override;
194
+ MutableBitVector serialize(const std::any &obj) const override;
195
+ std::any deserialize(BitVector &data) const override;
128
196
  };
129
197
 
130
198
  /// Unsigned integer.
131
199
  class UIntType : public IntegerType {
132
200
  public:
133
201
  using IntegerType::IntegerType;
202
+ using Type::deserialize;
203
+
204
+ void ensureValid(const std::any &obj) const override;
205
+ MutableBitVector serialize(const std::any &obj) const override;
206
+ std::any deserialize(BitVector &data) const override;
134
207
  };
135
208
 
136
209
  /// Structs are an ordered collection of fields, each with a name and a type.
137
210
  class StructType : public Type {
138
211
  public:
139
212
  using FieldVector = std::vector<std::pair<std::string, const Type *>>;
213
+ using Type::deserialize;
140
214
 
141
- StructType(const ID &id, const FieldVector &fields)
142
- : Type(id), fields(fields) {}
215
+ StructType(const ID &id, const FieldVector &fields, bool reverse = true)
216
+ : Type(id), fields(fields), reverse(reverse) {}
143
217
 
144
218
  const FieldVector &getFields() const { return fields; }
145
219
  std::ptrdiff_t getBitWidth() const override {
@@ -153,18 +227,33 @@ public:
153
227
  return size;
154
228
  }
155
229
 
230
+ void ensureValid(const std::any &obj) const override;
231
+ MutableBitVector serialize(const std::any &obj) const override;
232
+ std::any deserialize(BitVector &data) const override;
233
+
234
+ // Returns whether this struct type should be reversed when
235
+ // serializing/deserializing.
236
+ // By default, a truthy value here makes StructType's compatible with system
237
+ // verilog, which has reversed struct field ordering, wrt. C/software struct
238
+ // ordering.
239
+ bool isReverse() const { return reverse; }
240
+
156
241
  private:
157
242
  FieldVector fields;
243
+ bool reverse;
158
244
  };
159
245
 
160
246
  /// Arrays have a compile time specified (static) size and an element type.
161
247
  class ArrayType : public Type {
162
248
  public:
163
- ArrayType(const ID &id, const Type *elementType, uint64_t size)
164
- : Type(id), elementType(elementType), size(size) {}
249
+ ArrayType(const ID &id, const Type *elementType, uint64_t size,
250
+ bool reverse = true)
251
+ : Type(id), elementType(elementType), size(size), reverse(reverse) {}
252
+ using Type::deserialize;
165
253
 
166
254
  const Type *getElementType() const { return elementType; }
167
255
  uint64_t getSize() const { return size; }
256
+ bool isReverse() const { return reverse; }
168
257
  std::ptrdiff_t getBitWidth() const override {
169
258
  std::ptrdiff_t elementSize = elementType->getBitWidth();
170
259
  if (elementSize < 0)
@@ -172,9 +261,17 @@ public:
172
261
  return elementSize * size;
173
262
  }
174
263
 
264
+ void ensureValid(const std::any &obj) const override;
265
+ MutableBitVector serialize(const std::any &obj) const override;
266
+ std::any deserialize(BitVector &data) const override;
267
+
175
268
  private:
176
269
  const Type *elementType;
177
270
  uint64_t size;
271
+ // 'reverse' controls whether array elements are reversed during
272
+ // serialization/deserialization (to match SystemVerilog/Python ordering
273
+ // expectations).
274
+ bool reverse;
178
275
  };
179
276
 
180
277
  } // namespace esi
@@ -0,0 +1,313 @@
1
+ //===- values.h - ESI value system -------------------------------* C++ -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+ //
9
+ // ESI arbitrary width bitvector and integer types.
10
+ // These types are not meant to be highly optimized. Rather, its a simple
11
+ // implementation to support arbitrary bit widths for ESI runtime values.
12
+ //
13
+ //===----------------------------------------------------------------------===//
14
+ // DO NOT EDIT!
15
+ // This file is distributed as part of an ESI package. The source for this file
16
+ // should always be modified within CIRCT.
17
+ //
18
+ //===----------------------------------------------------------------------===//
19
+
20
+ // NOLINTNEXTLINE(llvm-header-guard)
21
+ #ifndef ESI_VALUES_H
22
+ #define ESI_VALUES_H
23
+
24
+ #include <cstdint>
25
+ #include <format>
26
+ #include <memory> // (may be removable later)
27
+ #include <optional>
28
+ #include <ostream>
29
+ #include <span>
30
+ #include <stdexcept>
31
+ #include <string>
32
+ #include <vector>
33
+
34
+ namespace esi {
35
+
36
+ class MutableBitVector;
37
+
38
+ /// A lightweight, non-owning bit vector view backed by a byte array span.
39
+ /// BitVector is immutable wrt. modifying the underlying bits, and provides
40
+ /// read-only access to bits. It supports bit-level access and returns new views
41
+ /// for operations.
42
+ class BitVector {
43
+ public:
44
+ using byte = uint8_t;
45
+
46
+ /// Construct from an existing span. Width defaults to the number of bits in
47
+ /// the span (size * 8). The BitVector does not take ownership.
48
+ BitVector(std::span<const byte> bytes,
49
+ std::optional<size_t> width = std::nullopt, uint8_t bitIndex = 0);
50
+ BitVector() = default;
51
+ BitVector(const BitVector &other);
52
+ BitVector &operator=(const BitVector &other);
53
+
54
+ size_t width() const { return bitWidth; }
55
+ size_t size() const { return width(); }
56
+
57
+ /// Return the i-th bit (0 = LSB) as boolean.
58
+ bool getBit(size_t i) const;
59
+
60
+ /// Return a handle to the underlying span. Throws if the current bit index
61
+ /// is not 0 (since a non-zero bit offset breaks raw byte alignment).
62
+ std::span<const byte> getSpan() const {
63
+ if (bitIndex != 0)
64
+ throw std::runtime_error("Cannot get data span with non-zero bit index");
65
+ return data;
66
+ }
67
+
68
+ /// Logical right shift that drops the least-significant n bits by advancing
69
+ /// the byte/bit index and reducing width. Returns a new immutable
70
+ /// view. Does not modify the underlying storage contents.
71
+ BitVector operator>>(size_t n) const;
72
+ BitVector &operator>>=(size_t n);
73
+
74
+ /// Create a new immutable view of a contiguous bit slice [offset,
75
+ /// offset+sliceWidth). The returned BitVector is a view (not an owning copy)
76
+ /// into the same underlying span. Throws if the requested slice exceeds the
77
+ /// current width.
78
+ BitVector slice(size_t offset, size_t sliceWidth) const;
79
+
80
+ /// Return a view of the N least-significant bits.
81
+ BitVector lsb(size_t n) const { return slice(0, n); }
82
+
83
+ /// Return a view of the N most-significant bits.
84
+ BitVector msb(size_t n) const {
85
+ if (n > bitWidth)
86
+ throw std::invalid_argument("msb width exceeds bit width");
87
+ return slice(bitWidth - n, n);
88
+ }
89
+
90
+ std::string toString(unsigned base = 16) const;
91
+
92
+ bool operator==(const BitVector &rhs) const;
93
+ bool operator!=(const BitVector &rhs) const { return !(*this == rhs); }
94
+
95
+ /// Bitwise AND: creates a new MutableBitVector with the result.
96
+ friend MutableBitVector operator&(const BitVector &a, const BitVector &b);
97
+
98
+ /// Bitwise OR: creates a new MutableBitVector with the result.
99
+ friend MutableBitVector operator|(const BitVector &a, const BitVector &b);
100
+
101
+ /// Bitwise XOR: creates a new MutableBitVector with the result.
102
+ friend MutableBitVector operator^(const BitVector &a, const BitVector &b);
103
+
104
+ /// Forward iterator for iterating over bits from LSB (index 0) to MSB.
105
+ class bit_iterator {
106
+ public:
107
+ using difference_type = std::ptrdiff_t;
108
+ using value_type = bool;
109
+ using pointer = const bool *;
110
+ using reference = bool;
111
+ using iterator_category = std::forward_iterator_tag;
112
+
113
+ /// Default constructor.
114
+ bit_iterator() = default;
115
+
116
+ /// Construct an iterator at the given bit position.
117
+ bit_iterator(const BitVector *bv, size_t pos = 0)
118
+ : bitVector(bv), position(pos) {}
119
+
120
+ /// Dereference: returns the bit value at the current position.
121
+ bool operator*() const {
122
+ if (bitVector == nullptr || position >= bitVector->bitWidth)
123
+ throw std::out_of_range("bit_iterator dereference out of range");
124
+ return bitVector->getBit(position);
125
+ }
126
+
127
+ /// Pre-increment: move to next bit.
128
+ bit_iterator &operator++() {
129
+ ++position;
130
+ return *this;
131
+ }
132
+
133
+ /// Post-increment: move to next bit.
134
+ bit_iterator operator++(int) {
135
+ bit_iterator tmp = *this;
136
+ ++position;
137
+ return tmp;
138
+ }
139
+
140
+ /// Equality comparison.
141
+ bool operator==(const bit_iterator &other) const {
142
+ return bitVector == other.bitVector && position == other.position;
143
+ }
144
+
145
+ /// Inequality comparison.
146
+ bool operator!=(const bit_iterator &other) const {
147
+ return !(*this == other);
148
+ }
149
+
150
+ /// Less-than comparison (for ranges support).
151
+ bool operator<(const bit_iterator &other) const {
152
+ return bitVector == other.bitVector && position < other.position;
153
+ }
154
+
155
+ /// Sentinel-compatible equality (for ranges support).
156
+ bool operator==(std::default_sentinel_t) const {
157
+ return bitVector == nullptr || position >= bitVector->bitWidth;
158
+ }
159
+
160
+ /// Sentinel-compatible inequality.
161
+ bool operator!=(std::default_sentinel_t sent) const {
162
+ return !(*this == sent);
163
+ }
164
+
165
+ private:
166
+ const BitVector *bitVector = nullptr;
167
+ size_t position = 0;
168
+ };
169
+
170
+ /// Return an iterator to the first bit (LSB).
171
+ bit_iterator begin() const { return bit_iterator(this, 0); }
172
+
173
+ /// Return an iterator past the last bit.
174
+ bit_iterator end() const { return bit_iterator(this, bitWidth); }
175
+
176
+ protected:
177
+ // Underlying storage view. const, to allow for non-owning immutable views.
178
+ std::span<const byte> data{};
179
+ size_t bitWidth = 0; // Number of valid bits.
180
+ uint8_t bitIndex = 0; // Starting bit offset in first byte.
181
+ };
182
+
183
+ /// A mutable bit vector that owns its underlying storage.
184
+ /// It supports in-place modifications and mutable operations.
185
+ class MutableBitVector : public BitVector {
186
+ public:
187
+ /// Owning, zero-initialized constructor of a given width.
188
+ explicit MutableBitVector(size_t width);
189
+
190
+ /// Owning constructor from an rvalue vector (must move in).
191
+ MutableBitVector(std::vector<byte> &&bytes,
192
+ std::optional<size_t> width = std::nullopt);
193
+
194
+ MutableBitVector() = default;
195
+
196
+ // Copy constructor: duplicate storage.
197
+ MutableBitVector(const MutableBitVector &other);
198
+
199
+ // Copy constructor from immutable BitVector: creates owning copy.
200
+ MutableBitVector(const BitVector &other);
201
+
202
+ // Move constructor: transfer ownership.
203
+ MutableBitVector(MutableBitVector &&other) noexcept;
204
+
205
+ // Move constructor from immutable BitVector: creates owning copy.
206
+ MutableBitVector(BitVector &&other);
207
+
208
+ MutableBitVector &operator=(const MutableBitVector &other);
209
+
210
+ MutableBitVector &operator=(MutableBitVector &&other) noexcept;
211
+
212
+ /// Set the i-th bit.
213
+ void setBit(size_t i, bool v);
214
+
215
+ /// Return a handle to the underlying span (always aligned since bitIndex=0).
216
+ std::span<const byte> getSpan() const { return data; }
217
+
218
+ /// Return and transfer ownership of the underlying storage.
219
+ std::vector<uint8_t> takeStorage() { return std::move(owner); }
220
+
221
+ /// In-place logical right shift that drops the least-significant n bits.
222
+ /// Reduces width and updates internal state. Does not modify underlying
223
+ /// storage.
224
+ MutableBitVector &operator>>=(size_t n);
225
+
226
+ /// In-place logical left shift shifts in n zero bits at LSB, shifting
227
+ /// existing bits upward.
228
+ MutableBitVector &operator<<=(size_t n);
229
+
230
+ /// In-place concatenate: appends bits from other to this.
231
+ MutableBitVector &operator<<=(const MutableBitVector &other);
232
+
233
+ MutableBitVector &operator|=(const MutableBitVector &other);
234
+ MutableBitVector &operator&=(const MutableBitVector &other);
235
+ MutableBitVector &operator^=(const MutableBitVector &other);
236
+ MutableBitVector operator~() const;
237
+ MutableBitVector operator|(const MutableBitVector &other) const;
238
+ MutableBitVector operator&(const MutableBitVector &other) const;
239
+ MutableBitVector operator^(const MutableBitVector &other) const;
240
+
241
+ private:
242
+ // Storage owned by this MutableBitVector.
243
+ std::vector<byte> owner;
244
+ };
245
+
246
+ std::ostream &operator<<(std::ostream &os, const BitVector &bv);
247
+
248
+ // Arbitrary width signed integer type built on MutableBitVector.
249
+ class Int : public MutableBitVector {
250
+ public:
251
+ using MutableBitVector::MutableBitVector;
252
+ Int() = default;
253
+ Int(int64_t v, unsigned width = 64);
254
+ operator int64_t() const { return toI64(); }
255
+ operator int32_t() const { return toInt<int32_t>(); }
256
+ operator int16_t() const { return toInt<int16_t>(); }
257
+ operator int8_t() const { return toInt<int8_t>(); }
258
+
259
+ private:
260
+ template <typename T>
261
+ T toInt() const {
262
+ static_assert(std::is_integral<T>::value && std::is_signed<T>::value,
263
+ "T must be a signed integral type");
264
+ int64_t v = toI64();
265
+ fits(v, sizeof(T) * 8);
266
+ return static_cast<T>(v);
267
+ }
268
+
269
+ // Convert the bitvector to a signed intN_t, throwing if the value doesn't
270
+ // fit.
271
+ int64_t toI64() const;
272
+
273
+ // Check if the given value fits in the specified bit width.
274
+ static void fits(int64_t v, unsigned n);
275
+ };
276
+
277
+ // Arbitrary width unsigned integer type built on MutableBitVector.
278
+ class UInt : public MutableBitVector {
279
+ public:
280
+ using MutableBitVector::MutableBitVector;
281
+ UInt() = default;
282
+ UInt(uint64_t v, unsigned width = 64);
283
+ operator uint64_t() const { return toUI64(); }
284
+ operator uint32_t() const { return toUInt<uint32_t>(); }
285
+ operator uint16_t() const { return toUInt<uint16_t>(); }
286
+ operator uint8_t() const { return toUInt<uint8_t>(); }
287
+
288
+ private:
289
+ uint64_t toUI64() const;
290
+
291
+ static void fits(uint64_t v, unsigned n);
292
+
293
+ template <typename T>
294
+ T toUInt() const {
295
+ static_assert(std::is_integral<T>::value && std::is_unsigned<T>::value,
296
+ "T must be an unsigned integral type");
297
+ uint64_t v = toUI64();
298
+ fits(v, sizeof(T) * 8);
299
+ return static_cast<T>(v);
300
+ }
301
+ };
302
+
303
+ } // namespace esi
304
+
305
+ // Enable BitVector and MutableBitVector to work with std::ranges algorithms
306
+ template <>
307
+ inline constexpr bool std::ranges::enable_borrowed_range<esi::BitVector> = true;
308
+
309
+ template <>
310
+ inline constexpr bool
311
+ std::ranges::enable_borrowed_range<esi::MutableBitVector> = true;
312
+
313
+ #endif // ESI_VALUES_H
Binary file
Binary file
Binary file
esiaccel/re2.dll ADDED
Binary file
esiaccel/types.py CHANGED
@@ -245,6 +245,8 @@ class StructType(ESIType):
245
245
  def is_valid(self, obj) -> Tuple[bool, Optional[str]]:
246
246
  fields_count = 0
247
247
  if not isinstance(obj, dict):
248
+ if not hasattr(obj, "__dict__"):
249
+ return (False, "must be a dict or have __dict__ attribute")
248
250
  obj = obj.__dict__
249
251
 
250
252
  for (fname, ftype) in self.fields:
@@ -260,14 +262,20 @@ class StructType(ESIType):
260
262
 
261
263
  def serialize(self, obj) -> bytearray:
262
264
  ret = bytearray()
263
- for (fname, ftype) in reversed(self.fields):
265
+ if not isinstance(obj, dict):
266
+ obj = obj.__dict__
267
+ ordered_fields = reversed(
268
+ self.fields) if self.cpp_type.reverse else self.fields
269
+ for (fname, ftype) in ordered_fields:
264
270
  fval = obj[fname]
265
271
  ret.extend(ftype.serialize(fval))
266
272
  return ret
267
273
 
268
274
  def deserialize(self, data: bytearray) -> Tuple[Dict[str, Any], bytearray]:
269
275
  ret = {}
270
- for (fname, ftype) in reversed(self.fields):
276
+ ordered_fields = reversed(
277
+ self.fields) if self.cpp_type.reverse else self.fields
278
+ for (fname, ftype) in ordered_fields:
271
279
  (fval, data) = ftype.deserialize(data)
272
280
  ret[fname] = fval
273
281
  return (ret, data)
@@ -400,8 +408,8 @@ class BundlePort:
400
408
  return super().__new__(CallbackPort)
401
409
  if isinstance(cpp_port, cpp.MMIORegion):
402
410
  return super().__new__(MMIORegion)
403
- if isinstance(cpp_port, cpp.Telemetry):
404
- return super().__new__(TelemetryPort)
411
+ if isinstance(cpp_port, cpp.Metric):
412
+ return super().__new__(MetricPort)
405
413
  return super().__new__(cls)
406
414
 
407
415
  def __init__(self, owner: HWModule, cpp_port: cpp.BundlePort):
@@ -537,7 +545,7 @@ class CallbackPort(BundlePort):
537
545
  self.connected = True
538
546
 
539
547
 
540
- class TelemetryPort(BundlePort):
548
+ class MetricPort(BundlePort):
541
549
  """Telemetry ports report an individual piece of information from the
542
550
  acceelerator. The method of accessing telemetry will likely change in the
543
551
  future."""
esiaccel/utils.py CHANGED
@@ -40,5 +40,15 @@ def run_cppgen():
40
40
  return codegen.run()
41
41
 
42
42
 
43
- def get_cmake_dir():
43
+ def get_cmake_dir() -> Path:
44
44
  return _thisdir / "cmake"
45
+
46
+
47
+ def get_dll_dir() -> Path:
48
+ """Return the directory where the ESI dll's are located"""
49
+ import sys
50
+ import os
51
+ if sys.platform == "win32":
52
+ return _thisdir
53
+ else:
54
+ return _thisdir / "lib"
esiaccel/zlib1.dll ADDED
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: esiaccel
3
- Version: 0.1.5.dev66
3
+ Version: 0.1.5.dev450
4
4
  Summary: ESI accelerators runtime
5
5
  Author-email: John Demme <John.Demme@microsoft.com>
6
6
  License: ==============================================================================
@@ -0,0 +1,54 @@
1
+ esiaccel/CosimBackend.dll,sha256=4fO1qyHMp9kA-tmUIyucRHAdJvSfU7WUtrL42HUTNlg,7190016
2
+ esiaccel/CosimBackend.lib,sha256=irceROhM9oK4xu-X5-asnfJAPaYHTQYwYIwufUEbCcc,4903722
3
+ esiaccel/ESICppRuntime.dll,sha256=TWcitc9eyKimY2eAp4scRrTQTq4e3Ks_PqmF1doEC4g,4341248
4
+ esiaccel/ESICppRuntime.lib,sha256=NXo4I7OomlmlWdA8oXSH99jyClvRSIGfKIc6cn_DCrc,16030020
5
+ esiaccel/EsiCosimDpiServer.dll,sha256=zA2GBxScjk0p1_OmK39EiGX8FfIwCPuMxYON_0tHexc,160768
6
+ esiaccel/EsiCosimDpiServer.lib,sha256=xMj0Uiih7BfmPUCe5NrAK8gEAqoi0ITH7P4Fp0IvaHo,606000
7
+ esiaccel/MtiPli.dll,sha256=BY6Db5ck2_XZxfZ9GkXUdOuu1HfkG0-X_2cU5yszh48,14848
8
+ esiaccel/MtiPli.lib,sha256=FFIpVSxcH4VGNnMeZXAHcYQxTCBAeElN3YXLk1yrSTM,14570
9
+ esiaccel/__init__.py,sha256=kQGIPdInC-YoumE8uVqmfAckqcTGmCnMJGtWZzCc2lE,1270
10
+ esiaccel/abseil_dll.dll,sha256=XDG6iyA-_QvpR4KiU0EuawlPj9SwWaT1gFKUbUEc9-s,1584640
11
+ esiaccel/accelerator.py,sha256=wv1EXaRZlXtyHeBA-_uKycBjn-lVxj83AYeIVlutVRs,4466
12
+ esiaccel/cares.dll,sha256=iDlRWuwPeF3q5a7DAycDQagoUVvirlpV_BTdifq80p0,199168
13
+ esiaccel/codegen.py,sha256=QaBNVwcsCyYWmhEesQsXp72rV-8dVC9G33K4YR6PxRo,6577
14
+ esiaccel/esi-cosim.py,sha256=P7n3SBgKPnXynwghY5zK1FmpqZkbC_YxfVIvNNQNl6Q,3817
15
+ esiaccel/esiCppAccel.cp39-win_amd64.pyd,sha256=xAkOKsMdw0NvhqdKw_SMskt8g_6t5UuuZfdHSPqKmVE,544768
16
+ esiaccel/esiquery.exe,sha256=dr7IoMGpu6PSdz7AW2VT5bgrTu1EAFnxGrUWnz8qv7M,474624
17
+ esiaccel/libcrypto-3-x64.dll,sha256=iZL17pV_T-E826IE4xXqKvZqL743t6paXSlY7_MlU6k,5327872
18
+ esiaccel/libprotobuf.dll,sha256=cXpjnkRWT9FkOzaPuwB8Qp-55c8PeLsQmMbQj_U9zp0,12566528
19
+ esiaccel/libssl-3-x64.dll,sha256=36lMfBAJ0UHFrcKlNjaJpSO2Xp8qBjbVkVUIaqeXOHc,871424
20
+ esiaccel/re2.dll,sha256=WGpOIrLIkIzstyTImCTJuRIJ48c76pZAd-UU_hWROY8,1213952
21
+ esiaccel/types.py,sha256=ps9c4IU2ITbyeCcI4a64BDEjMuNTzchQuH0Bdhx2LG0,19035
22
+ esiaccel/utils.py,sha256=q-8fmgJ9tUvmBsIvqZiZ7u845IJhOjvjYTQLhhrNYl0,1515
23
+ esiaccel/zlib1.dll,sha256=AGw-KcUg5gLhevgwpsq74mmDClKwobyjU8gjCgYCdPA,90112
24
+ esiaccel/cmake/esiaccelConfig.cmake,sha256=u2aW99k1lEcmYTG1P3BTJqtmDrj53wUUaBz_jzw8kYY,565
25
+ esiaccel/cosim/Cosim_DpiPkg.sv,sha256=9qGn1VyAVrzBP5At1thV6xrovg0WghICD01Zz9J221E,3458
26
+ esiaccel/cosim/Cosim_Endpoint.sv,sha256=-XXrGvvk6hdiZ-Ex6_QtdKXXUwKJLKSvpTUK3o0gPZ8,7589
27
+ esiaccel/cosim/Cosim_Manifest.sv,sha256=vl9b6XieEkP880IBw1ferekBnDJwFanZZggJJGertXM,1123
28
+ esiaccel/cosim/driver.cpp,sha256=Lvmo03pzzhoswdxAtdXAm-oU6UkfTyl1LgoCpyDzLhY,3842
29
+ esiaccel/cosim/driver.sv,sha256=LAkFEXTwX3KKwZLSzYZFwMPWxZwVStuhUsfecHHpGzU,1890
30
+ esiaccel/cosim/questa.py,sha256=2xALwRzsOFZ1_xk3f2d849GMvGspNCK4XL8zVDBjXlA,4626
31
+ esiaccel/cosim/simulator.py,sha256=HpkvKPbpyqalRp8poRYU3E0taYxTRmxcmBEJ7YOecx4,13941
32
+ esiaccel/cosim/verilator.py,sha256=dwiEkKOem5OKPV9AK6O1ohr22MTsyDxBVnriDRFoVa8,2877
33
+ esiaccel/include/esi/Accelerator.h,sha256=vDh-Qy6Lzk-c-wL6MVABoKiLWN2uuqh4RY-JDHez1uw,8974
34
+ esiaccel/include/esi/CLI.h,sha256=LLLWpvE7JDuwNyuCSjLj3sGsAh1BenOh1W7MbhAf3WQ,2619
35
+ esiaccel/include/esi/Common.h,sha256=7bXy9bRt4C7oeO6SBm8BneujbL17fbPM6K7YMqazvLE,6155
36
+ esiaccel/include/esi/Context.h,sha256=Bd698megdjlsmGsKQjsw3JE9vTuKLQjIrn-DrWRpkFw,2686
37
+ esiaccel/include/esi/Design.h,sha256=mU8OwpCYijiWSdDq17l45LMzZxBca93nosudWCXNHfQ,4922
38
+ esiaccel/include/esi/Engines.h,sha256=bbGbhXjYMpIpXh_DR0OS57zyGQUIDXh_S7xHX3su0Y0,4831
39
+ esiaccel/include/esi/Logging.h,sha256=sHqMcpp0lNIHkIEyvSm-BBWx4zXXh6NOATCgZpgzYI4,8944
40
+ esiaccel/include/esi/Manifest.h,sha256=ZdIu_vXXLS4bwOoISFo-sFjzvB9x5ddYmNmaknyF0ds,2110
41
+ esiaccel/include/esi/Ports.h,sha256=T2WbPBViUSvFbO5Jjxlcp_eGq9jMitguvNnz3O0564U,10543
42
+ esiaccel/include/esi/Services.h,sha256=au4agwnlyZD4vYZdawGlnAZxocnNN-PCv3WoeD0qtOs,16216
43
+ esiaccel/include/esi/Types.h,sha256=zskmb2_Z3EmWQlPc56tOYBulTxsmiTdD9fd2w7ifaGw,9486
44
+ esiaccel/include/esi/Utils.h,sha256=KPd75GajIFeTBVJocXBjwsJqhbZg-ShWZCIe3oQdBss,3061
45
+ esiaccel/include/esi/Values.h,sha256=1xXxNV2oUr84At3Y7aXBqbiPZxyJXeUbhycl0O0fUtk,11074
46
+ esiaccel/include/esi/backends/Cosim.h,sha256=s7vYd0ra6m1nvk-n37MjvBoGVI-CCUKBt0DU4PKlaHM,2838
47
+ esiaccel/include/esi/backends/RpcServer.h,sha256=WMwnhwU2qnrcglGNeiKg9QQHpkDx1QE1JydKYDK4jqE,1856
48
+ esiaccel/include/esi/backends/Trace.h,sha256=kx4wwLH3a0ndmRUdaDyYGZ1SP83zlpFrk30Nw8ZrJJA,3286
49
+ esiaccel-0.1.5.dev450.dist-info/licenses/LICENSE,sha256=vtnVnB8_lN1yPYcA5MeT56R8UsQtBhyzZLBvu_KMf7I,13468
50
+ esiaccel-0.1.5.dev450.dist-info/METADATA,sha256=8uk7_-3T1okK-VZDxDWx210EqSGypw73LJXROfde_SY,16148
51
+ esiaccel-0.1.5.dev450.dist-info/WHEEL,sha256=XkFE14KmFh7mutkkb-qn_ueuH2lwfT8rLdfc5xpQ7wE,99
52
+ esiaccel-0.1.5.dev450.dist-info/entry_points.txt,sha256=_CuNLV0fyTURxRREFwpzGycifZW_-7-MyuJNEwKK9J8,137
53
+ esiaccel-0.1.5.dev450.dist-info/top_level.txt,sha256=fYWTWMDK4PDu4ePQ9NtcFHas2k8-d1kWhTs2avPpgB4,9
54
+ esiaccel-0.1.5.dev450.dist-info/RECORD,,