Merge pull request #953 from YosysHQ/clifford/fix948

Add support for zero-width signals to Verilog back-end
This commit is contained in:
Clifford Wolf 2019-04-22 20:01:09 +02:00 committed by GitHub
commit 3be5aac52c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -187,6 +187,10 @@ void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int o
{ {
if (width < 0) if (width < 0)
width = data.bits.size() - offset; width = data.bits.size() - offset;
if (width == 0) {
f << "\"\"";
return;
}
if (nostr) if (nostr)
goto dump_hex; goto dump_hex;
if ((data.flags & RTLIL::CONST_FLAG_STRING) == 0 || width != (int)data.bits.size()) { if ((data.flags & RTLIL::CONST_FLAG_STRING) == 0 || width != (int)data.bits.size()) {
@ -340,6 +344,10 @@ void dump_sigchunk(std::ostream &f, const RTLIL::SigChunk &chunk, bool no_decima
void dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig) void dump_sigspec(std::ostream &f, const RTLIL::SigSpec &sig)
{ {
if (GetSize(sig) == 0) {
f << "\"\"";
return;
}
if (sig.is_chunk()) { if (sig.is_chunk()) {
dump_sigchunk(f, sig.as_chunk()); dump_sigchunk(f, sig.as_chunk());
} else { } else {