Skip to content

Commit

Permalink
tgt-vlog95: Don't strip null-bytes from string literals in structural…
Browse files Browse the repository at this point in the history
… elements

The vlog95 backend currently strips null-bytes from strings in structural
elements. E.g. `assign y = "a\000b"` gets translated to `assign y = "ab"`.

This changes the behavior of the generated output compared to the input.
Don't ignore the null-bytes to make sure the behavior stays the same.

Signed-off-by: Lars-Peter Clausen <[email protected]>
  • Loading branch information
larsclausen committed Jan 3, 2023
1 parent 2e12e47 commit 56efec8
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions tgt-vlog95/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,6 @@ static void emit_number_as_string(ivl_net_const_t net_const)
val |= (bits[idx-bit] == '1') ? 1 << (7-bit) : 0x00;
}

/* Skip any NULL bytes. */
if (val == 0) continue;
/* Print some values that can be escaped. */
if (val == '"') fprintf(vlog_out, "\\\"");
else if (val == '\\') fprintf(vlog_out, "\\\\");
Expand Down

0 comments on commit 56efec8

Please sign in to comment.