mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-13 01:16:16 +00:00
Merge pull request #687 from trcwm/master
Liberty file: error when it contains pin references to non-existing pins
This commit is contained in:
commit
68304c6d17
2 changed files with 10 additions and 4 deletions
|
@ -100,6 +100,9 @@ static bool parse_pin(LibertyAst *cell, LibertyAst *attr, std::string &pin_name,
|
||||||
for (auto child : cell->children)
|
for (auto child : cell->children)
|
||||||
if (child->id == "pin" && child->args.size() == 1 && child->args[0] == pin_name)
|
if (child->id == "pin" && child->args.size() == 1 && child->args[0] == pin_name)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
log_error("Malformed liberty file - cannot find pin '%s' in cell '%s'.\n", pin_name.c_str(), cell->args[0].c_str());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ int LibertyParser::lexer(std::string &str)
|
||||||
|
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
line++;
|
line++;
|
||||||
return ';';
|
return 'n';
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (c >= 32 && c < 255)
|
// if (c >= 32 && c < 255)
|
||||||
|
@ -175,7 +175,7 @@ LibertyAst *LibertyParser::parse()
|
||||||
|
|
||||||
int tok = lexer(str);
|
int tok = lexer(str);
|
||||||
|
|
||||||
while (tok == ';')
|
while (tok == 'n')
|
||||||
tok = lexer(str);
|
tok = lexer(str);
|
||||||
|
|
||||||
if (tok == '}' || tok < 0)
|
if (tok == '}' || tok < 0)
|
||||||
|
@ -194,6 +194,9 @@ LibertyAst *LibertyParser::parse()
|
||||||
if (tok == ';')
|
if (tok == ';')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
if (tok == 'n')
|
||||||
|
continue;
|
||||||
|
|
||||||
if (tok == ':' && ast->value.empty()) {
|
if (tok == ':' && ast->value.empty()) {
|
||||||
tok = lexer(ast->value);
|
tok = lexer(ast->value);
|
||||||
if (tok != 'v')
|
if (tok != 'v')
|
||||||
|
@ -249,14 +252,14 @@ LibertyAst *LibertyParser::parse()
|
||||||
|
|
||||||
void LibertyParser::error()
|
void LibertyParser::error()
|
||||||
{
|
{
|
||||||
log_error("Syntax error in line %d.\n", line);
|
log_error("Syntax error in liberty file on line %d.\n", line);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void LibertyParser::error()
|
void LibertyParser::error()
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Syntax error in line %d.\n", line);
|
fprintf(stderr, "Syntax error in liberty file on line %d.\n", line);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue