diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-08-29 09:02:10 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-29 09:02:10 -0700 |
commit | 6510297712729f9742d00f6a4cd4fc3a0e530758 (patch) | |
tree | 3cf2c274b13ceca9f25f5ff64541b2cac5dc1522 /frontends/ast/ast.cc | |
parent | 116c2496011aeeac9847d69af597a0db58209793 (diff) | |
download | yosys-6510297712729f9742d00f6a4cd4fc3a0e530758.tar.gz yosys-6510297712729f9742d00f6a4cd4fc3a0e530758.tar.bz2 yosys-6510297712729f9742d00f6a4cd4fc3a0e530758.zip |
Restore non-deferred code, deferred case to ignore non constant attr
Diffstat (limited to 'frontends/ast/ast.cc')
-rw-r--r-- | frontends/ast/ast.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 6a91c418b..01e865557 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -1073,6 +1073,12 @@ static AstModule* process_module(AstNode *ast, bool defer, AstNode *original_ast ignoreThisSignalsInInitial = RTLIL::SigSpec(); + for (auto &attr : ast->attributes) { + if (attr.second->type != AST_CONSTANT) + log_file_error(ast->filename, ast->linenum, "Attribute `%s' with non-constant value!\n", attr.first.c_str()); + current_module->attributes[attr.first] = attr.second->asAttrConst(); + } + for (size_t i = 0; i < ast->children.size(); i++) { AstNode *node = ast->children[i]; if (node->type == AST_WIRE || node->type == AST_MEMORY) @@ -1094,11 +1100,12 @@ static AstModule* process_module(AstNode *ast, bool defer, AstNode *original_ast ignoreThisSignalsInInitial = RTLIL::SigSpec(); } - - for (auto &attr : ast->attributes) { - if (attr.second->type != AST_CONSTANT) - log_file_error(ast->filename, ast->linenum, "Attribute `%s' with non-constant value!\n", attr.first.c_str()); - current_module->attributes[attr.first] = attr.second->asAttrConst(); + 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) |