yowasp-yosys 0.55.0.3.post946.dev0__py3-none-any.whl → 0.56.0.0.post964__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.
- yowasp_yosys/sby.py +39 -8
- yowasp_yosys/share/include/kernel/constids.inc +1 -0
- yowasp_yosys/share/include/kernel/io.h +382 -8
- yowasp_yosys/share/include/kernel/json.h +2 -2
- yowasp_yosys/share/include/kernel/register.h +42 -4
- yowasp_yosys/share/include/kernel/rtlil.h +5 -1
- yowasp_yosys/share/include/kernel/satgen.h +3 -1
- yowasp_yosys/share/include/kernel/yosys_common.h +9 -0
- yowasp_yosys/share/include/passes/techmap/libparse.h +235 -0
- yowasp_yosys/share/python3/sby_autotune.py +1 -1
- yowasp_yosys/share/python3/sby_cmdline.py +13 -0
- yowasp_yosys/share/python3/sby_core.py +208 -85
- yowasp_yosys/share/python3/sby_design.py +4 -0
- yowasp_yosys/share/python3/sby_engine_abc.py +15 -4
- yowasp_yosys/share/python3/sby_engine_aiger.py +14 -9
- yowasp_yosys/share/python3/sby_engine_btor.py +15 -4
- yowasp_yosys/share/python3/sby_engine_smtbmc.py +40 -27
- yowasp_yosys/share/python3/sby_status.py +388 -115
- yowasp_yosys/yosys.wasm +0 -0
- {yowasp_yosys-0.55.0.3.post946.dev0.dist-info → yowasp_yosys-0.56.0.0.post964.dist-info}/METADATA +1 -1
- {yowasp_yosys-0.55.0.3.post946.dev0.dist-info → yowasp_yosys-0.56.0.0.post964.dist-info}/RECORD +24 -23
- {yowasp_yosys-0.55.0.3.post946.dev0.dist-info → yowasp_yosys-0.56.0.0.post964.dist-info}/WHEEL +0 -0
- {yowasp_yosys-0.55.0.3.post946.dev0.dist-info → yowasp_yosys-0.56.0.0.post964.dist-info}/entry_points.txt +0 -0
- {yowasp_yosys-0.55.0.3.post946.dev0.dist-info → yowasp_yosys-0.56.0.0.post964.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* yosys -- Yosys Open SYnthesis Suite
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
|
5
|
+
*
|
|
6
|
+
* Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
* purpose with or without fee is hereby granted, provided that the above
|
|
8
|
+
* copyright notice and this permission notice appear in all copies.
|
|
9
|
+
*
|
|
10
|
+
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
11
|
+
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
12
|
+
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
13
|
+
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
14
|
+
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
15
|
+
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
16
|
+
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#ifndef LIBPARSE_H
|
|
21
|
+
#define LIBPARSE_H
|
|
22
|
+
|
|
23
|
+
#include "kernel/yosys.h"
|
|
24
|
+
#include <stdio.h>
|
|
25
|
+
#include <string>
|
|
26
|
+
#include <vector>
|
|
27
|
+
#include <set>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* This file is likely to change in the near future.
|
|
31
|
+
* Rely on it in your plugins at your own peril
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
namespace Yosys
|
|
35
|
+
{
|
|
36
|
+
struct LibertyAst
|
|
37
|
+
{
|
|
38
|
+
std::string id, value;
|
|
39
|
+
std::vector<std::string> args;
|
|
40
|
+
std::vector<LibertyAst*> children;
|
|
41
|
+
~LibertyAst();
|
|
42
|
+
const LibertyAst *find(std::string name) const;
|
|
43
|
+
|
|
44
|
+
typedef std::set<std::string> sieve;
|
|
45
|
+
void dump(FILE *f, sieve &blacklist, sieve &whitelist, std::string indent = "", std::string path = "", bool path_ok = false) const;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
struct LibertyExpression
|
|
49
|
+
{
|
|
50
|
+
struct Lexer {
|
|
51
|
+
std::string s, expr;
|
|
52
|
+
|
|
53
|
+
Lexer(std::string s) : s{s}, expr{s} {}
|
|
54
|
+
|
|
55
|
+
bool empty() { return s.empty();}
|
|
56
|
+
char peek() { return s[0]; }
|
|
57
|
+
std::string full_expr() { return expr; }
|
|
58
|
+
|
|
59
|
+
char next() {
|
|
60
|
+
char c = s[0];
|
|
61
|
+
s = s.substr(1, s.size());
|
|
62
|
+
return c;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
std::string pin() {
|
|
66
|
+
auto length = s.find_first_of("\t()'!^*& +|");
|
|
67
|
+
if (length == std::string::npos) {
|
|
68
|
+
// nothing found so use size of s
|
|
69
|
+
length = s.size();
|
|
70
|
+
}
|
|
71
|
+
auto pin = s.substr(0, length);
|
|
72
|
+
s = s.substr(length, s.size());
|
|
73
|
+
return pin;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
enum Kind {
|
|
78
|
+
AND,
|
|
79
|
+
OR,
|
|
80
|
+
NOT,
|
|
81
|
+
XOR,
|
|
82
|
+
// the standard specifies constants, but they're probably rare in practice.
|
|
83
|
+
PIN,
|
|
84
|
+
EMPTY
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
Kind kind;
|
|
88
|
+
std::string name;
|
|
89
|
+
std::vector<LibertyExpression> children;
|
|
90
|
+
|
|
91
|
+
LibertyExpression() : kind(Kind::EMPTY) {}
|
|
92
|
+
|
|
93
|
+
static LibertyExpression parse(Lexer &s, int min_prio = 0);
|
|
94
|
+
void get_pin_names(pool<std::string>& names);
|
|
95
|
+
bool eval(dict<std::string, bool>& values);
|
|
96
|
+
std::string str(int indent = 0);
|
|
97
|
+
private:
|
|
98
|
+
static bool is_nice_binop(char c);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
class LibertyInputStream {
|
|
102
|
+
std::istream &f;
|
|
103
|
+
std::vector<unsigned char> buffer;
|
|
104
|
+
size_t buf_pos = 0;
|
|
105
|
+
size_t buf_end = 0;
|
|
106
|
+
bool eof = false;
|
|
107
|
+
|
|
108
|
+
bool extend_buffer_once();
|
|
109
|
+
bool extend_buffer_at_least(size_t size = 1);
|
|
110
|
+
|
|
111
|
+
YS_COLD int get_cold();
|
|
112
|
+
YS_COLD int peek_cold(size_t offset);
|
|
113
|
+
|
|
114
|
+
public:
|
|
115
|
+
LibertyInputStream(std::istream &f) : f(f) {}
|
|
116
|
+
|
|
117
|
+
size_t buffered_size() { return buf_end - buf_pos; }
|
|
118
|
+
const unsigned char *buffered_data() { return buffer.data() + buf_pos; }
|
|
119
|
+
|
|
120
|
+
int get() {
|
|
121
|
+
if (buf_pos == buf_end)
|
|
122
|
+
return get_cold();
|
|
123
|
+
int c = buffer[buf_pos];
|
|
124
|
+
buf_pos += 1;
|
|
125
|
+
return c;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
int peek(size_t offset = 0) {
|
|
129
|
+
if (buf_pos + offset >= buf_end)
|
|
130
|
+
return peek_cold(offset);
|
|
131
|
+
return buffer[buf_pos + offset];
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
void consume(size_t n = 1) {
|
|
135
|
+
buf_pos += n;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
void unget() {
|
|
139
|
+
buf_pos -= 1;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
#ifndef FILTERLIB
|
|
144
|
+
class LibertyAstCache {
|
|
145
|
+
LibertyAstCache() {};
|
|
146
|
+
~LibertyAstCache() {};
|
|
147
|
+
public:
|
|
148
|
+
dict<std::string, std::shared_ptr<const LibertyAst>> cached;
|
|
149
|
+
|
|
150
|
+
bool cache_by_default = false;
|
|
151
|
+
bool verbose = false;
|
|
152
|
+
dict<std::string, bool> cache_path;
|
|
153
|
+
|
|
154
|
+
std::shared_ptr<const LibertyAst> cached_ast(const std::string &fname);
|
|
155
|
+
void parsed_ast(const std::string &fname, const std::shared_ptr<const LibertyAst> &ast);
|
|
156
|
+
static LibertyAstCache instance;
|
|
157
|
+
};
|
|
158
|
+
#endif
|
|
159
|
+
|
|
160
|
+
class LibertyMergedCells;
|
|
161
|
+
class LibertyParser
|
|
162
|
+
{
|
|
163
|
+
friend class LibertyMergedCells;
|
|
164
|
+
private:
|
|
165
|
+
LibertyInputStream f;
|
|
166
|
+
int line;
|
|
167
|
+
|
|
168
|
+
/* lexer return values:
|
|
169
|
+
'v': identifier, string, array range [...] -> str holds the token string
|
|
170
|
+
'n': newline
|
|
171
|
+
anything else is a single character.
|
|
172
|
+
*/
|
|
173
|
+
int lexer(std::string &str);
|
|
174
|
+
|
|
175
|
+
void report_unexpected_token(int tok);
|
|
176
|
+
void parse_vector_range(int tok);
|
|
177
|
+
LibertyAst *parse(bool top_level);
|
|
178
|
+
void error() const;
|
|
179
|
+
void error(const std::string &str) const;
|
|
180
|
+
|
|
181
|
+
public:
|
|
182
|
+
std::shared_ptr<const LibertyAst> shared_ast;
|
|
183
|
+
const LibertyAst *ast = nullptr;
|
|
184
|
+
|
|
185
|
+
LibertyParser(std::istream &f) : f(f), line(1) {
|
|
186
|
+
shared_ast.reset(parse(true));
|
|
187
|
+
ast = shared_ast.get();
|
|
188
|
+
if (!ast) {
|
|
189
|
+
#ifdef FILTERLIB
|
|
190
|
+
fprintf(stderr, "No entries found in liberty file.\n");
|
|
191
|
+
exit(1);
|
|
192
|
+
#else
|
|
193
|
+
log_error("No entries found in liberty file.\n");
|
|
194
|
+
#endif
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
#ifndef FILTERLIB
|
|
199
|
+
LibertyParser(std::istream &f, const std::string &fname) : f(f), line(1) {
|
|
200
|
+
shared_ast = LibertyAstCache::instance.cached_ast(fname);
|
|
201
|
+
if (!shared_ast) {
|
|
202
|
+
shared_ast.reset(parse(true));
|
|
203
|
+
LibertyAstCache::instance.parsed_ast(fname, shared_ast);
|
|
204
|
+
}
|
|
205
|
+
ast = shared_ast.get();
|
|
206
|
+
if (!ast) {
|
|
207
|
+
log_error("No entries found in liberty file `%s'.\n", fname.c_str());
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
#endif
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
class LibertyMergedCells
|
|
214
|
+
{
|
|
215
|
+
std::vector<std::shared_ptr<const LibertyAst>> asts;
|
|
216
|
+
|
|
217
|
+
public:
|
|
218
|
+
std::vector<const LibertyAst *> cells;
|
|
219
|
+
void merge(LibertyParser &parser)
|
|
220
|
+
{
|
|
221
|
+
if (parser.ast) {
|
|
222
|
+
const LibertyAst *ast = parser.ast;
|
|
223
|
+
asts.push_back(parser.shared_ast);
|
|
224
|
+
if (ast->id != "library")
|
|
225
|
+
parser.error("Top level entity isn't \"library\".\n");
|
|
226
|
+
for (const LibertyAst *cell : ast->children)
|
|
227
|
+
if (cell->id == "cell" && cell->args.size() == 1)
|
|
228
|
+
cells.push_back(cell);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
#endif
|
|
@@ -29,6 +29,8 @@ def parser_func(release_version='unknown SBY version'):
|
|
|
29
29
|
help="maximum number of processes to run in parallel")
|
|
30
30
|
parser.add_argument("--sequential", action="store_true", dest="sequential",
|
|
31
31
|
help="run tasks in sequence, not in parallel")
|
|
32
|
+
parser.add_argument("--live", action="append", choices=["csv", "jsonl"], dest="live_formats",
|
|
33
|
+
help="print live updates of property statuses during task execution, may be specified multiple times")
|
|
32
34
|
|
|
33
35
|
parser.add_argument("--autotune", action="store_true", dest="autotune",
|
|
34
36
|
help="automatically find a well performing engine and engine configuration for each task")
|
|
@@ -70,11 +72,22 @@ def parser_func(release_version='unknown SBY version'):
|
|
|
70
72
|
help="print the list of source files")
|
|
71
73
|
parser.add_argument("--setup", action="store_true", dest="setupmode",
|
|
72
74
|
help="set up the working directory and exit")
|
|
75
|
+
parser.add_argument("--link", action="store_true", dest="linkmode",
|
|
76
|
+
help="make symbolic links to source files instead of copying them")
|
|
73
77
|
|
|
74
78
|
parser.add_argument("--status", action="store_true", dest="status",
|
|
75
79
|
help="summarize the contents of the status database")
|
|
80
|
+
parser.add_argument("--statusfmt", action="store", default="", choices=["csv", "jsonl"], dest="status_format",
|
|
81
|
+
help="print the most recent status for each property in specified format")
|
|
82
|
+
parser.add_argument("--latest", action="store_true", dest="status_latest",
|
|
83
|
+
help="only check statuses from the most recent run of a task")
|
|
76
84
|
parser.add_argument("--statusreset", action="store_true", dest="status_reset",
|
|
77
85
|
help="reset the contents of the status database")
|
|
86
|
+
parser.add_argument("--statuscancels", action="store_true", dest="status_cancels",
|
|
87
|
+
help="intertask cancellations can be triggered by the status database")
|
|
88
|
+
|
|
89
|
+
parser.add_argument("--taskstatus", action="store_true", dest="task_status",
|
|
90
|
+
help="display the status of tasks in the status database")
|
|
78
91
|
|
|
79
92
|
parser.add_argument("--init-config-file", dest="init_config_file",
|
|
80
93
|
help="create a default .sby config file")
|