data/full_repos/permissive/152129793/comun/modulos.v
1: b'%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:576: Operator ASSIGNW expects 8 bits on the Assign RHS, but Assign RHS\'s SUB generates 32 or 11 bits.\n                                                                        : ... In instance display.los_interruptores\n  wire [7:0] posx = hc - XINIT;   \n                  ^\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:577: Operator ASSIGNW expects 8 bits on the Assign RHS, but Assign RHS\'s SUB generates 32 or 11 bits.\n                                                                        : ... In instance display.los_interruptores\n  wire [7:0] posy = vc - YINIT;   \n                  ^\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:503: Operator ASSIGNW expects 8 bits on the Assign RHS, but Assign RHS\'s SUB generates 32 or 11 bits.\n                                                                        : ... In instance display.display_leds\n  wire [7:0] pos = hc - XINIT;   \n                 ^\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:399: Operator ASSIGN expects 4 bits on the Assign RHS, but Assign RHS\'s SHIFTR generates 32 or 11 bits.\n                                                                        : ... In instance display.display_digitos\n    posicion_caracter_en_pantalla = (hc - XINIT + 1)>>4;\n                                  ^\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:403: Operator ASSIGNW expects 8 bits on the Assign RHS, but Assign RHS\'s SUB generates 32 or 11 bits.\n                                                                        : ... In instance display.display_digitos\n  wire [7:0] posx = hc - XINIT;   \n                  ^\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:404: Operator ASSIGNW expects 8 bits on the Assign RHS, but Assign RHS\'s SUB generates 32 or 11 bits.\n                                                                        : ... In instance display.display_digitos\n  wire [7:0] posy = vc - YINIT;   \n                  ^\n%Warning-WIDTH: data/full_repos/permissive/152129793/comun/modulos.v:436: Bit extraction of array[127:0] requires 7 bit index, not 8 bits.\n                                                                        : ... In instance display.display_digitos\n        scan_actual <= chars[charaddr];\n                            ^\n%Warning-UNSIGNED: data/full_repos/permissive/152129793/comun/modulos.v:216: Comparison is constant due to unsigned arithmetic\n                                                                           : ... In instance display.sincronismos\n    if (hcont>=0 && hcont<HACTIVE && vcont>=0 && vcont<VACTIVE)\n             ^~\n%Warning-UNSIGNED: data/full_repos/permissive/152129793/comun/modulos.v:216: Comparison is constant due to unsigned arithmetic\n                                                                           : ... In instance display.sincronismos\n    if (hcont>=0 && hcont<HACTIVE && vcont>=0 && vcont<VACTIVE)\n                                          ^~\n%Error: Exiting due to 9 warning(s)\n'
module digits (
  input wire clk,


  input wire [3:0] d0,
  input wire [3:0] d1,
  input wire [3:0] d2,
  input wire [3:0] d3,

  input wire [3:0] d4,
  input wire [3:0] d5,
  input wire [3:0] d6,
  input wire [3:0] d7,

  input wire [3:0] d8,
  input wire [3:0] d9,
  input wire [3:0] d10,
  input wire [3:0] d11,


  input wire [10:0] hc,
  input wire [10:0] vc,
  output reg [5:0] r,
  output reg [5:0] g,
  output reg [5:0] b
  );
  
  parameter YINIT = 448;
  parameter FONTFILE = "fuente_hexadecimal_ibm.hex";

  localparam ANCHO = (12 + 4)*8*2;
  localparam XINIT = (640 - ANCHO) / 2;
  localparam XFIN  = XINIT + ANCHO - 1;
  localparam YFIN  = YINIT + 15;
  localparam COLOR_TEXTO = {6'h00, 6'h2F, 6'h00};
  
  reg [7:0] chars[0:127];
  initial begin
    $readmemh (FONTFILE, chars);
  end
  
  reg [3:0] posicion_caracter_en_pantalla;
  reg pintando_texto;
  always @* begin
    if (vc >= YINIT && vc <= YFIN && hc >= (XINIT - 1) && hc <= (XFIN - 1))
      pintando_texto = 1'b1;
    else
      pintando_texto = 1'b0;
    posicion_caracter_en_pantalla = (hc - XINIT + 1)>>4;
  end    
  
  reg [7:0] scan_actual;
  wire [7:0] posx = hc - XINIT;
  wire [7:0] posy = vc - YINIT;

  reg [7:0] charaddr;
  always @* begin
    if (pintando_texto == 1'b1 && posx[3:0] == 4'b1111) begin
      case (posicion_caracter_en_pantalla)
        4'd0:  charaddr = 8'h80;
        4'd1:  charaddr = {1'b0, d0,  posy[3:1]};
        4'd2:  charaddr = {1'b0, d1,  posy[3:1]};
        4'd3:  charaddr = {1'b0, d2,  posy[3:1]};
        4'd4:  charaddr = {1'b0, d3,  posy[3:1]};
        4'd5:  charaddr = 8'h80;
        4'd6:  charaddr = {1'b0, d4,  posy[3:1]};
        4'd7:  charaddr = {1'b0, d5,  posy[3:1]};
        4'd8:  charaddr = {1'b0, d6,  posy[3:1]};
        4'd9:  charaddr = {1'b0, d7,  posy[3:1]};
        4'd10: charaddr = 8'h80;
        4'd11: charaddr = {1'b0, d8,  posy[3:1]};
        4'd12: charaddr = {1'b0, d9,  posy[3:1]};
        4'd13: charaddr = {1'b0, d10, posy[3:1]};
        4'd14: charaddr = {1'b0, d11, posy[3:1]};
        4'd15: charaddr = 8'h80;
        default : charaddr = 8'h80;
      endcase
    end
    else
      charaddr = 8'h80;
  end

  always @(posedge clk) begin
    if (pintando_texto == 1'b1 && posx[3:0] == 4'b1111) begin
      if (charaddr[7] == 1'b0)
        scan_actual <= chars[charaddr];
      else
        scan_actual <= 8'h00;
    end
    else if (hc[0] == 1'b1)
      scan_actual <= {scan_actual[6:0],1'b0};
  end



























          
  always @* begin
    if (scan_actual[7] == 1'b1)
      {r,g,b} = COLOR_TEXTO;
    else
      {r,g,b} = 18'h00000;
  end  
endmodule
module digits (
  input wire clk,


  input wire [3:0] d0,
  input wire [3:0] d1,
  input wire [3:0] d2,
  input wire [3:0] d3,

  input wire [3:0] d4,
  input wire [3:0] d5,
  input wire [3:0] d6,
  input wire [3:0] d7,

  input wire [3:0] d8,
  input wire [3:0] d9,
  input wire [3:0] d10,
  input wire [3:0] d11,


  input wire [10:0] hc,
  input wire [10:0] vc,
  output reg [5:0] r,
  output reg [5:0] g,
  output reg [5:0] b
  );

  
  parameter YINIT = 448;
  parameter FONTFILE = "fuente_hexadecimal_ibm.hex";

  localparam ANCHO = (12 + 4)*8*2;
  localparam XINIT = (640 - ANCHO) / 2;
  localparam XFIN  = XINIT + ANCHO - 1;
  localparam YFIN  = YINIT + 15;
  localparam COLOR_TEXTO = {6'h00, 6'h2F, 6'h00};
  
  reg [7:0] chars[0:127];
  initial begin
    $readmemh (FONTFILE, chars);
  end
  
  reg [3:0] posicion_caracter_en_pantalla;
  reg pintando_texto;
  always @* begin
    if (vc >= YINIT && vc <= YFIN && hc >= (XINIT - 1) && hc <= (XFIN - 1))
      pintando_texto = 1'b1;
    else
      pintando_texto = 1'b0;
    posicion_caracter_en_pantalla = (hc - XINIT + 1)>>4;
  end    
  
  reg [7:0] scan_actual;
  wire [7:0] posx = hc - XINIT;
  wire [7:0] posy = vc - YINIT;

  reg [7:0] charaddr;
  always @* begin
    if (pintando_texto == 1'b1 && posx[3:0] == 4'b1111) begin
      case (posicion_caracter_en_pantalla)
        4'd0:  charaddr = 8'h80;
        4'd1:  charaddr = {1'b0, d0,  posy[3:1]};
        4'd2:  charaddr = {1'b0, d1,  posy[3:1]};
        4'd3:  charaddr = {1'b0, d2,  posy[3:1]};
        4'd4:  charaddr = {1'b0, d3,  posy[3:1]};
        4'd5:  charaddr = 8'h80;
        4'd6:  charaddr = {1'b0, d4,  posy[3:1]};
        4'd7:  charaddr = {1'b0, d5,  posy[3:1]};
        4'd8:  charaddr = {1'b0, d6,  posy[3:1]};
        4'd9:  charaddr = {1'b0, d7,  posy[3:1]};
        4'd10: charaddr = 8'h80;
        4'd11: charaddr = {1'b0, d8,  posy[3:1]};
        4'd12: charaddr = {1'b0, d9,  posy[3:1]};
        4'd13: charaddr = {1'b0, d10, posy[3:1]};
        4'd14: charaddr = {1'b0, d11, posy[3:1]};
        4'd15: charaddr = 8'h80;
        default : charaddr = 8'h80;
      endcase
    end
    else
      charaddr = 8'h80;
  end

  always @(posedge clk) begin
    if (pintando_texto == 1'b1 && posx[3:0] == 4'b1111) begin
      if (charaddr[7] == 1'b0)
        scan_actual <= chars[charaddr];
      else
        scan_actual <= 8'h00;
    end
    else if (hc[0] == 1'b1)
      scan_actual <= {scan_actual[6:0],1'b0};
  end



























          
  always @* begin
    if (scan_actual[7] == 1'b1)
      {r,g,b} = COLOR_TEXTO;
    else
      {r,g,b} = 18'h00000;
  end  
endmodule