yowasp-yosys 0.56.0.141.post974.dev0__py3-none-any.whl → 0.58.0.0.post1010__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 (35) hide show
  1. yowasp_yosys/share/gowin/cells_sim.v +0 -8
  2. yowasp_yosys/share/gowin/cells_xtra_gw1n.v +7 -0
  3. yowasp_yosys/share/gowin/cells_xtra_gw2a.v +12 -0
  4. yowasp_yosys/share/gowin/cells_xtra_gw5a.v +84 -0
  5. yowasp_yosys/share/include/backends/rtlil/rtlil_backend.h +1 -0
  6. yowasp_yosys/share/include/frontends/ast/ast.h +6 -1
  7. yowasp_yosys/share/include/kernel/bitpattern.h +50 -1
  8. yowasp_yosys/share/include/kernel/celltypes.h +19 -9
  9. yowasp_yosys/share/include/kernel/consteval.h +2 -2
  10. yowasp_yosys/share/include/kernel/constids.inc +859 -137
  11. yowasp_yosys/share/include/kernel/drivertools.h +6 -5
  12. yowasp_yosys/share/include/kernel/ffinit.h +5 -5
  13. yowasp_yosys/share/include/kernel/hashlib.h +88 -38
  14. yowasp_yosys/share/include/kernel/io.h +17 -2
  15. yowasp_yosys/share/include/kernel/log.h +102 -31
  16. yowasp_yosys/share/include/kernel/macc.h +1 -1
  17. yowasp_yosys/share/include/kernel/mem.h +4 -2
  18. yowasp_yosys/share/include/kernel/rtlil.h +268 -61
  19. yowasp_yosys/share/include/kernel/satgen.h +1 -1
  20. yowasp_yosys/share/include/kernel/threading.h +186 -0
  21. yowasp_yosys/share/include/kernel/utils.h +11 -0
  22. yowasp_yosys/share/include/kernel/yosys_common.h +9 -13
  23. yowasp_yosys/share/include/passes/fsm/fsmdata.h +18 -33
  24. yowasp_yosys/share/include/passes/techmap/libparse.h +1 -1
  25. yowasp_yosys/share/lattice/cells_bb_ecp5.v +4 -0
  26. yowasp_yosys/share/python3/sby_engine_abc.py +5 -2
  27. yowasp_yosys/share/simlib.v +34 -0
  28. yowasp_yosys/share/techmap.v +34 -2
  29. yowasp_yosys/smtbmc.py +5 -0
  30. yowasp_yosys/yosys.wasm +0 -0
  31. {yowasp_yosys-0.56.0.141.post974.dev0.dist-info → yowasp_yosys-0.58.0.0.post1010.dist-info}/METADATA +1 -1
  32. {yowasp_yosys-0.56.0.141.post974.dev0.dist-info → yowasp_yosys-0.58.0.0.post1010.dist-info}/RECORD +35 -34
  33. {yowasp_yosys-0.56.0.141.post974.dev0.dist-info → yowasp_yosys-0.58.0.0.post1010.dist-info}/WHEEL +0 -0
  34. {yowasp_yosys-0.56.0.141.post974.dev0.dist-info → yowasp_yosys-0.58.0.0.post1010.dist-info}/entry_points.txt +0 -0
  35. {yowasp_yosys-0.56.0.141.post974.dev0.dist-info → yowasp_yosys-0.58.0.0.post1010.dist-info}/top_level.txt +0 -0
@@ -1958,14 +1958,6 @@ parameter FREQ_DIV = 100;
1958
1958
  parameter REGULATOR_EN = 1'b0;
1959
1959
  endmodule
1960
1960
 
1961
- (* blackbox *)
1962
- module DCS (CLK0, CLK1, CLK2, CLK3, CLKSEL, SELFORCE, CLKOUT);
1963
- input CLK0, CLK1, CLK2, CLK3, SELFORCE;
1964
- input [3:0] CLKSEL;
1965
- output CLKOUT;
1966
- parameter DCS_MODE = "RISING";
1967
- endmodule
1968
-
1969
1961
  (* blackbox *)
1970
1962
  module EMCU (
1971
1963
  input FCLK,
@@ -1109,6 +1109,13 @@ parameter IDLE = 4'd0,
1109
1109
  RD_S2 = 4'd12;
1110
1110
  endmodule
1111
1111
 
1112
+ module DCS (...);
1113
+ input CLK0, CLK1, CLK2, CLK3, SELFORCE;
1114
+ input [3:0] CLKSEL;
1115
+ output CLKOUT;
1116
+ parameter DCS_MODE = "RISING";
1117
+ endmodule
1118
+
1112
1119
  module DQCE (...);
1113
1120
  input CLKIN;
1114
1121
  input CE;
@@ -1082,6 +1082,11 @@ input RLOADN, RMOVE, RDIR, WLOADN, WMOVE, WDIR, HOLD;
1082
1082
  output DQSR90, DQSW0, DQSW270;
1083
1083
  output [2:0] RPOINT, WPOINT;
1084
1084
  output RVALID,RBURST, RFLAG, WFLAG;
1085
+ parameter FIFO_MODE_SEL = 1'b0;
1086
+ parameter RD_PNTR = 3'b000;
1087
+ parameter DQS_MODE = "X1";
1088
+ parameter HWL = "false";
1089
+ parameter GSREN = "false";
1085
1090
  endmodule
1086
1091
 
1087
1092
  module DLLDLY (...);
@@ -1095,6 +1100,13 @@ parameter DLY_SIGN = 1'b0;
1095
1100
  parameter DLY_ADJ = 0;
1096
1101
  endmodule
1097
1102
 
1103
+ module DCS (...);
1104
+ input CLK0, CLK1, CLK2, CLK3, SELFORCE;
1105
+ input [3:0] CLKSEL;
1106
+ output CLKOUT;
1107
+ parameter DCS_MODE = "RISING";
1108
+ endmodule
1109
+
1098
1110
  module DQCE (...);
1099
1111
  input CLKIN;
1100
1112
  input CE;
@@ -1143,6 +1143,13 @@ input CE;
1143
1143
  output CLKOUT;
1144
1144
  endmodule
1145
1145
 
1146
+ module DCS (...);
1147
+ input CLKIN0, CLKIN1, CLKIN2, CLKIN3, SELFORCE;
1148
+ input [3:0] CLKSEL;
1149
+ output CLKOUT;
1150
+ parameter DCS_MODE = "RISING";
1151
+ endmodule
1152
+
1146
1153
  module DDRDLL (...);
1147
1154
  input CLKIN;
1148
1155
  input STOP;
@@ -1714,18 +1721,94 @@ input LOAD;
1714
1721
  endmodule
1715
1722
 
1716
1723
  module ADCLRC (...);
1724
+ parameter DYN_BKEN = "FALSE";
1725
+ parameter BUF_SERDES_Q1_EN = 3'b000;
1726
+ parameter BUF_BK2_EN = 6'b000000;
1727
+ parameter BUF_BK3_EN = 6'b000000;
1728
+ parameter BUF_BK4_EN = 6'b000000;
1729
+ parameter BUF_BK5_EN = 6'b000000;
1730
+ parameter BUF_BK10_EN = 5'b00000;
1731
+ parameter BUF_BK11_EN = 5'b00000;
1732
+ parameter CLK_SEL = 1'b0;
1733
+ parameter PIOCLK_SEL = 1'b0;
1734
+ parameter VSEN_CTL = 3'b000;
1735
+ parameter VSEN_CTL_SEL = 1'b0;
1736
+ parameter ADC_MODE = 1'b0;
1737
+ parameter DIV_CTL = 2'd0;
1738
+ parameter SAMPLE_CNT_SEL = 3'd4;
1739
+ parameter RATE_CHANGE_CTRL = 3'd4;
1717
1740
  endmodule
1718
1741
 
1719
1742
  module ADCULC (...);
1743
+ parameter DYN_BKEN = "FALSE";
1744
+ parameter BUF_VCC_EN = 1'b0;
1745
+ parameter BUF_VCCM_EN = 1'b0;
1746
+ parameter BUF_MIPI_M0_EN = 3'b000;
1747
+ parameter BUF_MIPI_M1_EN = 3'b000;
1748
+ parameter BUF_SERDES_Q0_EN = 3'b000;
1749
+ parameter BUF_BK6_EN = 6'b000000;
1750
+ parameter BUF_BK7_EN = 6'b000000;
1751
+ parameter CLK_SEL = 1'b0;
1752
+ parameter PIOCLK_SEL = 1'b0;
1753
+ parameter VSEN_CTL = 3'b000;
1754
+ parameter VSEN_CTL_SEL = 1'b0;
1755
+ parameter ADC_MODE = 1'b0;
1756
+ parameter DIV_CTL = 2'd0;
1757
+ parameter SAMPLE_CNT_SEL = 3'd4;
1758
+ parameter RATE_CHANGE_CTRL = 3'd4;
1720
1759
  endmodule
1721
1760
 
1722
1761
  module ADC (...);
1762
+ parameter CLK_SEL = 1'b0;
1763
+ parameter DIV_CTL = 2'd0;
1764
+ parameter BUF_EN = 12'b000000000000;
1765
+ parameter BUF_BK0_VREF_EN = 1'b0;
1766
+ parameter BUF_BK1_VREF_EN = 1'b0;
1767
+ parameter BUF_BK2_VREF_EN = 1'b0;
1768
+ parameter BUF_BK3_VREF_EN = 1'b0;
1769
+ parameter BUF_BK4_VREF_EN = 1'b0;
1770
+ parameter BUF_BK5_VREF_EN = 1'b0;
1771
+ parameter BUF_BK6_VREF_EN = 1'b0;
1772
+ parameter BUF_BK7_VREF_EN = 1'b0;
1773
+ parameter CSR_ADC_MODE = 1'b1;
1774
+ parameter CSR_VSEN_CTRL = 3'd0;
1775
+ parameter CSR_SAMPLE_CNT_SEL = 3'd4;
1776
+ parameter CSR_RATE_CHANGE_CTRL = 3'd4;
1777
+ parameter CSR_FSCAL = 10'd730;
1778
+ parameter CSR_OFFSET = -12'd1180;
1723
1779
  endmodule
1724
1780
 
1725
1781
  module ADC_SAR (...);
1782
+ parameter BUF_EN = 29'b0;
1783
+ parameter CLK_SEL = 1'b1;
1784
+ parameter DIV_CTL = 2'd2;
1785
+ parameter ADC_EN_SEL = 1'b0;
1786
+ parameter PHASE_SEL = 1'b0;
1787
+ parameter CSR_ADC_MODE = 1'b1;
1788
+ parameter CSR_VSEN_CTRL = 3'd0;
1789
+ parameter CSR_SAMPLE_CNT_SEL = 3'd4;
1790
+ parameter CSR_RATE_CHANGE_CTRL = 3'd4;
1791
+ parameter CSR_FSCAL = 10'd730;
1792
+ parameter CSR_OFFSET = -12'd1180;
1793
+ parameter ADC_CLK_DIV = 2'b00;
1794
+ parameter ADC_CLKDIV_EN = 1'b0;
1795
+ parameter CLK_SRC_SEL = 1'b1;
1796
+ parameter VREF_BUF_EN = 1'b1;
1797
+ parameter COUNT_LEN = 5'b10100;
1798
+ parameter DAC_SAMPLE_END = 5'b10010;
1799
+ parameter DAC_SAMPLE_START = 5'b01101;
1800
+ parameter SH_SAMPLE_END = 5'b01011;
1801
+ parameter SH_SAMPLE_START = 5'b00001;
1802
+ parameter AUTO_CHOP_EN = 1'b0;
1803
+ parameter CHOP_CLK_DIV = 4'b0;
1726
1804
  endmodule
1727
1805
 
1728
1806
  module LICD (...);
1807
+ parameter STAGE_NUM = 2'b00;
1808
+ parameter ENCDEC_NUM = 2'b00;
1809
+ parameter CODE_WIDTH = 2'b00;
1810
+ parameter INTERLEAVE_EN = 3'b000;
1811
+ parameter INTERLEAVE_MODE = 3'b000;
1729
1812
  endmodule
1730
1813
 
1731
1814
  module MIPI_DPHY (...);
@@ -2456,6 +2539,7 @@ parameter EQ_ZLD_LN2 = 4'b1000;
2456
2539
  endmodule
2457
2540
 
2458
2541
  module GTR12_QUAD (...);
2542
+ parameter POSITION = "Q0";
2459
2543
  endmodule
2460
2544
 
2461
2545
  module GTR12_UPAR (...);
@@ -31,6 +31,7 @@
31
31
  YOSYS_NAMESPACE_BEGIN
32
32
 
33
33
  namespace RTLIL_BACKEND {
34
+ void dump_attributes(std::ostream &f, std::string indent, const RTLIL::AttrObject *obj);
34
35
  void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool autoint = true);
35
36
  void dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk, bool autoint = true);
36
37
  void dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig, bool autoint = true);
@@ -378,7 +378,12 @@ namespace AST
378
378
  AstNode *get_struct_member() const;
379
379
 
380
380
  // helper to print errors from simplify/genrtlil code
381
- [[noreturn]] void input_error(const char *format, ...) const YS_ATTRIBUTE(format(printf, 2, 3));
381
+ [[noreturn]] void formatted_input_error(std::string str) const;
382
+ template <typename... Args>
383
+ [[noreturn]] void input_error(FmtString<TypeIdentity<Args>...> fmt, const Args &... args) const
384
+ {
385
+ formatted_input_error(fmt.format(args...));
386
+ }
382
387
  };
383
388
 
384
389
  // process an AST tree (ast must point to an AST_DESIGN node) and generate RTLIL code
@@ -25,6 +25,18 @@
25
25
 
26
26
  YOSYS_NAMESPACE_BEGIN
27
27
 
28
+ /**
29
+ * This file implements BitPatternPool for efficiently storing and querying
30
+ * sets of fixed-width 2-valued logic constants compressed as "bit patterns".
31
+ * A bit pattern can have don't cares on one or more bit positions (State::Sa).
32
+ *
33
+ * In terms of logic synthesis:
34
+ * A BitPatternPool is a sum of products (SOP).
35
+ * BitPatternPool::bits_t is a cube.
36
+ *
37
+ * BitPatternPool does not permit adding new patterns, only removing.
38
+ * Its intended use case is in analysing cases in case/match constructs in HDL.
39
+ */
28
40
  struct BitPatternPool
29
41
  {
30
42
  int width;
@@ -67,6 +79,9 @@ struct BitPatternPool
67
79
  }
68
80
  }
69
81
 
82
+ /**
83
+ * Constructs a pool of all possible patterns (all don't-care bits)
84
+ */
70
85
  BitPatternPool(int width)
71
86
  {
72
87
  this->width = width;
@@ -78,16 +93,23 @@ struct BitPatternPool
78
93
  }
79
94
  }
80
95
 
96
+ /**
97
+ * Convert a constant SigSpec to a pattern. Normalize Yosys many-valued
98
+ * to three-valued logic.
99
+ */
81
100
  bits_t sig2bits(RTLIL::SigSpec sig)
82
101
  {
83
102
  bits_t bits;
84
- bits.bitdata = sig.as_const().bits();
103
+ bits.bitdata = sig.as_const().to_bits();
85
104
  for (auto &b : bits.bitdata)
86
105
  if (b > RTLIL::State::S1)
87
106
  b = RTLIL::State::Sa;
88
107
  return bits;
89
108
  }
90
109
 
110
+ /**
111
+ * Two cubes match if their intersection is non-empty.
112
+ */
91
113
  bool match(bits_t a, bits_t b)
92
114
  {
93
115
  log_assert(int(a.bitdata.size()) == width);
@@ -98,6 +120,15 @@ struct BitPatternPool
98
120
  return true;
99
121
  }
100
122
 
123
+ /**
124
+ * Does cube sig overlap any cube in the pool?
125
+ * For example:
126
+ * pool({aaa}).has_any(01a) == true
127
+ * pool({01a}).has_any(01a) == true
128
+ * pool({011}).has_any(01a) == true
129
+ * pool({01a}).has_any(011) == true
130
+ * pool({111}).has_any(01a) == false
131
+ */
101
132
  bool has_any(RTLIL::SigSpec sig)
102
133
  {
103
134
  bits_t bits = sig2bits(sig);
@@ -107,6 +138,15 @@ struct BitPatternPool
107
138
  return false;
108
139
  }
109
140
 
141
+ /**
142
+ * Is cube sig covered by a cube in the pool?
143
+ * For example:
144
+ * pool({aaa}).has_all(01a) == true
145
+ * pool({01a}).has_any(01a) == true
146
+ * pool({01a}).has_any(011) == true
147
+ * pool({011}).has_all(01a) == false
148
+ * pool({111}).has_all(01a) == false
149
+ */
110
150
  bool has_all(RTLIL::SigSpec sig)
111
151
  {
112
152
  bits_t bits = sig2bits(sig);
@@ -121,6 +161,12 @@ struct BitPatternPool
121
161
  return false;
122
162
  }
123
163
 
164
+ /**
165
+ * Remove cube sig from the pool, splitting the remaining cubes. True if success.
166
+ * For example:
167
+ * Taking 011 out of pool({01a}) -> pool({010}), returns true.
168
+ * Taking 011 out of pool({010}) does nothing, returns false.
169
+ */
124
170
  bool take(RTLIL::SigSpec sig)
125
171
  {
126
172
  bool status = false;
@@ -143,6 +189,9 @@ struct BitPatternPool
143
189
  return status;
144
190
  }
145
191
 
192
+ /**
193
+ * Remove all patterns. Returns false if already empty.
194
+ */
146
195
  bool take_all()
147
196
  {
148
197
  if (database.empty())
@@ -111,6 +111,8 @@ struct CellTypes
111
111
  setup_type(ID($original_tag), {ID::A}, {ID::Y});
112
112
  setup_type(ID($future_ff), {ID::A}, {ID::Y});
113
113
  setup_type(ID($scopeinfo), {}, {});
114
+ setup_type(ID($input_port), {}, {ID::Y});
115
+ setup_type(ID($connect), {ID::A, ID::B}, {});
114
116
  }
115
117
 
116
118
  void setup_internals_eval()
@@ -303,24 +305,34 @@ struct CellTypes
303
305
  cell_types.clear();
304
306
  }
305
307
 
306
- bool cell_known(RTLIL::IdString type) const
308
+ bool cell_known(const RTLIL::IdString &type) const
307
309
  {
308
310
  return cell_types.count(type) != 0;
309
311
  }
310
312
 
311
- bool cell_output(RTLIL::IdString type, RTLIL::IdString port) const
313
+ bool cell_output(const RTLIL::IdString &type, const RTLIL::IdString &port) const
312
314
  {
313
315
  auto it = cell_types.find(type);
314
316
  return it != cell_types.end() && it->second.outputs.count(port) != 0;
315
317
  }
316
318
 
317
- bool cell_input(RTLIL::IdString type, RTLIL::IdString port) const
319
+ bool cell_input(const RTLIL::IdString &type, const RTLIL::IdString &port) const
318
320
  {
319
321
  auto it = cell_types.find(type);
320
322
  return it != cell_types.end() && it->second.inputs.count(port) != 0;
321
323
  }
322
324
 
323
- bool cell_evaluable(RTLIL::IdString type) const
325
+ RTLIL::PortDir cell_port_dir(RTLIL::IdString type, RTLIL::IdString port) const
326
+ {
327
+ auto it = cell_types.find(type);
328
+ if (it == cell_types.end())
329
+ return RTLIL::PD_UNKNOWN;
330
+ bool is_input = it->second.inputs.count(port);
331
+ bool is_output = it->second.outputs.count(port);
332
+ return RTLIL::PortDir(is_input + is_output * 2);
333
+ }
334
+
335
+ bool cell_evaluable(const RTLIL::IdString &type) const
324
336
  {
325
337
  auto it = cell_types.find(type);
326
338
  return it != cell_types.end() && it->second.is_evaluable;
@@ -328,7 +340,7 @@ struct CellTypes
328
340
 
329
341
  static RTLIL::Const eval_not(RTLIL::Const v)
330
342
  {
331
- for (auto &bit : v.bits())
343
+ for (auto bit : v)
332
344
  if (bit == State::S0) bit = State::S1;
333
345
  else if (bit == State::S1) bit = State::S0;
334
346
  return v;
@@ -421,16 +433,14 @@ struct CellTypes
421
433
  static RTLIL::Const eval(RTLIL::Cell *cell, const RTLIL::Const &arg1, const RTLIL::Const &arg2, bool *errp = nullptr)
422
434
  {
423
435
  if (cell->type == ID($slice)) {
424
- RTLIL::Const ret;
425
436
  int width = cell->parameters.at(ID::Y_WIDTH).as_int();
426
437
  int offset = cell->parameters.at(ID::OFFSET).as_int();
427
- ret.bits().insert(ret.bits().end(), arg1.begin()+offset, arg1.begin()+offset+width);
428
- return ret;
438
+ return arg1.extract(offset, width);
429
439
  }
430
440
 
431
441
  if (cell->type == ID($concat)) {
432
442
  RTLIL::Const ret = arg1;
433
- ret.bits().insert(ret.bits().end(), arg2.begin(), arg2.end());
443
+ ret.append(arg2);
434
444
  return ret;
435
445
  }
436
446
 
@@ -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.set(i, carry ? State::S1 : State::S0);
119
119
  }
120
120
 
121
121
  set(sig_co, coval);
@@ -249,7 +249,7 @@ struct ConstEval
249
249
 
250
250
  for (int i = 0; i < GetSize(val_y); i++)
251
251
  if (val_y[i] == RTLIL::Sx)
252
- val_x.bits()[i] = RTLIL::Sx;
252
+ val_x.set(i, RTLIL::Sx);
253
253
 
254
254
  set(sig_y, val_y);
255
255
  set(sig_x, val_x);