Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tgt-vlog95: Don't strip leading null-bytes from string literals
When a string literal is used in a context where it needs to be wider than it is it will get left-padded with null-bytes. When the vlog95 backend emits the string literal it will strip the leading null-bytes as it results in much more legible code. Unfortunately there are some corner cases where this results in a change of behavior of the generated code compared to the original. E.g. if the context that caused the width expansion has been removed by optimization. `$display(0 ? "Yes" : "No")` should print " No" due to width expansion, but when running through the vlog95 backend it will print "No". Another scenario where there is a change in behavior is when a null byte was explicitly added at the front of a string literal. E.g. $bits("\000ab") should print 24, but will print 16 when running through the vlog95 backend. To mitigate this remove the stripping of the leading null-bytes from the vlog95 backend. This results in slightly less legible code being generated in some cases, but makes sure that the code is always correct. Signed-off-by: Lars-Peter Clausen <[email protected]>
- Loading branch information