Subversion Repositories pentevo

Rev

Rev 425 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed | ?url?

  1. `include "../include/tune.v"
  2.  
  3. // Pentevo project (c) NedoPC 2010-2011
  4. //
  5. // mix up border and pixels, add palette and blanks
  6. //
  7.  
  8. module video_palframe(
  9.  
  10.         input  wire        clk, // 28MHz clock
  11.  
  12.  
  13.         input  wire        hpix,
  14.         input  wire        vpix,
  15.  
  16.         input  wire        hblank,
  17.         input  wire        vblank,
  18.  
  19.         input  wire [ 3:0] pixels,
  20.         input  wire [ 3:0] border,
  21.  
  22.  
  23.         input  wire        atm_palwr,
  24.         input  wire [ 5:0] atm_paldata,
  25.  
  26.  
  27.         output reg  [ 5:0] palcolor, // just for palette readback
  28.  
  29.         output wire [ 5:0] color
  30. );
  31.  
  32.  
  33.         wire [ 3:0] zxcolor;
  34.  
  35.  
  36.         reg       win;
  37.         reg [3:0] border_r;
  38.  
  39.  
  40.  
  41. //      always @(posedge clk)
  42. //              win <= hpix & vpix;
  43. //
  44. //      always @(posedge clk)
  45. //              border_r <= border;
  46. //
  47. //      assign zxcolor = win ? pixels : border_r;
  48.  
  49.         assign zxcolor = (hpix&vpix) ? pixels : border;
  50.  
  51.  
  52.         // palette
  53.         reg [5:0] palette [0:15]; // let quartus instantiate it as RAM if needed
  54.  
  55.         always @(posedge clk)
  56.         begin
  57.                 if( atm_palwr )
  58.                         palette[zxcolor] <= atm_paldata;
  59.  
  60.                 palcolor <= palette[zxcolor];
  61.         end
  62.  
  63.  
  64.         assign color = (hblank | vblank) ? 6'd0 : palcolor;
  65.  
  66.  
  67. endmodule
  68.  
  69.