display.v 2.26 KB
//
// Display for video interface 
//
// 10/12/94 Kluster
//

`define MAX_X	320
`define MAX_Y	240

module display(.vclk(vclk), .divot_enable(divot_enable), .type(type), 
		.aa_off(aa_off), .gamma_enable(gamma_enable),
	       .gamma_dither_enable(gamma_dither_enable), .rand(rand), 
	       .hfrac(hfrac), .vfrac(vfrac), .rgb0i(rgb0i), .rgb1i(rgb1i), 
	       .rgb2i(rgb2i), .rgb3i(rgb3i), .cvg0i(cvg0i), .cvg1i(cvg1i), 
	       .cvg2i(cvg2i), .cvg3i(cvg3i), .synci(synci), .srgb(srgb), .sync(sync));
//
// Inputs
//
input vclk;
input divot_enable;
input [1:0] type;
input aa_off;
input gamma_enable;
input gamma_dither_enable;
input [5:0] rand;
input [4:0] hfrac;
input [4:0] vfrac;
input [7:0] rgb0i;
input [7:0] rgb1i;
input [7:0] rgb2i;
input [7:0] rgb3i;
input [2:0] cvg0i;
input [2:0] cvg1i;
input [2:0] cvg2i;
input [2:0] cvg3i;
input synci;

input [6:0] srgb;
input sync;


reg	[1:256*8]	filename;
integer			Width;
integer			Height;	
integer                 WidthDefined;
integer                 HeightDefined;

//
//  Initialize frame buffer
//
initial
begin
// do something here

  if ($getnum$plusarg("width=", Width) == 1)
  begin
	WidthDefined = 1;	
  end
  else 
  begin
        WidthDefined = 0;
        Width = `MAX_X;
  end

  if ($getnum$plusarg("height=", Height) == 1)
  begin
	HeightDefined = 1;	
  end
  else
  begin
	HeightDefined = 0;
	Height = `MAX_Y;
  end
	
  if ($getstr$plusarg("out=", filename) == 1)
    begin	
      if ($open_out_file(filename) == -1)
        begin
          $write("Cannot open out file \n");
          $finish();
        end	
    end	
  if ($getstr$plusarg("rgb=", filename) == 1)
    begin	
      if ($open_rgb_file(filename, Width, Height) == -1)
        begin
          $write("Cannot open rgb file \n");
          $finish();
        end	
    end	
end
	
always @(posedge vclk) 
begin
  if ($output_all(divot_enable, type, aa_off, 
	          gamma_enable,
		  gamma_dither_enable, rand, 
		  hfrac, vfrac, rgb0i, rgb1i, 
		  rgb2i, rgb3i, cvg0i, cvg1i, 
		  cvg2i, cvg3i, 
		  synci, srgb, sync) == -1)	
    begin
      $write("Cannot write output values \n");
    end

  if ($output_pixel(srgb, sync) == -1)
    begin
      $write("Cannot write output pixel \n");
      $finish();
    end
end

//
//  Close Frame Buffer
//
//  do something here

endmodule