diff options
author | Eddie Hung <eddie@fpgeh.com> | 2020-01-27 14:22:46 -0800 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2020-01-27 14:22:46 -0800 |
commit | 21ce1b37fbc93562942c10f631c7f415f8fdba2e (patch) | |
tree | e6126408287223cec556ff7ed7b8c026c81bb958 /passes/techmap | |
parent | e0bdf5d7a9280c9f975a34fc265793de86fd9bec (diff) | |
download | yosys-21ce1b37fbc93562942c10f631c7f415f8fdba2e.tar.gz yosys-21ce1b37fbc93562942c10f631c7f415f8fdba2e.tar.bz2 yosys-21ce1b37fbc93562942c10f631c7f415f8fdba2e.zip |
abc9_ops: -check for negative arrival/required times
Diffstat (limited to 'passes/techmap')
-rw-r--r-- | passes/techmap/abc9_ops.cc | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/passes/techmap/abc9_ops.cc b/passes/techmap/abc9_ops.cc index 0fc4de3bb..2b4a5c802 100644 --- a/passes/techmap/abc9_ops.cc +++ b/passes/techmap/abc9_ops.cc @@ -77,11 +77,20 @@ void check(RTLIL::Design *design) auto it = w->attributes.find("\\abc9_arrival"); if (it != w->attributes.end()) { int count = 0; - if (it->second.flags == 0) + if (it->second.flags == 0) { + if (it->second.as_int() < 0) + log_error("%s.%s has negative arrival value %d!\n", log_id(m), log_id(port_name), + it->second.as_int()); count++; + } else for (const auto &tok : split_tokens(it->second.decode_string())) { - (void) tok; + if (tok.find_first_not_of("0123456789") != std::string::npos) + log_error("%s.%s has non-integer arrival value '%s'!\n", log_id(m), log_id(port_name), + tok.c_str()); + if (atoi(tok.c_str()) < 0) + log_error("%s.%s has negative arrival value %s!\n", log_id(m), log_id(port_name), + tok.c_str()); count++; } if (count > 1 && count != GetSize(w)) @@ -92,11 +101,20 @@ void check(RTLIL::Design *design) it = w->attributes.find("\\abc9_required"); if (it != w->attributes.end()) { int count = 0; - if (it->second.flags == 0) + if (it->second.flags == 0) { + if (it->second.as_int() < 0) + log_error("%s.%s has negative required value %d!\n", log_id(m), log_id(port_name), + it->second.as_int()); count++; + } else for (const auto &tok : split_tokens(it->second.decode_string())) { - (void) tok; + if (tok.find_first_not_of("0123456789") != std::string::npos) + log_error("%s.%s has non-integer required value '%s'!\n", log_id(m), log_id(port_name), + tok.c_str()); + if (atoi(tok.c_str()) < 0) + log_error("%s.%s has negative required value %s!\n", log_id(m), log_id(port_name), + tok.c_str()); count++; } if (count > 1 && count != GetSize(w)) |