mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #2658 from zachjs/parameters-across-files
sv: allow globals in one file to depend on globals in another
This commit is contained in:
commit
e178d0367a
|
@ -1288,7 +1288,6 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump
|
||||||
// must be global definition
|
// must be global definition
|
||||||
if ((*it)->type == AST_PARAMETER)
|
if ((*it)->type == AST_PARAMETER)
|
||||||
(*it)->type = AST_LOCALPARAM; // cannot be overridden
|
(*it)->type = AST_LOCALPARAM; // cannot be overridden
|
||||||
(*it)->simplify(false, false, false, 1, -1, false, false); //process enum/other declarations
|
|
||||||
design->verilog_globals.push_back((*it)->clone());
|
design->verilog_globals.push_back((*it)->clone());
|
||||||
current_scope.clear();
|
current_scope.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,7 @@ void AstNode::annotateTypedEnums(AstNode *template_node)
|
||||||
log_assert(current_scope.count(enum_type) == 1);
|
log_assert(current_scope.count(enum_type) == 1);
|
||||||
AstNode *enum_node = current_scope.at(enum_type);
|
AstNode *enum_node = current_scope.at(enum_type);
|
||||||
log_assert(enum_node->type == AST_ENUM);
|
log_assert(enum_node->type == AST_ENUM);
|
||||||
|
while (enum_node->simplify(true, false, false, 1, -1, false, true)) { }
|
||||||
//get width from 1st enum item:
|
//get width from 1st enum item:
|
||||||
log_assert(enum_node->children.size() >= 1);
|
log_assert(enum_node->children.size() >= 1);
|
||||||
AstNode *enum_item0 = enum_node->children[0];
|
AstNode *enum_item0 = enum_node->children[0];
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
read_verilog -sv <<EOF
|
||||||
|
parameter Q = 1;
|
||||||
|
EOF
|
||||||
|
read_verilog -sv <<EOF
|
||||||
|
parameter P = Q;
|
||||||
|
module top(
|
||||||
|
output integer out
|
||||||
|
);
|
||||||
|
assign out = P;
|
||||||
|
always @*
|
||||||
|
assert (out == 1);
|
||||||
|
endmodule
|
||||||
|
EOF
|
||||||
|
|
||||||
|
hierarchy
|
||||||
|
proc
|
||||||
|
flatten
|
||||||
|
opt -full
|
||||||
|
select -module top
|
||||||
|
sat -verify -seq 1 -tempinduct -prove-asserts -show-all
|
Loading…
Reference in New Issue