Skip to content

Commit 4a2bbb6

Browse files
committed
yosys 0.32
yosys: Updating yosys/ (external git subtree from https://github.com/YosysHQ/yosys.git yosys-0.32)
2 parents 9f77215 + 1894540 commit 4a2bbb6

33 files changed

+962
-465
lines changed

yosys/CHANGELOG

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
List of major changes and improvements between releases
33
=======================================================
44

5+
Yosys 0.31 .. Yosys 0.32
6+
--------------------------
7+
* Verific support
8+
- Added sub option "-lib" to reading commands for VHDL and
9+
SystemVerilog, that will later import all units/modules from
10+
marked files as blackboxes.
11+
12+
* Various
13+
- Added support for $lt, $le, $gt, $ge to the code generating AIGs.
14+
515
Yosys 0.30 .. Yosys 0.31
616
--------------------------
717
* New commands and options

yosys/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ LDLIBS += -lrt
141141
endif
142142
endif
143143

144-
YOSYS_VER := 0.31
144+
YOSYS_VER := 0.32
145145

146146
# Note: We arrange for .gitcommit to contain the (short) commit hash in
147147
# tarballs generated with git-archive(1) using .gitattributes. The git repo
@@ -157,7 +157,7 @@ endif
157157
OBJS = kernel/version_$(GIT_REV).o
158158

159159
bumpversion:
160-
# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline f7a8284.. | wc -l`/;" Makefile
160+
# sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline f3c6b41.. | wc -l`/;" Makefile
161161

162162
# set 'ABCREV = default' to use abc/ as it is
163163
#
@@ -612,6 +612,7 @@ $(eval $(call add_include_file,kernel/log.h))
612612
$(eval $(call add_include_file,kernel/rtlil.h))
613613
$(eval $(call add_include_file,kernel/binding.h))
614614
$(eval $(call add_include_file,kernel/register.h))
615+
$(eval $(call add_include_file,kernel/cellaigs.h))
615616
$(eval $(call add_include_file,kernel/celltypes.h))
616617
$(eval $(call add_include_file,kernel/celledges.h))
617618
$(eval $(call add_include_file,kernel/consteval.h))
@@ -628,6 +629,8 @@ ifeq ($(ENABLE_ZLIB),1)
628629
$(eval $(call add_include_file,kernel/fstdata.h))
629630
endif
630631
$(eval $(call add_include_file,kernel/mem.h))
632+
$(eval $(call add_include_file,kernel/yw.h))
633+
$(eval $(call add_include_file,kernel/json.h))
631634
$(eval $(call add_include_file,libs/ezsat/ezsat.h))
632635
$(eval $(call add_include_file,libs/ezsat/ezminisat.h))
633636
ifeq ($(ENABLE_ZLIB),1)

yosys/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ reading and elaborating the design using the Verilog frontend:
156156
yosys> read -sv tests/simple/fiedler-cooley.v
157157
yosys> hierarchy -top up3down5
158158

159-
writing the design to the console in Yosys's internal format:
159+
writing the design to the console in the RTLIL format used by Yosys
160+
internally:
160161

161-
yosys> write_ilang
162+
yosys> write_rtlil
162163

163164
convert processes (``always`` blocks) to netlist elements and perform
164165
some simple optimizations:

yosys/backends/blif/blif.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ struct BlifBackend : public Backend {
512512
log(" suppresses the generation of this nets without fanout.\n");
513513
log("\n");
514514
log("The following options can be useful when the generated file is not going to be\n");
515-
log("read by a BLIF parser but a custom tool. It is recommended to not name the\n");
516-
log("output file *.blif when any of this options is used.\n");
515+
log("read by a BLIF parser but a custom tool. It is recommended not to name the\n");
516+
log("output file *.blif when any of these options are used.\n");
517517
log("\n");
518518
log(" -icells\n");
519519
log(" do not translate Yosys's internal gates to generic BLIF logic\n");

yosys/backends/firrtl/firrtl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "kernel/register.h"
2222
#include "kernel/sigtools.h"
2323
#include "kernel/celltypes.h"
24-
#include "kernel/cellaigs.h"
2524
#include "kernel/log.h"
2625
#include "kernel/mem.h"
2726
#include <algorithm>
@@ -1196,6 +1195,7 @@ struct FirrtlBackend : public Backend {
11961195
log(" pmuxtree\n");
11971196
log(" bmuxmap\n");
11981197
log(" demuxmap\n");
1198+
log(" bwmuxmap\n");
11991199
log("\n");
12001200
}
12011201
void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) override

yosys/backends/jny/jny.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "kernel/register.h"
2222
#include "kernel/sigtools.h"
2323
#include "kernel/celltypes.h"
24-
#include "kernel/cellaigs.h"
2524
#include "kernel/log.h"
2625
#include <string>
2726
#include <algorithm>

yosys/backends/smt2/smtio.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def setup(self):
245245
self.logic_uf = False
246246
self.unroll_idcnt = 0
247247
self.unroll_buffer = ""
248+
self.unroll_level = 0
248249
self.unroll_sorts = set()
249250
self.unroll_objs = set()
250251
self.unroll_decls = dict()
@@ -420,13 +421,15 @@ def write(self, stmt, unroll=True):
420421
self.p_close()
421422

422423
if unroll and self.unroll:
423-
stmt = self.unroll_buffer + stmt
424-
self.unroll_buffer = ""
425-
426424
s = re.sub(r"\|[^|]*\|", "", stmt)
427-
if s.count("(") != s.count(")"):
428-
self.unroll_buffer = stmt + " "
425+
self.unroll_level += s.count("(") - s.count(")")
426+
if self.unroll_level > 0:
427+
self.unroll_buffer += stmt
428+
self.unroll_buffer += " "
429429
return
430+
else:
431+
stmt = self.unroll_buffer + stmt
432+
self.unroll_buffer = ""
430433

431434
s = self.parse(stmt)
432435

yosys/backends/verilog/verilog_backend.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ PRIVATE_NAMESPACE_BEGIN
3737

3838
bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, extmem, defparam, decimal, siminit, systemverilog, simple_lhs, noparallelcase;
3939
int auto_name_counter, auto_name_offset, auto_name_digits, extmem_counter;
40-
std::map<RTLIL::IdString, int> auto_name_map;
40+
dict<RTLIL::IdString, int> auto_name_map;
4141
std::set<RTLIL::IdString> reg_wires;
4242
std::string auto_prefix, extmem_prefix;
4343

@@ -129,7 +129,7 @@ std::string id(RTLIL::IdString internal_id, bool may_rename = true)
129129
break;
130130
}
131131

132-
const pool<string> keywords = {
132+
static const pool<string> keywords = {
133133
// IEEE 1800-2017 Annex B
134134
"accept_on", "alias", "always", "always_comb", "always_ff", "always_latch", "and", "assert", "assign", "assume", "automatic", "before",
135135
"begin", "bind", "bins", "binsof", "bit", "break", "buf", "bufif0", "bufif1", "byte", "case", "casex", "casez", "cell", "chandle",

yosys/frontends/ast/ast.cc

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool AstNode::get_bool_attribute(RTLIL::IdString id)
192192

193193
AstNode *attr = attributes.at(id);
194194
if (attr->type != AST_CONSTANT)
195-
log_file_error(attr->filename, attr->location.first_line, "Attribute `%s' with non-constant value!\n", id.c_str());
195+
attr->input_error("Attribute `%s' with non-constant value!\n", id.c_str());
196196

197197
return attr->integer != 0;
198198
}
@@ -1039,7 +1039,7 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
10391039
{
10401040
for (const AstNode *node : ast->children)
10411041
if (node->type == AST_PARAMETER && param_has_no_default(node))
1042-
log_file_error(node->filename, node->location.first_line, "Parameter `%s' has no default value and has not been overridden!\n", node->str.c_str());
1042+
node->input_error("Parameter `%s' has no default value and has not been overridden!\n", node->str.c_str());
10431043

10441044
bool blackbox_module = flag_lib;
10451045

@@ -1061,7 +1061,7 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
10611061
// simplify this module or interface using the current design as context
10621062
// for lookup up ports and wires within cells
10631063
set_simplify_design_context(design);
1064-
while (ast->simplify(!flag_noopt, false, false, 0, -1, false, false)) { }
1064+
while (ast->simplify(!flag_noopt, false, 0, -1, false, false)) { }
10651065
set_simplify_design_context(nullptr);
10661066

10671067
if (flag_dump_ast2) {
@@ -1099,22 +1099,22 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
10991099
if (!blackbox_module && ast->attributes.count(ID::blackbox)) {
11001100
AstNode *n = ast->attributes.at(ID::blackbox);
11011101
if (n->type != AST_CONSTANT)
1102-
log_file_error(ast->filename, ast->location.first_line, "Got blackbox attribute with non-constant value!\n");
1102+
ast->input_error("Got blackbox attribute with non-constant value!\n");
11031103
blackbox_module = n->asBool();
11041104
}
11051105

11061106
if (blackbox_module && ast->attributes.count(ID::whitebox)) {
11071107
AstNode *n = ast->attributes.at(ID::whitebox);
11081108
if (n->type != AST_CONSTANT)
1109-
log_file_error(ast->filename, ast->location.first_line, "Got whitebox attribute with non-constant value!\n");
1109+
ast->input_error("Got whitebox attribute with non-constant value!\n");
11101110
blackbox_module = !n->asBool();
11111111
}
11121112

11131113
if (ast->attributes.count(ID::noblackbox)) {
11141114
if (blackbox_module) {
11151115
AstNode *n = ast->attributes.at(ID::noblackbox);
11161116
if (n->type != AST_CONSTANT)
1117-
log_file_error(ast->filename, ast->location.first_line, "Got noblackbox attribute with non-constant value!\n");
1117+
ast->input_error("Got noblackbox attribute with non-constant value!\n");
11181118
blackbox_module = !n->asBool();
11191119
}
11201120
delete ast->attributes.at(ID::noblackbox);
@@ -1158,7 +1158,7 @@ static RTLIL::Module *process_module(RTLIL::Design *design, AstNode *ast, bool d
11581158

11591159
for (auto &attr : ast->attributes) {
11601160
if (attr.second->type != AST_CONSTANT)
1161-
log_file_error(ast->filename, ast->location.first_line, "Attribute `%s' with non-constant value!\n", attr.first.c_str());
1161+
ast->input_error("Attribute `%s' with non-constant value!\n", attr.first.c_str());
11621162
module->attributes[attr.first] = attr.second->asAttrConst();
11631163
}
11641164
for (size_t i = 0; i < ast->children.size(); i++) {
@@ -1361,7 +1361,7 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump
13611361
}
13621362
else if (child->type == AST_PACKAGE) {
13631363
// process enum/other declarations
1364-
child->simplify(true, false, false, 1, -1, false, false);
1364+
child->simplify(true, false, 1, -1, false, false);
13651365
rename_in_package_stmts(child);
13661366
design->verilog_packages.push_back(child->clone());
13671367
current_scope.clear();
@@ -1841,4 +1841,11 @@ void AstModule::loadconfig() const
18411841
flag_autowire = autowire;
18421842
}
18431843

1844+
void AstNode::input_error(const char *format, ...) const
1845+
{
1846+
va_list ap;
1847+
va_start(ap, format);
1848+
logv_file_error(filename, location.first_line, format, ap);
1849+
}
1850+
18441851
YOSYS_NAMESPACE_END

yosys/frontends/ast/ast.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ namespace AST
250250

251251
// simplify() creates a simpler AST by unrolling for-loops, expanding generate blocks, etc.
252252
// it also sets the id2ast pointers so that identifier lookups are fast in genRTLIL()
253-
bool simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, int width_hint, bool sign_hint, bool in_param);
253+
bool simplify(bool const_fold, bool in_lvalue, int stage, int width_hint, bool sign_hint, bool in_param);
254254
void replace_result_wire_name_in_function(const std::string &from, const std::string &to);
255255
AstNode *readmem(bool is_readmemh, std::string mem_filename, AstNode *memory, int start_addr, int finish_addr, bool unconditional_init);
256256
void expand_genblock(const std::string &prefix);
@@ -335,6 +335,13 @@ namespace AST
335335

336336
// Helper for looking up identifiers which are prefixed with the current module name
337337
std::string try_pop_module_prefix() const;
338+
339+
// helper to clone the node with some of its subexpressions replaced with zero (this is used
340+
// to evaluate widths of dynamic ranges)
341+
AstNode *clone_at_zero();
342+
343+
// helper to print errors from simplify/genrtlil code
344+
[[noreturn]] void input_error(const char *format, ...) const YS_ATTRIBUTE(format(printf, 2, 3));
338345
};
339346

340347
// process an AST tree (ast must point to an AST_DESIGN node) and generate RTLIL code

0 commit comments

Comments
 (0)