In reply to mlsxdx:
You are mixing $display and $monitor and not printing the time in $display. $monitor always prints at the end of the time slot when there has been change in any of its arguments. Your $display only prints when there is a change on ina or inb. It’s possible there is a race between the time they change, and when node changes. I would add a #1 before your if statement.