diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-10-20 23:28:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-20 23:28:09 +0200 |
commit | f3de732fb4c85c02b64822c0c557a25b158e80ee (patch) | |
tree | eb537e2edc2e2eebd2cac62b242501650ea56be3 /frontends/ast/genrtlil.cc | |
parent | 11c8a9eb960fdb0a412fabcfbe787cbf5cc3a67d (diff) | |
parent | 436e3c0a7cbe5a482e14857e4e5a1d02b3464ae8 (diff) | |
download | yosys-f3de732fb4c85c02b64822c0c557a25b158e80ee.tar.gz yosys-f3de732fb4c85c02b64822c0c557a25b158e80ee.tar.bz2 yosys-f3de732fb4c85c02b64822c0c557a25b158e80ee.zip |
Merge pull request #674 from rubund/feature/svinterface_at_top
Support for SystemVerilog interfaces as ports in the top level module + test case
Diffstat (limited to 'frontends/ast/genrtlil.cc')
-rw-r--r-- | frontends/ast/genrtlil.cc | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index 32b9af6e9..8a6849faa 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -870,27 +870,10 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint) if (children.size() > 0) { for(size_t i=0; i<children.size();i++) { if(children[i]->type == AST_INTERFACEPORTTYPE) { - std::string name_type = children[i]->str; - size_t ndots = std::count(name_type.begin(), name_type.end(), '.'); - // Separate the interface instance name from any modports: - if (ndots == 0) { // Does not have modport - wire->attributes["\\interface_type"] = name_type; - } - else { - std::stringstream name_type_stream(name_type); - std::string segment; - std::vector<std::string> seglist; - while(std::getline(name_type_stream, segment, '.')) { - seglist.push_back(segment); - } - if (ndots == 1) { // Has modport - wire->attributes["\\interface_type"] = seglist[0]; - wire->attributes["\\interface_modport"] = seglist[1]; - } - else { // Erroneous port type - log_error("More than two '.' in signal port type (%s)\n", name_type.c_str()); - } - } + std::pair<std::string,std::string> res = AST::split_modport_from_type(children[i]->str); + wire->attributes["\\interface_type"] = res.first; + if (res.second != "") + wire->attributes["\\interface_modport"] = res.second; break; } } |