projf / projf-explore

Project F brings FPGAs to life with exciting open-source designs you can build on.
https://projectf.io
MIT License
585 stars 52 forks source link

Hitomezashi missing pixel fix #172

Closed vfr1200f closed 9 months ago

vfr1200f commented 10 months ago

At the price of one extra flipflop (last_h_stitch0) I extended h-line by one pixel. Code is in verilog due to the the fact that I use ISE with basys2 to play with VGA :)

    //-------------------------------------------------------------
    // paint stitch pattern with 16x16 pixel grid
    wire stitch;
    wire v_line, v_on;
    wire h_line, h_on;
    reg last_h_stitch0;

    assign v_line = (sx[3:0] == 4'b0000);
    assign h_line = (sy[3:0] == 4'b0000);
    assign v_on = sy[4] ^ v_start[sx[9:4]];
    assign h_on = sx[4] ^ h_start[sy[8:4]];
    assign stitch = (v_line && v_on) || (h_line && h_on) || last_h_stitch0;

        always @ ( posedge clk ) begin
        last_h_stitch0 <= h_line && h_on;
    end
WillGreen commented 9 months ago

Thank you for this excellent suggestion! 🙏 I have created a branch for this fix and successfully tested it in simulation. Once I've tested on boards I'll merge.