mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-15 13:28:59 +00:00
Merge remote-tracking branch 'origin/master' into xaig_arrival
This commit is contained in:
commit
ba629e6a28
6
Makefile
6
Makefile
|
@ -88,7 +88,7 @@ ifeq ($(OS), Darwin)
|
||||||
PLUGIN_LDFLAGS += -undefined dynamic_lookup
|
PLUGIN_LDFLAGS += -undefined dynamic_lookup
|
||||||
|
|
||||||
# homebrew search paths
|
# homebrew search paths
|
||||||
ifneq ($(shell which brew),)
|
ifneq ($(shell command -v brew),)
|
||||||
BREW_PREFIX := $(shell brew --prefix)/opt
|
BREW_PREFIX := $(shell brew --prefix)/opt
|
||||||
$(info $$BREW_PREFIX is [${BREW_PREFIX}])
|
$(info $$BREW_PREFIX is [${BREW_PREFIX}])
|
||||||
ifeq ($(ENABLE_PYOSYS),1)
|
ifeq ($(ENABLE_PYOSYS),1)
|
||||||
|
@ -102,8 +102,8 @@ PKG_CONFIG_PATH := $(BREW_PREFIX)/tcl-tk/lib/pkgconfig:$(PKG_CONFIG_PATH)
|
||||||
export PATH := $(BREW_PREFIX)/bison/bin:$(BREW_PREFIX)/gettext/bin:$(BREW_PREFIX)/flex/bin:$(PATH)
|
export PATH := $(BREW_PREFIX)/bison/bin:$(BREW_PREFIX)/gettext/bin:$(BREW_PREFIX)/flex/bin:$(PATH)
|
||||||
|
|
||||||
# macports search paths
|
# macports search paths
|
||||||
else ifneq ($(shell which port),)
|
else ifneq ($(shell command -v port),)
|
||||||
PORT_PREFIX := $(patsubst %/bin/port,%,$(shell which port))
|
PORT_PREFIX := $(patsubst %/bin/port,%,$(shell command -v port))
|
||||||
CXXFLAGS += -I$(PORT_PREFIX)/include
|
CXXFLAGS += -I$(PORT_PREFIX)/include
|
||||||
LDFLAGS += -L$(PORT_PREFIX)/lib
|
LDFLAGS += -L$(PORT_PREFIX)/lib
|
||||||
PKG_CONFIG_PATH := $(PORT_PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
|
PKG_CONFIG_PATH := $(PORT_PREFIX)/lib/pkgconfig:$(PKG_CONFIG_PATH)
|
||||||
|
|
|
@ -1099,6 +1099,13 @@ static AstModule* process_module(AstNode *ast, bool defer, AstNode *original_ast
|
||||||
|
|
||||||
ignoreThisSignalsInInitial = RTLIL::SigSpec();
|
ignoreThisSignalsInInitial = RTLIL::SigSpec();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for (auto &attr : ast->attributes) {
|
||||||
|
if (attr.second->type != AST_CONSTANT)
|
||||||
|
continue;
|
||||||
|
current_module->attributes[attr.first] = attr.second->asAttrConst();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ast->type == AST_INTERFACE)
|
if (ast->type == AST_INTERFACE)
|
||||||
current_module->set_bool_attribute("\\is_interface");
|
current_module->set_bool_attribute("\\is_interface");
|
||||||
|
|
|
@ -808,6 +808,30 @@ struct HierarchyPass : public Pass {
|
||||||
if (mod_it.second->get_bool_attribute("\\top"))
|
if (mod_it.second->get_bool_attribute("\\top"))
|
||||||
top_mod = mod_it.second;
|
top_mod = mod_it.second;
|
||||||
|
|
||||||
|
if (top_mod != nullptr && top_mod->name.begins_with("$abstract")) {
|
||||||
|
IdString top_name = top_mod->name.substr(strlen("$abstract"));
|
||||||
|
|
||||||
|
dict<RTLIL::IdString, RTLIL::Const> top_parameters;
|
||||||
|
for (auto ¶ : parameters) {
|
||||||
|
SigSpec sig_value;
|
||||||
|
if (!RTLIL::SigSpec::parse(sig_value, NULL, para.second))
|
||||||
|
log_cmd_error("Can't decode value '%s'!\n", para.second.c_str());
|
||||||
|
top_parameters[RTLIL::escape_id(para.first)] = sig_value.as_const();
|
||||||
|
}
|
||||||
|
|
||||||
|
top_mod = design->module(top_mod->derive(design, top_parameters));
|
||||||
|
|
||||||
|
if (top_mod != nullptr && top_mod->name != top_name) {
|
||||||
|
Module *m = top_mod->clone();
|
||||||
|
m->name = top_name;
|
||||||
|
Module *old_mod = design->module(top_name);
|
||||||
|
if (old_mod)
|
||||||
|
design->remove(old_mod);
|
||||||
|
design->add(m);
|
||||||
|
top_mod = m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (top_mod == nullptr && auto_top_mode) {
|
if (top_mod == nullptr && auto_top_mode) {
|
||||||
log_header(design, "Finding top of design hierarchy..\n");
|
log_header(design, "Finding top of design hierarchy..\n");
|
||||||
dict<Module*, int> db;
|
dict<Module*, int> db;
|
||||||
|
|
|
@ -12,7 +12,7 @@ done
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
# check for Icarus Verilog
|
# check for Icarus Verilog
|
||||||
if ! which iverilog > /dev/null ; then
|
if ! command -v iverilog > /dev/null ; then
|
||||||
echo "$0: Error: Icarus Verilog 'iverilog' not found."
|
echo "$0: Error: Icarus Verilog 'iverilog' not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -12,7 +12,7 @@ done
|
||||||
shift "$((OPTIND-1))"
|
shift "$((OPTIND-1))"
|
||||||
|
|
||||||
# check for Icarus Verilog
|
# check for Icarus Verilog
|
||||||
if ! which iverilog > /dev/null ; then
|
if ! command -v iverilog > /dev/null ; then
|
||||||
echo "$0: Error: Icarus Verilog 'iverilog' not found."
|
echo "$0: Error: Icarus Verilog 'iverilog' not found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
27
tests/various/hierarchy_defer.ys
Normal file
27
tests/various/hierarchy_defer.ys
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
read -noverific
|
||||||
|
read -vlog2k <<EOT
|
||||||
|
module first;
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* top *)
|
||||||
|
module top(input i, output o);
|
||||||
|
sub s0(i, o);
|
||||||
|
endmodule
|
||||||
|
|
||||||
|
(* constant_expression=1+1?2*2:3/3 *)
|
||||||
|
module sub(input i, output o);
|
||||||
|
assign o = ~i;
|
||||||
|
endmodule
|
||||||
|
EOT
|
||||||
|
design -save read
|
||||||
|
|
||||||
|
hierarchy -auto-top
|
||||||
|
select -assert-any top
|
||||||
|
select -assert-any sub
|
||||||
|
select -assert-none foo
|
||||||
|
|
||||||
|
design -load read
|
||||||
|
hierarchy
|
||||||
|
select -assert-any top
|
||||||
|
select -assert-any sub
|
||||||
|
select -assert-none foo
|
Loading…
Reference in a new issue