display.v
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//
// 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