mirror of https://github.com/YosysHQ/yosys.git
Merge remote-tracking branch 'origin/master' into xc7dsp
This commit is contained in:
commit
3732d421c5
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)
|
||||||
|
|
|
@ -261,11 +261,12 @@ struct XAigerWriter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bool cell_known = cell->known();
|
bool cell_known = inst_module || cell->known();
|
||||||
for (const auto &c : cell->connections()) {
|
for (const auto &c : cell->connections()) {
|
||||||
if (c.second.is_fully_const()) continue;
|
if (c.second.is_fully_const()) continue;
|
||||||
auto is_input = !cell_known || cell->input(c.first);
|
auto port_wire = inst_module ? inst_module->wire(c.first) : nullptr;
|
||||||
auto is_output = !cell_known || cell->output(c.first);
|
auto is_input = (port_wire && port_wire->port_input) || !cell_known || cell->input(c.first);
|
||||||
|
auto is_output = (port_wire && port_wire->port_output) || !cell_known || cell->output(c.first);
|
||||||
if (!is_input && !is_output)
|
if (!is_input && !is_output)
|
||||||
log_error("Connection '%s' on cell '%s' (type '%s') not recognised!\n", log_id(c.first), log_id(cell), log_id(cell->type));
|
log_error("Connection '%s' on cell '%s' (type '%s') not recognised!\n", log_id(c.first), log_id(cell), log_id(cell->type));
|
||||||
|
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -664,7 +664,7 @@ static void select_stmt(RTLIL::Design *design, std::string arg)
|
||||||
} else
|
} else
|
||||||
if (arg == "%D") {
|
if (arg == "%D") {
|
||||||
if (work_stack.size() < 2)
|
if (work_stack.size() < 2)
|
||||||
log_cmd_error("Must have at least two elements on the stack for operator %%d.\n");
|
log_cmd_error("Must have at least two elements on the stack for operator %%D.\n");
|
||||||
select_op_diff(design, work_stack[work_stack.size()-1], work_stack[work_stack.size()-2]);
|
select_op_diff(design, work_stack[work_stack.size()-1], work_stack[work_stack.size()-2]);
|
||||||
work_stack[work_stack.size()-2] = work_stack[work_stack.size()-1];
|
work_stack[work_stack.size()-2] = work_stack[work_stack.size()-1];
|
||||||
work_stack.pop_back();
|
work_stack.pop_back();
|
||||||
|
@ -693,7 +693,7 @@ static void select_stmt(RTLIL::Design *design, std::string arg)
|
||||||
} else
|
} else
|
||||||
if (arg == "%C") {
|
if (arg == "%C") {
|
||||||
if (work_stack.size() < 1)
|
if (work_stack.size() < 1)
|
||||||
log_cmd_error("Must have at least one element on the stack for operator %%M.\n");
|
log_cmd_error("Must have at least one element on the stack for operator %%C.\n");
|
||||||
select_op_module_to_cells(design, work_stack[work_stack.size()-1]);
|
select_op_module_to_cells(design, work_stack[work_stack.size()-1]);
|
||||||
} else
|
} else
|
||||||
if (arg == "%c") {
|
if (arg == "%c") {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -229,14 +229,15 @@ module TRELLIS_FF(input CLK, LSR, CE, DI, M, output reg Q);
|
||||||
parameter REGSET = "RESET";
|
parameter REGSET = "RESET";
|
||||||
parameter [127:0] LSRMODE = "LSR";
|
parameter [127:0] LSRMODE = "LSR";
|
||||||
|
|
||||||
reg muxce;
|
wire muxce;
|
||||||
always @(*)
|
generate
|
||||||
case (CEMUX)
|
case (CEMUX)
|
||||||
"1": muxce = 1'b1;
|
"1": assign muxce = 1'b1;
|
||||||
"0": muxce = 1'b0;
|
"0": assign muxce = 1'b0;
|
||||||
"INV": muxce = ~CE;
|
"INV": assign muxce = ~CE;
|
||||||
default: muxce = CE;
|
default: assign muxce = CE;
|
||||||
endcase
|
endcase
|
||||||
|
endgenerate
|
||||||
|
|
||||||
wire muxlsr = (LSRMUX == "INV") ? ~LSR : LSR;
|
wire muxlsr = (LSRMUX == "INV") ? ~LSR : LSR;
|
||||||
wire muxclk = (CLKMUX == "INV") ? ~CLK : CLK;
|
wire muxclk = (CLKMUX == "INV") ? ~CLK : CLK;
|
||||||
|
|
|
@ -124,7 +124,7 @@ struct Ecp5GsrPass : public Pass {
|
||||||
SigBit lsr = sigmap(sig_lsr[0]);
|
SigBit lsr = sigmap(sig_lsr[0]);
|
||||||
if (!inverted_gsr.count(lsr))
|
if (!inverted_gsr.count(lsr))
|
||||||
continue;
|
continue;
|
||||||
cell->setParam(ID(SRMODE), Const("SYNC"));
|
cell->setParam(ID(SRMODE), Const("LSR_OVER_CE"));
|
||||||
cell->unsetPort(ID(LSR));
|
cell->unsetPort(ID(LSR));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
Example from: https://www.latticesemi.com/-/media/LatticeSemi/Documents/UserManuals/EI/iCEcube201701UserGuide.ashx?document_id=52071 [p. 77].
|
Example from: https://www.latticesemi.com/-/media/LatticeSemi/Documents/UserManuals/EI/iCEcube201701UserGuide.ashx?document_id=52071 [p. 77].
|
||||||
*/
|
*/
|
||||||
module top(clk,a,b,c,set);
|
module top(clk,a,b,c,set);
|
||||||
parameter A_WIDTH = 4;
|
parameter A_WIDTH = 6 /*4*/;
|
||||||
parameter B_WIDTH = 3;
|
parameter B_WIDTH = 6 /*3*/;
|
||||||
input set;
|
input set;
|
||||||
input clk;
|
input clk;
|
||||||
input signed [(A_WIDTH - 1):0] a;
|
input signed [(A_WIDTH - 1):0] a;
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
read_verilog macc.v
|
read_verilog macc.v
|
||||||
proc
|
proc
|
||||||
hierarchy -top top
|
hierarchy -top top
|
||||||
equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 -dsp # equivalency check
|
#equiv_opt -assert -map +/ice40/cells_sim.v synth_ice40 -dsp # equivalency check
|
||||||
|
|
||||||
|
equiv_opt -run :prove -map +/ice40/cells_sim.v synth_ice40 -dsp
|
||||||
|
async2sync
|
||||||
|
equiv_opt -run prove: -assert null
|
||||||
|
|
||||||
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
|
||||||
cd top # Constrain all select calls below inside the top module
|
cd top # Constrain all select calls below inside the top module
|
||||||
select -assert-count 38 t:SB_LUT4
|
select -assert-count 1 t:SB_MAC16
|
||||||
select -assert-count 3 t:SB_CARRY
|
select -assert-none t:SB_MAC16 %% t:* %D
|
||||||
select -assert-count 7 t:SB_DFFSR
|
|
||||||
select -assert-none t:SB_LUT4 t:SB_CARRY t:SB_DFFSR %% t:* %D
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 New Issue