From aa7226233023dcd53a28de837de74fb60fa9d691 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sat, 22 Oct 2016 11:05:49 +0200 Subject: Added avail params to ilang format, check module params in 'hierarchy -check' --- frontends/ast/ast.cc | 9 +++++++-- frontends/ilang/ilang_parser.y | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'frontends') diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index fd2724009..92513a244 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -934,10 +934,15 @@ static AstModule* process_module(AstNode *ast, bool defer) if (flag_lib) { std::vector new_children; for (auto child : ast->children) { - if (child->type == AST_WIRE && (child->is_input || child->is_output)) + if (child->type == AST_WIRE && (child->is_input || child->is_output)) { new_children.push_back(child); - else + } else if (child->type == AST_PARAMETER) { + child->delete_children(); + child->children.push_back(AstNode::mkconst_int(0, false, 0)); + new_children.push_back(child); + } else { delete child; + } } ast->children.swap(new_children); ast->attributes["\\blackbox"] = AstNode::mkconst_int(1, false); diff --git a/frontends/ilang/ilang_parser.y b/frontends/ilang/ilang_parser.y index fe5f23d66..bfc062fec 100644 --- a/frontends/ilang/ilang_parser.y +++ b/frontends/ilang/ilang_parser.y @@ -112,7 +112,13 @@ module_body: /* empty */; module_stmt: - attr_stmt | wire_stmt | memory_stmt | cell_stmt | proc_stmt | conn_stmt; + param_stmt | attr_stmt | wire_stmt | memory_stmt | cell_stmt | proc_stmt | conn_stmt; + +param_stmt: + TOK_PARAMETER TOK_ID EOL { + current_module->avail_parameters.insert($2); + free($2); + }; attr_stmt: TOK_ATTRIBUTE TOK_ID constant EOL { -- cgit v1.2.3