Skip to content

Commit b0f3a94

Browse files
committed
Add usage check to readmemh
Signed-off-by: Kamil Rakoczy <[email protected]>
1 parent b79ad0d commit b0f3a94

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ static void check_memories(AST::AstNode *module_node)
281281
std::map<std::string, AST::AstNode *> memories;
282282
visitEachDescendantStatic(module_node, [&](AST::AstNode *node) {
283283
if (node->str == "\\$readmemh") {
284+
if (node->children.size() != 2 || node->children[1]->str.empty() || node->children[1]->type != AST::AST_IDENTIFIER) {
285+
log_error("%s:%d: Wrong usage of '\\$readmemh'\n", node->filename.c_str(), node->location.first_line);
286+
}
284287
add_force_convert_attribute(memories[node->children[1]->str], 0);
285288
}
286289
if (node->type == AST::AST_WIRE) {

0 commit comments

Comments
 (0)