yowasp-yosys 0.48.0.0.post834__py3-none-any.whl → 0.50.0.0.post858__py3-none-any.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 (24) hide show
  1. yowasp_yosys/share/include/frontends/ast/ast.h +1 -1
  2. yowasp_yosys/share/include/kernel/bitpattern.h +6 -5
  3. yowasp_yosys/share/include/kernel/cellaigs.h +2 -2
  4. yowasp_yosys/share/include/kernel/consteval.h +0 -3
  5. yowasp_yosys/share/include/kernel/drivertools.h +147 -97
  6. yowasp_yosys/share/include/kernel/hashlib.h +258 -152
  7. yowasp_yosys/share/include/kernel/log.h +6 -6
  8. yowasp_yosys/share/include/kernel/macc.h +6 -26
  9. yowasp_yosys/share/include/kernel/modtools.h +12 -5
  10. yowasp_yosys/share/include/kernel/rtlil.h +339 -286
  11. yowasp_yosys/share/include/kernel/scopeinfo.h +18 -8
  12. yowasp_yosys/share/include/kernel/sigtools.h +10 -2
  13. yowasp_yosys/share/include/kernel/timinginfo.h +10 -2
  14. yowasp_yosys/share/include/kernel/utils.h +6 -6
  15. yowasp_yosys/share/include/kernel/yosys_common.h +14 -20
  16. yowasp_yosys/share/include/kernel/yw.h +4 -1
  17. yowasp_yosys/share/python3/smtio.py +1 -1
  18. yowasp_yosys/share/quicklogic/qlf_k6n10f/bram_types_sim.v +1 -1
  19. yowasp_yosys/yosys.wasm +0 -0
  20. {yowasp_yosys-0.48.0.0.post834.dist-info → yowasp_yosys-0.50.0.0.post858.dist-info}/METADATA +1 -1
  21. {yowasp_yosys-0.48.0.0.post834.dist-info → yowasp_yosys-0.50.0.0.post858.dist-info}/RECORD +24 -24
  22. {yowasp_yosys-0.48.0.0.post834.dist-info → yowasp_yosys-0.50.0.0.post858.dist-info}/WHEEL +0 -0
  23. {yowasp_yosys-0.48.0.0.post834.dist-info → yowasp_yosys-0.50.0.0.post858.dist-info}/entry_points.txt +0 -0
  24. {yowasp_yosys-0.48.0.0.post834.dist-info → yowasp_yosys-0.50.0.0.post858.dist-info}/top_level.txt +0 -0
@@ -177,7 +177,7 @@ namespace AST
177
177
  {
178
178
  // for dict<> and pool<>
179
179
  unsigned int hashidx_;
180
- unsigned int hash() const { return hashidx_; }
180
+ [[nodiscard]] Hasher hash_into(Hasher h) const { h.eat(hashidx_); return h; }
181
181
 
182
182
  // this nodes type
183
183
  AstNodeType type;
@@ -30,7 +30,7 @@ struct BitPatternPool
30
30
  int width;
31
31
  struct bits_t {
32
32
  std::vector<RTLIL::State> bitdata;
33
- mutable unsigned int cached_hash;
33
+ mutable Hasher::hash_t cached_hash;
34
34
  bits_t(int width = 0) : bitdata(width), cached_hash(0) { }
35
35
  RTLIL::State &operator[](int index) {
36
36
  return bitdata[index];
@@ -39,14 +39,15 @@ struct BitPatternPool
39
39
  return bitdata[index];
40
40
  }
41
41
  bool operator==(const bits_t &other) const {
42
- if (hash() != other.hash())
42
+ if (run_hash(*this) != run_hash(other))
43
43
  return false;
44
44
  return bitdata == other.bitdata;
45
45
  }
46
- unsigned int hash() const {
46
+ [[nodiscard]] Hasher hash_into(Hasher h) const {
47
47
  if (!cached_hash)
48
- cached_hash = hash_ops<std::vector<RTLIL::State>>::hash(bitdata);
49
- return cached_hash;
48
+ cached_hash = run_hash(bitdata);
49
+ h.eat(cached_hash);
50
+ return h;
50
51
  }
51
52
  };
52
53
  pool<bits_t> database;
@@ -34,7 +34,7 @@ struct AigNode
34
34
 
35
35
  AigNode();
36
36
  bool operator==(const AigNode &other) const;
37
- unsigned int hash() const;
37
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
38
38
  };
39
39
 
40
40
  struct Aig
@@ -44,7 +44,7 @@ struct Aig
44
44
  Aig(Cell *cell);
45
45
 
46
46
  bool operator==(const Aig &other) const;
47
- unsigned int hash() const;
47
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
48
48
  };
49
49
 
50
50
  YOSYS_NAMESPACE_END
@@ -315,9 +315,6 @@ struct ConstEval
315
315
  Macc macc;
316
316
  macc.from_cell(cell);
317
317
 
318
- if (!eval(macc.bit_ports, undef, cell))
319
- return false;
320
-
321
318
  for (auto &port : macc.ports) {
322
319
  if (!eval(port.in_a, undef, cell))
323
320
  return false;
@@ -74,10 +74,8 @@ struct DriveBitWire
74
74
  return offset < other.offset;
75
75
  }
76
76
 
77
- unsigned int hash() const
78
- {
79
- return mkhash_add(wire->name.hash(), offset);
80
- }
77
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
78
+
81
79
 
82
80
  operator SigBit() const
83
81
  {
@@ -107,10 +105,8 @@ struct DriveBitPort
107
105
  return offset < other.offset;
108
106
  }
109
107
 
110
- unsigned int hash() const
111
- {
112
- return mkhash_add(mkhash(cell->name.hash(), port.hash()), offset);
113
- }
108
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
109
+
114
110
  };
115
111
 
116
112
 
@@ -133,10 +129,7 @@ struct DriveBitMarker
133
129
  return offset < other.offset;
134
130
  }
135
131
 
136
- unsigned int hash() const
137
- {
138
- return mkhash_add(marker, offset);
139
- }
132
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
140
133
 
141
134
  };
142
135
 
@@ -171,10 +164,7 @@ public:
171
164
  return multiple_ == other.multiple_;
172
165
  }
173
166
 
174
- unsigned int hash() const
175
- {
176
- return multiple_.hash();
177
- }
167
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
178
168
  };
179
169
 
180
170
  struct DriveBit
@@ -362,35 +352,7 @@ public:
362
352
  return *this;
363
353
  }
364
354
 
365
- unsigned int hash() const
366
- {
367
- unsigned int inner = 0;
368
- switch (type_)
369
- {
370
- case DriveType::NONE:
371
- inner = 0;
372
- break;
373
- case DriveType::CONSTANT:
374
- inner = constant_;
375
- break;
376
- case DriveType::WIRE:
377
- inner = wire_.hash();
378
- break;
379
- case DriveType::PORT:
380
- inner = port_.hash();
381
- break;
382
- case DriveType::MARKER:
383
- inner = marker_.hash();
384
- break;
385
- case DriveType::MULTIPLE:
386
- inner = multiple_.hash();
387
- break;
388
- default:
389
- log_abort();
390
- break;
391
- }
392
- return mkhash((unsigned int)type_, inner);
393
- }
355
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
394
356
 
395
357
  bool operator==(const DriveBit &other) const
396
358
  {
@@ -511,10 +473,7 @@ struct DriveChunkWire
511
473
  return offset < other.offset;
512
474
  }
513
475
 
514
- unsigned int hash() const
515
- {
516
- return mkhash_add(mkhash(wire->name.hash(), width), offset);
517
- }
476
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
518
477
 
519
478
  explicit operator SigChunk() const
520
479
  {
@@ -572,10 +531,7 @@ struct DriveChunkPort
572
531
  return offset < other.offset;
573
532
  }
574
533
 
575
- unsigned int hash() const
576
- {
577
- return mkhash_add(mkhash(mkhash(cell->name.hash(), port.hash()), width), offset);
578
- }
534
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
579
535
  };
580
536
 
581
537
 
@@ -616,10 +572,7 @@ struct DriveChunkMarker
616
572
  return offset < other.offset;
617
573
  }
618
574
 
619
- unsigned int hash() const
620
- {
621
- return mkhash_add(mkhash(marker, width), offset);
622
- }
575
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
623
576
  };
624
577
 
625
578
  struct DriveChunkMultiple
@@ -659,10 +612,7 @@ public:
659
612
  return false; // TODO implement, canonicalize order
660
613
  }
661
614
 
662
- unsigned int hash() const
663
- {
664
- return mkhash(width_, multiple_.hash());
665
- }
615
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
666
616
  };
667
617
 
668
618
  struct DriveChunk
@@ -913,35 +863,7 @@ public:
913
863
  bool try_append(DriveBit const &bit);
914
864
  bool try_append(DriveChunk const &chunk);
915
865
 
916
- unsigned int hash() const
917
- {
918
- unsigned int inner = 0;
919
- switch (type_)
920
- {
921
- case DriveType::NONE:
922
- inner = 0;
923
- break;
924
- case DriveType::CONSTANT:
925
- inner = constant_.hash();
926
- break;
927
- case DriveType::WIRE:
928
- inner = wire_.hash();
929
- break;
930
- case DriveType::PORT:
931
- inner = port_.hash();
932
- break;
933
- case DriveType::MARKER:
934
- inner = marker_.hash();
935
- break;
936
- case DriveType::MULTIPLE:
937
- inner = multiple_.hash();
938
- break;
939
- default:
940
- log_abort();
941
- break;
942
- }
943
- return mkhash((unsigned int)type_, inner);
944
- }
866
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
945
867
 
946
868
  bool operator==(const DriveChunk &other) const
947
869
  {
@@ -1144,17 +1066,20 @@ public:
1144
1066
  DriveSpec &operator=(DriveBitMarker const &bit) { return *this = DriveBit(bit); }
1145
1067
  DriveSpec &operator=(DriveBitMultiple const &bit) { return *this = DriveBit(bit); }
1146
1068
 
1147
- unsigned int hash() const {
1148
- if (hash_ != 0) return hash_;
1149
-
1069
+ void updhash() const {
1070
+ if (hash_ != 0)
1071
+ return;
1150
1072
  pack();
1151
- hash_ = hash_ops<std::vector<DriveChunk>>().hash(chunks_);
1073
+ hash_ = run_hash(chunks_);
1152
1074
  hash_ |= (hash_ == 0);
1153
- return hash_;
1154
1075
  }
1155
1076
 
1077
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
1078
+
1156
1079
  bool operator==(DriveSpec const &other) const {
1157
- if (size() != other.size() || hash() != other.hash())
1080
+ updhash();
1081
+ other.updhash();
1082
+ if (size() != other.size() || hash_ != other.hash_)
1158
1083
  return false;
1159
1084
  return chunks() == other.chunks();
1160
1085
  }
@@ -1187,7 +1112,7 @@ private:
1187
1112
  bool operator==(const DriveBitId &other) const { return id == other.id; }
1188
1113
  bool operator!=(const DriveBitId &other) const { return id != other.id; }
1189
1114
  bool operator<(const DriveBitId &other) const { return id < other.id; }
1190
- unsigned int hash() const { return id; }
1115
+ [[nodiscard]] Hasher hash_into(Hasher h) const;
1191
1116
  };
1192
1117
  // Essentially a dict<DriveBitId, pool<DriveBitId>> but using less memory
1193
1118
  // and fewer allocations
@@ -1333,6 +1258,131 @@ private:
1333
1258
  }
1334
1259
  };
1335
1260
 
1261
+ inline Hasher DriveBitWire::hash_into(Hasher h) const
1262
+ {
1263
+ h.eat(wire->name);
1264
+ h.eat(offset);
1265
+ return h;
1266
+ }
1267
+
1268
+ inline Hasher DriveBitPort::hash_into(Hasher h) const
1269
+ {
1270
+ h.eat(cell->name);
1271
+ h.eat(port);
1272
+ h.eat(offset);
1273
+ return h;
1274
+ }
1275
+
1276
+ inline Hasher DriveBitMarker::hash_into(Hasher h) const
1277
+ {
1278
+ h.eat(marker);
1279
+ h.eat(offset);
1280
+ return h;
1281
+ }
1282
+
1283
+ inline Hasher DriveBitMultiple::hash_into(Hasher h) const
1284
+ {
1285
+ h.eat(multiple_);
1286
+ return h;
1287
+ }
1288
+
1289
+ inline Hasher DriveBit::hash_into(Hasher h) const
1290
+ {
1291
+ switch (type_) {
1292
+ case DriveType::NONE:
1293
+ h.eat(0);
1294
+ break;
1295
+ case DriveType::CONSTANT:
1296
+ h.eat(constant_);
1297
+ break;
1298
+ case DriveType::WIRE:
1299
+ h.eat(wire_);
1300
+ break;
1301
+ case DriveType::PORT:
1302
+ h.eat(port_);
1303
+ break;
1304
+ case DriveType::MARKER:
1305
+ h.eat(marker_);
1306
+ break;
1307
+ case DriveType::MULTIPLE:
1308
+ h.eat(multiple_);
1309
+ break;
1310
+ }
1311
+ h.eat(type_);
1312
+ return h;
1313
+ }
1314
+
1315
+ inline Hasher DriveChunkWire::hash_into(Hasher h) const
1316
+ {
1317
+ h.eat(wire->name);
1318
+ h.eat(width);
1319
+ h.eat(offset);
1320
+ return h;
1321
+ }
1322
+
1323
+ inline Hasher DriveChunkPort::hash_into(Hasher h) const
1324
+ {
1325
+ h.eat(cell->name);
1326
+ h.eat(port);
1327
+ h.eat(width);
1328
+ h.eat(offset);
1329
+ return h;
1330
+ }
1331
+
1332
+ inline Hasher DriveChunkMarker::hash_into(Hasher h) const
1333
+ {
1334
+ h.eat(marker);
1335
+ h.eat(width);
1336
+ h.eat(offset);
1337
+ return h;
1338
+ }
1339
+
1340
+ inline Hasher DriveChunkMultiple::hash_into(Hasher h) const
1341
+ {
1342
+ h.eat(width_);
1343
+ h.eat(multiple_);
1344
+ return h;
1345
+ }
1346
+
1347
+ inline Hasher DriveChunk::hash_into(Hasher h) const
1348
+ {
1349
+ switch (type_) {
1350
+ case DriveType::NONE:
1351
+ h.eat(0);
1352
+ break;
1353
+ case DriveType::CONSTANT:
1354
+ h.eat(constant_);
1355
+ break;
1356
+ case DriveType::WIRE:
1357
+ h.eat(wire_);
1358
+ break;
1359
+ case DriveType::PORT:
1360
+ h.eat(port_);
1361
+ break;
1362
+ case DriveType::MARKER:
1363
+ h.eat(marker_);
1364
+ break;
1365
+ case DriveType::MULTIPLE:
1366
+ h.eat(multiple_);
1367
+ break;
1368
+ }
1369
+ h.eat(type_);
1370
+ return h;
1371
+ }
1372
+
1373
+ inline Hasher DriveSpec::hash_into(Hasher h) const
1374
+ {
1375
+ updhash();
1376
+ h.eat(hash_);
1377
+ return h;
1378
+ }
1379
+
1380
+ inline Hasher DriverMap::DriveBitId::hash_into(Hasher h) const
1381
+ {
1382
+ h.eat(id);
1383
+ return h;
1384
+ }
1385
+
1336
1386
  YOSYS_NAMESPACE_END
1337
1387
 
1338
1388
  #endif