yowasp-yosys 0.46.0.0.post790__py3-none-any.whl → 0.47.0.0.post805__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.
@@ -1127,7 +1127,7 @@ struct fmt_part {
1127
1127
  }
1128
1128
 
1129
1129
  case UNICHAR: {
1130
- uint32_t codepoint = val.template get<uint32_t>();
1130
+ uint32_t codepoint = val.template zcast<32>().template get<uint32_t>();
1131
1131
  if (codepoint >= 0x10000)
1132
1132
  buf += (char)(0xf0 | (codepoint >> 18));
1133
1133
  else if (codepoint >= 0x800)
@@ -50,9 +50,13 @@ class vcd_writer {
50
50
 
51
51
  void emit_scope(const std::vector<std::string> &scope) {
52
52
  assert(!streaming);
53
- while (current_scope.size() > scope.size() ||
54
- (current_scope.size() > 0 &&
55
- current_scope[current_scope.size() - 1] != scope[current_scope.size() - 1])) {
53
+ size_t same_scope_count = 0;
54
+ while ((same_scope_count < current_scope.size()) &&
55
+ (same_scope_count < scope.size()) &&
56
+ (current_scope[same_scope_count] == scope[same_scope_count])) {
57
+ same_scope_count++;
58
+ }
59
+ while (current_scope.size() > same_scope_count) {
56
60
  buffer += "$upscope $end\n";
57
61
  current_scope.pop_back();
58
62
  }
@@ -123,6 +127,8 @@ class vcd_writer {
123
127
  bool bit_curr = var.curr[bit / (8 * sizeof(chunk_t))] & (1 << (bit % (8 * sizeof(chunk_t))));
124
128
  buffer += (bit_curr ? '1' : '0');
125
129
  }
130
+ if (var.width == 0)
131
+ buffer += '0';
126
132
  buffer += ' ';
127
133
  emit_ident(var.ident);
128
134
  buffer += '\n';
@@ -80,7 +80,7 @@ struct BitPatternPool
80
80
  bits_t sig2bits(RTLIL::SigSpec sig)
81
81
  {
82
82
  bits_t bits;
83
- bits.bitdata = sig.as_const().bits;
83
+ bits.bitdata = sig.as_const().bits();
84
84
  for (auto &b : bits.bitdata)
85
85
  if (b > RTLIL::State::S1)
86
86
  b = RTLIL::State::Sa;
@@ -29,6 +29,8 @@ struct CellType
29
29
  RTLIL::IdString type;
30
30
  pool<RTLIL::IdString> inputs, outputs;
31
31
  bool is_evaluable;
32
+ bool is_combinatorial;
33
+ bool is_synthesizable;
32
34
  };
33
35
 
34
36
  struct CellTypes
@@ -56,9 +58,9 @@ struct CellTypes
56
58
  setup_stdcells_mem();
57
59
  }
58
60
 
59
- void setup_type(RTLIL::IdString type, const pool<RTLIL::IdString> &inputs, const pool<RTLIL::IdString> &outputs, bool is_evaluable = false)
61
+ void setup_type(RTLIL::IdString type, const pool<RTLIL::IdString> &inputs, const pool<RTLIL::IdString> &outputs, bool is_evaluable = false, bool is_combinatorial = false, bool is_synthesizable = false)
60
62
  {
61
- CellType ct = {type, inputs, outputs, is_evaluable};
63
+ CellType ct = {type, inputs, outputs, is_evaluable, is_combinatorial, is_synthesizable};
62
64
  cell_types[ct.type] = ct;
63
65
  }
64
66
 
@@ -325,7 +327,7 @@ struct CellTypes
325
327
 
326
328
  static RTLIL::Const eval_not(RTLIL::Const v)
327
329
  {
328
- for (auto &bit : v.bits)
330
+ for (auto &bit : v.bits())
329
331
  if (bit == State::S0) bit = State::S1;
330
332
  else if (bit == State::S1) bit = State::S0;
331
333
  return v;
@@ -419,13 +421,13 @@ struct CellTypes
419
421
  RTLIL::Const ret;
420
422
  int width = cell->parameters.at(ID::Y_WIDTH).as_int();
421
423
  int offset = cell->parameters.at(ID::OFFSET).as_int();
422
- ret.bits.insert(ret.bits.end(), arg1.bits.begin()+offset, arg1.bits.begin()+offset+width);
424
+ ret.bits().insert(ret.bits().end(), arg1.begin()+offset, arg1.begin()+offset+width);
423
425
  return ret;
424
426
  }
425
427
 
426
428
  if (cell->type == ID($concat)) {
427
429
  RTLIL::Const ret = arg1;
428
- ret.bits.insert(ret.bits.end(), arg2.bits.begin(), arg2.bits.end());
430
+ ret.bits().insert(ret.bits().end(), arg2.begin(), arg2.end());
429
431
  return ret;
430
432
  }
431
433
 
@@ -448,7 +450,7 @@ struct CellTypes
448
450
  {
449
451
  int width = cell->parameters.at(ID::WIDTH).as_int();
450
452
 
451
- std::vector<RTLIL::State> t = cell->parameters.at(ID::LUT).bits;
453
+ std::vector<RTLIL::State> t = cell->parameters.at(ID::LUT).to_bits();
452
454
  while (GetSize(t) < (1 << width))
453
455
  t.push_back(State::S0);
454
456
  t.resize(1 << width);
@@ -460,7 +462,7 @@ struct CellTypes
460
462
  {
461
463
  int width = cell->parameters.at(ID::WIDTH).as_int();
462
464
  int depth = cell->parameters.at(ID::DEPTH).as_int();
463
- std::vector<RTLIL::State> t = cell->parameters.at(ID::TABLE).bits;
465
+ std::vector<RTLIL::State> t = cell->parameters.at(ID::TABLE).to_bits();
464
466
 
465
467
  while (GetSize(t) < width*depth*2)
466
468
  t.push_back(State::S0);
@@ -473,7 +475,7 @@ struct CellTypes
473
475
  bool match_x = true;
474
476
 
475
477
  for (int j = 0; j < width; j++) {
476
- RTLIL::State a = arg1.bits.at(j);
478
+ RTLIL::State a = arg1.at(j);
477
479
  if (t.at(2*width*i + 2*j + 0) == State::S1) {
478
480
  if (a == State::S1) match_x = false;
479
481
  if (a != State::S0) match = false;
@@ -513,7 +515,7 @@ struct CellTypes
513
515
  if (cell->type == ID($_OAI3_))
514
516
  return eval_not(const_and(const_or(arg1, arg2, false, false, 1), arg3, false, false, 1));
515
517
 
516
- log_assert(arg3.bits.size() == 0);
518
+ log_assert(arg3.size() == 0);
517
519
  return eval(cell, arg1, arg2, errp);
518
520
  }
519
521
 
@@ -524,7 +526,7 @@ struct CellTypes
524
526
  if (cell->type == ID($_OAI4_))
525
527
  return eval_not(const_and(const_or(arg1, arg2, false, false, 1), const_or(arg3, arg4, false, false, 1), false, false, 1));
526
528
 
527
- log_assert(arg4.bits.size() == 0);
529
+ log_assert(arg4.size() == 0);
528
530
  return eval(cell, arg1, arg2, arg3, errp);
529
531
  }
530
532
  };
@@ -76,7 +76,7 @@ struct ConstEval
76
76
  #ifndef NDEBUG
77
77
  RTLIL::SigSpec current_val = values_map(sig);
78
78
  for (int i = 0; i < GetSize(current_val); i++)
79
- log_assert(current_val[i].wire != NULL || current_val[i] == value.bits[i]);
79
+ log_assert(current_val[i].wire != NULL || current_val[i] == value[i]);
80
80
  #endif
81
81
  values_map.add(sig, RTLIL::SigSpec(value));
82
82
  }
@@ -115,7 +115,7 @@ struct ConstEval
115
115
 
116
116
  for (int i = 0; i < GetSize(coval); i++) {
117
117
  carry = (sig_g[i] == State::S1) || (sig_p[i] == RTLIL::S1 && carry);
118
- coval.bits[i] = carry ? State::S1 : State::S0;
118
+ coval.bits()[i] = carry ? State::S1 : State::S0;
119
119
  }
120
120
 
121
121
  set(sig_co, coval);
@@ -153,7 +153,7 @@ struct ConstEval
153
153
 
154
154
  for (int i = 0; i < sig_s.size(); i++)
155
155
  {
156
- RTLIL::State s_bit = sig_s.extract(i, 1).as_const().bits.at(0);
156
+ RTLIL::State s_bit = sig_s.extract(i, 1).as_const().at(0);
157
157
  RTLIL::SigSpec b_slice = sig_b.extract(sig_y.size()*i, sig_y.size());
158
158
 
159
159
  if (s_bit == RTLIL::State::Sx || s_bit == RTLIL::State::S1)
@@ -180,10 +180,10 @@ struct ConstEval
180
180
 
181
181
  if (y_values.size() > 1)
182
182
  {
183
- std::vector<RTLIL::State> master_bits = y_values.at(0).bits;
183
+ std::vector<RTLIL::State> master_bits = y_values.at(0).to_bits();
184
184
 
185
185
  for (size_t i = 1; i < y_values.size(); i++) {
186
- std::vector<RTLIL::State> &slave_bits = y_values.at(i).bits;
186
+ std::vector<RTLIL::State> slave_bits = y_values.at(i).to_bits();
187
187
  log_assert(master_bits.size() == slave_bits.size());
188
188
  for (size_t j = 0; j < master_bits.size(); j++)
189
189
  if (master_bits[j] != slave_bits[j])
@@ -248,8 +248,8 @@ struct ConstEval
248
248
  RTLIL::Const val_x = const_or(t2, t3, false, false, width);
249
249
 
250
250
  for (int i = 0; i < GetSize(val_y); i++)
251
- if (val_y.bits[i] == RTLIL::Sx)
252
- val_x.bits[i] = RTLIL::Sx;
251
+ if (val_y[i] == RTLIL::Sx)
252
+ val_x.bits()[i] = RTLIL::Sx;
253
253
 
254
254
  set(sig_y, val_y);
255
255
  set(sig_x, val_x);
@@ -154,7 +154,6 @@ X(PORTID)
154
154
  X(PRIORITY)
155
155
  X(PRIORITY_MASK)
156
156
  X(Q)
157
- X(qwp_position)
158
157
  X(R)
159
158
  X(ram_block)
160
159
  X(ram_style)
@@ -76,7 +76,7 @@ struct FfInitVals
76
76
  {
77
77
  RTLIL::Const res;
78
78
  for (auto bit : sig)
79
- res.bits.push_back((*this)(bit));
79
+ res.bits().push_back((*this)(bit));
80
80
  return res;
81
81
  }
82
82
 
@@ -93,12 +93,12 @@ struct FfInitVals
93
93
  initbits[mbit] = std::make_pair(val,abit);
94
94
  auto it2 = abit.wire->attributes.find(ID::init);
95
95
  if (it2 != abit.wire->attributes.end()) {
96
- it2->second[abit.offset] = val;
96
+ it2->second.bits()[abit.offset] = val;
97
97
  if (it2->second.is_fully_undef())
98
98
  abit.wire->attributes.erase(it2);
99
99
  } else if (val != State::Sx) {
100
100
  Const cval(State::Sx, GetSize(abit.wire));
101
- cval[abit.offset] = val;
101
+ cval.bits()[abit.offset] = val;
102
102
  abit.wire->attributes[ID::init] = cval;
103
103
  }
104
104
  }
@@ -104,7 +104,7 @@ struct Macc
104
104
  ports.clear();
105
105
  bit_ports = cell->getPort(ID::B);
106
106
 
107
- std::vector<RTLIL::State> config_bits = cell->getParam(ID::CONFIG).bits;
107
+ auto config_bits = cell->getParam(ID::CONFIG);
108
108
  int config_cursor = 0;
109
109
 
110
110
  int config_width = cell->getParam(ID::CONFIG_WIDTH).as_int();
@@ -199,7 +199,7 @@ struct Macc
199
199
 
200
200
  bool eval(RTLIL::Const &result) const
201
201
  {
202
- for (auto &bit : result.bits)
202
+ for (auto &bit : result.bits())
203
203
  bit = State::S0;
204
204
 
205
205
  for (auto &port : ports)
@@ -255,7 +255,7 @@ private:
255
255
  // return the offset the addr would have in the range at `it`
256
256
  size_t _range_offset(std::map<addr_t, RTLIL::Const>::iterator it, addr_t addr) const { return (addr - it->first) * _data_width; }
257
257
  // assuming _range_contains(it, addr), return an iterator pointing to the data at addr
258
- std::vector<State>::iterator _range_data(std::map<addr_t, RTLIL::Const>::iterator it, addr_t addr) { return it->second.bits.begin() + _range_offset(it, addr); }
258
+ std::vector<State>::iterator _range_data(std::map<addr_t, RTLIL::Const>::iterator it, addr_t addr) { return it->second.bits().begin() + _range_offset(it, addr); }
259
259
  // internal version of reserve_range that returns an iterator to the range
260
260
  std::map<addr_t, RTLIL::Const>::iterator _reserve_range(addr_t begin_addr, addr_t end_addr);
261
261
  // write a single word at addr, return iterator to next word
@@ -47,6 +47,8 @@ namespace RTLIL
47
47
  STi = 7 // init
48
48
  };
49
49
 
50
+ // Semantic metadata - how can this constant be interpreted?
51
+ // Values may be generally non-exclusive
50
52
  enum ConstFlags : unsigned char {
51
53
  CONST_FLAG_NONE = 0,
52
54
  CONST_FLAG_STRING = 1,
@@ -658,35 +660,115 @@ namespace RTLIL
658
660
 
659
661
  struct RTLIL::Const
660
662
  {
661
- int flags;
662
- std::vector<RTLIL::State> bits;
663
+ short int flags;
664
+ private:
665
+ friend class KernelRtlilTest;
666
+ FRIEND_TEST(KernelRtlilTest, ConstStr);
667
+ using bitvectype = std::vector<RTLIL::State>;
668
+ enum class backing_tag: bool { bits, string };
669
+ // Do not access the union or tag even in Const methods unless necessary
670
+ mutable backing_tag tag;
671
+ union {
672
+ mutable bitvectype bits_;
673
+ mutable std::string str_;
674
+ };
675
+
676
+ // Use these private utilities instead
677
+ bool is_bits() const { return tag == backing_tag::bits; }
678
+ bool is_str() const { return tag == backing_tag::string; }
679
+
680
+ bitvectype* get_if_bits() const { return is_bits() ? &bits_ : NULL; }
681
+ std::string* get_if_str() const { return is_str() ? &str_ : NULL; }
663
682
 
664
- Const() : flags(RTLIL::CONST_FLAG_NONE) {}
683
+ bitvectype& get_bits() const;
684
+ std::string& get_str() const;
685
+ public:
686
+ Const() : flags(RTLIL::CONST_FLAG_NONE), tag(backing_tag::bits), bits_(std::vector<RTLIL::State>()) {}
665
687
  Const(const std::string &str);
666
688
  Const(long long val, int width = 32);
667
689
  Const(RTLIL::State bit, int width = 1);
668
- Const(const std::vector<RTLIL::State> &bits) : bits(bits) { flags = CONST_FLAG_NONE; }
690
+ Const(const std::vector<RTLIL::State> &bits) : flags(RTLIL::CONST_FLAG_NONE), tag(backing_tag::bits), bits_(bits) {}
669
691
  Const(const std::vector<bool> &bits);
670
- Const(const RTLIL::Const &c) = default;
671
- RTLIL::Const &operator =(const RTLIL::Const &other) = default;
692
+ Const(const RTLIL::Const &other);
693
+ Const(RTLIL::Const &&other);
694
+ RTLIL::Const &operator =(const RTLIL::Const &other);
695
+ ~Const();
672
696
 
673
697
  bool operator <(const RTLIL::Const &other) const;
674
698
  bool operator ==(const RTLIL::Const &other) const;
675
699
  bool operator !=(const RTLIL::Const &other) const;
676
700
 
701
+ std::vector<RTLIL::State>& bits();
677
702
  bool as_bool() const;
678
703
  int as_int(bool is_signed = false) const;
679
- std::string as_string() const;
704
+ std::string as_string(const char* any = "-") const;
680
705
  static Const from_string(const std::string &str);
706
+ std::vector<RTLIL::State> to_bits() const;
681
707
 
682
708
  std::string decode_string() const;
709
+ int size() const;
710
+ bool empty() const;
711
+ void bitvectorize() const;
712
+
713
+ class const_iterator {
714
+ private:
715
+ const Const& parent;
716
+ size_t idx;
683
717
 
684
- inline int size() const { return bits.size(); }
685
- inline bool empty() const { return bits.empty(); }
686
- inline RTLIL::State &operator[](int index) { return bits.at(index); }
687
- inline const RTLIL::State &operator[](int index) const { return bits.at(index); }
688
- inline decltype(bits)::iterator begin() { return bits.begin(); }
689
- inline decltype(bits)::iterator end() { return bits.end(); }
718
+ public:
719
+ using iterator_category = std::input_iterator_tag;
720
+ using value_type = State;
721
+ using difference_type = std::ptrdiff_t;
722
+ using pointer = const State*;
723
+ using reference = const State&;
724
+
725
+ const_iterator(const Const& c, size_t i) : parent(c), idx(i) {}
726
+
727
+ State operator*() const;
728
+
729
+ const_iterator& operator++() { ++idx; return *this; }
730
+ const_iterator& operator--() { --idx; return *this; }
731
+ const_iterator& operator++(int) { ++idx; return *this; }
732
+ const_iterator& operator--(int) { --idx; return *this; }
733
+ const_iterator& operator+=(int i) { idx += i; return *this; }
734
+
735
+ const_iterator operator+(int add) {
736
+ return const_iterator(parent, idx + add);
737
+ }
738
+ const_iterator operator-(int sub) {
739
+ return const_iterator(parent, idx - sub);
740
+ }
741
+ int operator-(const const_iterator& other) {
742
+ return idx - other.idx;
743
+ }
744
+
745
+ bool operator==(const const_iterator& other) const {
746
+ return idx == other.idx;
747
+ }
748
+
749
+ bool operator!=(const const_iterator& other) const {
750
+ return !(*this == other);
751
+ }
752
+ };
753
+
754
+ const_iterator begin() const {
755
+ return const_iterator(*this, 0);
756
+ }
757
+ const_iterator end() const {
758
+ return const_iterator(*this, size());
759
+ }
760
+ State back() const {
761
+ return *(end() - 1);
762
+ }
763
+ State front() const {
764
+ return *begin();
765
+ }
766
+ State at(size_t i) const {
767
+ return *const_iterator(*this, i);
768
+ }
769
+ State operator[](size_t i) const {
770
+ return *const_iterator(*this, i);
771
+ }
690
772
 
691
773
  bool is_fully_zero() const;
692
774
  bool is_fully_ones() const;
@@ -695,25 +777,29 @@ struct RTLIL::Const
695
777
  bool is_fully_undef_x_only() const;
696
778
  bool is_onehot(int *pos = nullptr) const;
697
779
 
698
- inline RTLIL::Const extract(int offset, int len = 1, RTLIL::State padding = RTLIL::State::S0) const {
699
- RTLIL::Const ret;
700
- ret.bits.reserve(len);
701
- for (int i = offset; i < offset + len; i++)
702
- ret.bits.push_back(i < GetSize(bits) ? bits[i] : padding);
703
- return ret;
704
- }
780
+ RTLIL::Const extract(int offset, int len = 1, RTLIL::State padding = RTLIL::State::S0) const;
781
+
782
+ // find the MSB without redundant leading bits
783
+ size_t get_min_size(bool is_signed) const;
784
+
785
+ // compress representation to the minimum required bits
786
+ void compress(bool is_signed = false);
787
+
788
+ std::optional<int> as_int_compress(bool is_signed) const;
705
789
 
706
790
  void extu(int width) {
707
- bits.resize(width, RTLIL::State::S0);
791
+ bits().resize(width, RTLIL::State::S0);
708
792
  }
709
793
 
710
794
  void exts(int width) {
711
- bits.resize(width, bits.empty() ? RTLIL::State::Sx : bits.back());
795
+ bitvectype& bv = bits();
796
+ bv.resize(width, bv.empty() ? RTLIL::State::Sx : bv.back());
712
797
  }
713
798
 
714
799
  inline unsigned int hash() const {
715
800
  unsigned int h = mkhash_init;
716
- for (auto b : bits)
801
+
802
+ for (State b : *this)
717
803
  h = mkhash(h, b);
718
804
  return h;
719
805
  }
@@ -760,8 +846,8 @@ struct RTLIL::SigChunk
760
846
  int width, offset;
761
847
 
762
848
  SigChunk() : wire(nullptr), width(0), offset(0) {}
763
- SigChunk(const RTLIL::Const &value) : wire(nullptr), data(value.bits), width(GetSize(data)), offset(0) {}
764
- SigChunk(RTLIL::Const &&value) : wire(nullptr), data(std::move(value.bits)), width(GetSize(data)), offset(0) {}
849
+ SigChunk(const RTLIL::Const &value) : wire(nullptr), data(value.to_bits()), width(GetSize(data)), offset(0) {}
850
+ SigChunk(RTLIL::Const &&value) : wire(nullptr), data(value.to_bits()), width(GetSize(data)), offset(0) {}
765
851
  SigChunk(RTLIL::Wire *wire) : wire(wire), width(GetSize(wire)), offset(0) {}
766
852
  SigChunk(RTLIL::Wire *wire, int offset, int width = 1) : wire(wire), width(width), offset(offset) {}
767
853
  SigChunk(const std::string &str) : SigChunk(RTLIL::Const(str)) {}
@@ -62,6 +62,9 @@
62
62
  defines the Yosys Makefile would set for your build configuration.
63
63
  #endif
64
64
 
65
+ #define FRIEND_TEST(test_case_name, test_name) \
66
+ friend class test_case_name##_##test_name##_Test
67
+
65
68
  #ifdef YOSYS_ENABLE_TCL
66
69
  # include <tcl.h>
67
70
  # ifdef YOSYS_MXE_HACKS
@@ -48,8 +48,8 @@ struct FsmData
48
48
  cell->parameters[ID::STATE_TABLE] = RTLIL::Const();
49
49
 
50
50
  for (int i = 0; i < int(state_table.size()); i++) {
51
- std::vector<RTLIL::State> &bits_table = cell->parameters[ID::STATE_TABLE].bits;
52
- std::vector<RTLIL::State> &bits_state = state_table[i].bits;
51
+ std::vector<RTLIL::State> &bits_table = cell->parameters[ID::STATE_TABLE].bits();
52
+ std::vector<RTLIL::State> &bits_state = state_table[i].bits();
53
53
  bits_table.insert(bits_table.end(), bits_state.begin(), bits_state.end());
54
54
  }
55
55
 
@@ -57,16 +57,16 @@ struct FsmData
57
57
  cell->parameters[ID::TRANS_TABLE] = RTLIL::Const();
58
58
  for (int i = 0; i < int(transition_table.size()); i++)
59
59
  {
60
- std::vector<RTLIL::State> &bits_table = cell->parameters[ID::TRANS_TABLE].bits;
60
+ std::vector<RTLIL::State> &bits_table = cell->parameters[ID::TRANS_TABLE].bits();
61
61
  transition_t &tr = transition_table[i];
62
62
 
63
63
  RTLIL::Const const_state_in = RTLIL::Const(tr.state_in, state_num_log2);
64
64
  RTLIL::Const const_state_out = RTLIL::Const(tr.state_out, state_num_log2);
65
- std::vector<RTLIL::State> &bits_state_in = const_state_in.bits;
66
- std::vector<RTLIL::State> &bits_state_out = const_state_out.bits;
65
+ std::vector<RTLIL::State> &bits_state_in = const_state_in.bits();
66
+ std::vector<RTLIL::State> &bits_state_out = const_state_out.bits();
67
67
 
68
- std::vector<RTLIL::State> &bits_ctrl_in = tr.ctrl_in.bits;
69
- std::vector<RTLIL::State> &bits_ctrl_out = tr.ctrl_out.bits;
68
+ std::vector<RTLIL::State> &bits_ctrl_in = tr.ctrl_in.bits();
69
+ std::vector<RTLIL::State> &bits_ctrl_out = tr.ctrl_out.bits();
70
70
 
71
71
  // append lsb first
72
72
  bits_table.insert(bits_table.end(), bits_ctrl_out.begin(), bits_ctrl_out.end());
@@ -97,23 +97,23 @@ struct FsmData
97
97
  for (int i = 0; i < state_num; i++) {
98
98
  RTLIL::Const state_code;
99
99
  int off_begin = i*state_bits, off_end = off_begin + state_bits;
100
- state_code.bits.insert(state_code.bits.begin(), state_table.bits.begin()+off_begin, state_table.bits.begin()+off_end);
100
+ state_code.bits().insert(state_code.bits().begin(), state_table.begin()+off_begin, state_table.begin()+off_end);
101
101
  this->state_table.push_back(state_code);
102
102
  }
103
103
 
104
104
  for (int i = 0; i < trans_num; i++)
105
105
  {
106
- auto off_ctrl_out = trans_table.bits.begin() + i*(num_inputs+num_outputs+2*state_num_log2);
106
+ auto off_ctrl_out = trans_table.begin() + i*(num_inputs+num_outputs+2*state_num_log2);
107
107
  auto off_state_out = off_ctrl_out + num_outputs;
108
108
  auto off_ctrl_in = off_state_out + state_num_log2;
109
109
  auto off_state_in = off_ctrl_in + num_inputs;
110
110
  auto off_end = off_state_in + state_num_log2;
111
111
 
112
112
  RTLIL::Const state_in, state_out, ctrl_in, ctrl_out;
113
- ctrl_out.bits.insert(state_in.bits.begin(), off_ctrl_out, off_state_out);
114
- state_out.bits.insert(state_out.bits.begin(), off_state_out, off_ctrl_in);
115
- ctrl_in.bits.insert(ctrl_in.bits.begin(), off_ctrl_in, off_state_in);
116
- state_in.bits.insert(state_in.bits.begin(), off_state_in, off_end);
113
+ ctrl_out.bits().insert(ctrl_out.bits().begin(), off_ctrl_out, off_state_out);
114
+ state_out.bits().insert(state_out.bits().begin(), off_state_out, off_ctrl_in);
115
+ ctrl_in.bits().insert(ctrl_in.bits().begin(), off_ctrl_in, off_state_in);
116
+ state_in.bits().insert(state_in.bits().begin(), off_state_in, off_end);
117
117
 
118
118
  transition_t tr;
119
119
  tr.state_in = state_in.as_int();
@@ -146,12 +146,12 @@ class SbyModule:
146
146
  path_iter = iter(path)
147
147
 
148
148
  mod = next(path_iter).translate(trans)
149
- if self.name != mod:
149
+ if self.name.translate(trans) != mod:
150
150
  raise ValueError(f"{self.name} is not the first module in hierarchical path {pretty_path(path)}.")
151
151
 
152
152
  mod_hier = self
153
153
  for mod in path_iter:
154
- mod_hier = next((v for k, v in mod_hier.submodules.items() if mod == k.translate(trans)), None)
154
+ mod_hier = next((v for k, v in mod_hier.submodules.items() if mod.translate(trans) == k.translate(trans)), None)
155
155
  if not mod_hier:
156
156
  raise KeyError(f"Could not find {pretty_path(path)} in design hierarchy!")
157
157
 
@@ -1,5 +1,5 @@
1
1
  // **AUTOGENERATED FILE** **DO NOT EDIT**
2
- // Generated by ../yosys-src/techlibs/quicklogic/qlf_k6n10f/generate_bram_types_sim.py at 2024-10-09 11:26:56.850043+00:00
2
+ // Generated by ../yosys-src/techlibs/quicklogic/qlf_k6n10f/generate_bram_types_sim.py at 2024-11-06 01:15:23.931694+00:00
3
3
  `timescale 1ns /10ps
4
4
 
5
5
  module TDP36K_BRAM_A_X1_B_X1_nonsplit (