Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1029 | chrv | 1 | `include "../include/tune.v" |
2 | |||
3 | // PentEvo project (c) NedoPC 2008-2009 |
||
4 | // |
||
5 | // resyncs and outs video data to the DAC plus syncs |
||
6 | |||
7 | module videoout( |
||
8 | |||
9 | input clk, |
||
10 | |||
11 | input [5:0] pixel, // this data has format: { red[1:0], green[1:0], blue[1:0] } |
||
12 | input [5:0] border, // |
||
13 | |||
14 | |||
15 | input hblank, |
||
16 | input vblank, |
||
17 | |||
18 | input hpix, |
||
19 | input vpix, |
||
20 | |||
21 | |||
22 | input hsync, |
||
23 | input vsync, |
||
24 | |||
25 | input vga_hsync, |
||
26 | |||
27 | |||
28 | input wire scanin_start, |
||
29 | input wire scanout_start, |
||
30 | |||
31 | input wire hsync_start, |
||
32 | |||
33 | |||
34 | output reg [1:0] vred, // to |
||
35 | output reg [1:0] vgrn, // the DAC |
||
36 | output reg [1:0] vblu, // video |
||
37 | |||
38 | output reg vhsync, |
||
39 | output reg vvsync, |
||
40 | |||
41 | output reg vcsync, |
||
42 | |||
43 | input wire cfg_vga_on |
||
44 | ); |
||
45 | |||
46 | |||
47 | wire [5:0] color, vga_color; |
||
48 | |||
49 | assign color = (hblank | vblank) ? 6'd0 : ( (hpix & vpix) ? pixel : border ); |
||
50 | |||
51 | |||
52 | |||
53 | vga_double vga_double( .clk(clk), |
||
54 | |||
55 | .hsync_start(hsync_start), |
||
56 | .scanin_start(scanin_start), |
||
57 | .scanout_start(scanout_start), |
||
58 | |||
59 | .pix_in(color), |
||
60 | .pix_out(vga_color) |
||
61 | ); |
||
62 | |||
63 | |||
64 | |||
65 | always @(posedge clk) |
||
66 | begin |
||
67 | vred[1:0] <= cfg_vga_on ? vga_color[5:4] : color[5:4]; |
||
68 | vgrn[1:0] <= cfg_vga_on ? vga_color[3:2] : color[3:2]; |
||
69 | vblu[1:0] <= cfg_vga_on ? vga_color[1:0] : color[1:0]; |
||
70 | |||
71 | vhsync <= cfg_vga_on ? vga_hsync : hsync; |
||
72 | vvsync <= vsync; |
||
73 | |||
74 | vcsync <= ~(hsync ^ vsync); |
||
75 | end |
||
76 | |||
77 | |||
78 | endmodule |
||
79 |