data/full_repos/permissive/152142712/v1/pal_sync_generator.v
'utf-8' codec can't decode byte 0xf3 in position 1836: invalid continuation byte
1: b'%Warning-UNSIGNED: data/full_repos/permissive/152142712/v1/pal_sync_generator.v:66: Comparison is constant due to unsigned arithmetic\n                                                                                  : ... In instance pal_sync_generator\n      if (hc >= 9\'d0 && hc < HORIZONTAL_ACTIVE && vc >= 9\'d0 && vc < VERTICAL_ACTIVE)\n             ^~\n                   ... Use "/* verilator lint_off UNSIGNED */" and lint_on around source to disable this message.\n%Warning-UNSIGNED: data/full_repos/permissive/152142712/v1/pal_sync_generator.v:66: Comparison is constant due to unsigned arithmetic\n                                                                                  : ... In instance pal_sync_generator\n      if (hc >= 9\'d0 && hc < HORIZONTAL_ACTIVE && vc >= 9\'d0 && vc < VERTICAL_ACTIVE)\n                                                     ^~\n%Error: Exiting due to 2 warning(s)\n'
module pal_sync_generator (
    input wire clk7,
    input wire video_in,
    output reg [8:0] hc,
    output reg [8:0] vc,
    output reg video_out,
    output reg csync
    );
    


    localparam
      HORIZONTAL_TOTAL  = 9'd480,
      VERTICAL_TOTAL    = 9'd312,
      HORIZONTAL_ACTIVE = 9'd390,
      HORIZONTAL_FPORCH = 9'd12,
      HORIZONTAL_SYNC   = 9'd35,
      HORIZONTAL_BPORCH = 9'd43,
      VERTICAL_ACTIVE   = 9'd304,
      VERTICAL_FPORCH   = 9'd3,
      VERTICAL_SYNC     = 9'd3,
      VERTICAL_BPORCH   = 9'd2;

    initial hc = 9'h000;
    initial vc = 9'h000;


    always @(posedge clk7) begin
      if (hc == HORIZONTAL_TOTAL-1) begin
         hc <= 9'd0;
         if (vc == VERTICAL_TOTAL-1) begin
            vc <= 9'd0;
         end
         else begin
            vc <= vc + 9'd1;
         end
      end
      else begin
         hc <= hc + 9'd1;
      end
    end


    always @* begin
      if (hc >= 9'd0 && hc < HORIZONTAL_ACTIVE && vc >= 9'd0 && vc < VERTICAL_ACTIVE)
        video_out = video_in;
      else
        video_out = 1'b0;
        
      if (hc >= (HORIZONTAL_ACTIVE+HORIZONTAL_FPORCH) && hc < (HORIZONTAL_ACTIVE+HORIZONTAL_FPORCH+HORIZONTAL_SYNC) )
        csync = 1'b0;
      else
        csync = 1'b1;
      
      if (vc >= (VERTICAL_ACTIVE+VERTICAL_FPORCH) && vc < (VERTICAL_ACTIVE+VERTICAL_FPORCH+VERTICAL_SYNC) )
        csync = ~csync;
    end
endmodule
module pal_sync_generator (
    input wire clk7,
    input wire video_in,
    output reg [8:0] hc,
    output reg [8:0] vc,
    output reg video_out,
    output reg csync
    );

    


    localparam
      HORIZONTAL_TOTAL  = 9'd480,
      VERTICAL_TOTAL    = 9'd312,
      HORIZONTAL_ACTIVE = 9'd390,
      HORIZONTAL_FPORCH = 9'd12,
      HORIZONTAL_SYNC   = 9'd35,
      HORIZONTAL_BPORCH = 9'd43,
      VERTICAL_ACTIVE   = 9'd304,
      VERTICAL_FPORCH   = 9'd3,
      VERTICAL_SYNC     = 9'd3,
      VERTICAL_BPORCH   = 9'd2;

    initial hc = 9'h000;
    initial vc = 9'h000;


    always @(posedge clk7) begin
      if (hc == HORIZONTAL_TOTAL-1) begin
         hc <= 9'd0;
         if (vc == VERTICAL_TOTAL-1) begin
            vc <= 9'd0;
         end
         else begin
            vc <= vc + 9'd1;
         end
      end
      else begin
         hc <= hc + 9'd1;
      end
    end


    always @* begin
      if (hc >= 9'd0 && hc < HORIZONTAL_ACTIVE && vc >= 9'd0 && vc < VERTICAL_ACTIVE)
        video_out = video_in;
      else
        video_out = 1'b0;
        
      if (hc >= (HORIZONTAL_ACTIVE+HORIZONTAL_FPORCH) && hc < (HORIZONTAL_ACTIVE+HORIZONTAL_FPORCH+HORIZONTAL_SYNC) )
        csync = 1'b0;
      else
        csync = 1'b1;
      
      if (vc >= (VERTICAL_ACTIVE+VERTICAL_FPORCH) && vc < (VERTICAL_ACTIVE+VERTICAL_FPORCH+VERTICAL_SYNC) )
        csync = ~csync;
    end
endmodule