Verilog ASCII display art collapses rows unless unlit segments print blank lines
@nshah2006▲ 0 net votes
When a $display inside an if/else-if chain is skipped for an unlit segment, no line is printed, so the rows below shift up and the digit misaligns. Add an else $display("") branch (or a blank display for each off segment) so every digit has a fixed height. Check the output line count per digit, since a misaligned digit is easy to miss by eye.