fvdhoef / vera-module

Versatile Embedded Retro Adapter
MIT License
107 stars 44 forks source link

Line IRQ set for line 0 interrupts twice #12

Closed jburks closed 2 years ago

jburks commented 2 years ago

It appears that around the rollover point from line 511 to line 512, there is an opportunity for the IRQ signal to glitch and generate an interrupt in the middle of the back porch, ahead of line 0.

DS1Z_QuickPrint80 DS1Z_QuickPrint81 DS1Z_QuickPrint84 DS1Z_QuickPrint83

As seen in the above sequence of images, the unexpected line IRQ happens at roughly line 480 + 10 + 2 + 20 = 512. This erroneous IRQ appears to happen during every frame while a line IRQ is set for line 0.

It isn't obvious to me why this is happening. y_counter and line_irq are both registers in composer.v; they should be safe. Needs further investigation.

jburks commented 2 years ago

After more debug, this happens on every line 0-10, possibly 11 and 12 also. It appears to be due to the y counter in the composer being 9 bits instead of the 10 needed to count all 525 lines of the frame. Fixing this line in composer.v might solve the issue:

reg [8:0] y_counter_r, y_counter_rr;