diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-07-10 17:34:51 -0700 |
---|---|---|
committer | Eddie Hung <eddie@fpgeh.com> | 2019-07-10 17:34:51 -0700 |
commit | a092c48f036b71cc4014ec6f2865297d49589d40 (patch) | |
tree | 6749d0213455a8702a46ec82369e2a5f6339825f /frontends/aiger/aigerparse.cc | |
parent | 3bb48facb21032eb49ca40150827358e2d35a9c8 (diff) | |
download | yosys-a092c48f036b71cc4014ec6f2865297d49589d40.tar.gz yosys-a092c48f036b71cc4014ec6f2865297d49589d40.tar.bz2 yosys-a092c48f036b71cc4014ec6f2865297d49589d40.zip |
Use split_tokens()
Diffstat (limited to 'frontends/aiger/aigerparse.cc')
-rw-r--r-- | frontends/aiger/aigerparse.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/frontends/aiger/aigerparse.cc b/frontends/aiger/aigerparse.cc index 30e35da01..35b7f6a97 100644 --- a/frontends/aiger/aigerparse.cc +++ b/frontends/aiger/aigerparse.cc @@ -754,14 +754,14 @@ void AigerReader::post_process() auto it = box_module->attributes.find("\\abc_flop"); if (it != box_module->attributes.end()) { log_assert(flop_count < flopNum); - std::string abc_flop = it->second.decode_string(); - auto pos = abc_flop.find(','); - log_assert(pos != std::string::npos); - flop_module = design->module(RTLIL::escape_id(abc_flop.substr(0, pos))); - log_assert(flop_module); - pos = abc_flop.rfind(','); - log_assert(pos != std::string::npos); - flop_past_q = RTLIL::escape_id(abc_flop.substr(pos+1)); + auto abc_flop = it->second.decode_string(); + auto tokens = split_tokens(abc_flop, ","); + if (tokens.size() != 4) + log_error("'abc_flop' attribute on module '%s' does not contain exactly four comma-separated tokens.\n", log_id(cell->type)); + flop_module = design->module(RTLIL::escape_id(tokens[0])); + if (!flop_module) + log_error("First token '%s' in 'abc_flop' attribute on module '%s' is not a valid module.\n", tokens[0].c_str(), log_id(cell->type)); + flop_past_q = RTLIL::escape_id(tokens[3]); flop_data[cell->type] = std::make_pair(flop_module, flop_past_q); } it = box_module->attributes.find("\\abc_carry"); |