1 |
30 |
rherveille |
/////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// WISHBONE rev.B2 compliant Enhanced VGA/LCD Core ////
|
4 |
|
|
//// Top Level ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// Author: Richard Herveille ////
|
7 |
|
|
//// richard@asics.ws ////
|
8 |
|
|
//// www.asics.ws ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// Downloaded from: http://www.opencores.org/projects/vga_lcd ////
|
11 |
|
|
//// ////
|
12 |
|
|
/////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2001,2002 Richard Herveille ////
|
15 |
|
|
//// richard@asics.ws ////
|
16 |
|
|
//// ////
|
17 |
|
|
//// This source file may be used and distributed without ////
|
18 |
|
|
//// restriction provided that this copyright statement is not ////
|
19 |
|
|
//// removed from the file and that any derivative work contains ////
|
20 |
|
|
//// the original copyright notice and the associated disclaimer.////
|
21 |
|
|
//// ////
|
22 |
|
|
//// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
|
23 |
|
|
//// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
|
24 |
|
|
//// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
|
25 |
|
|
//// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
|
26 |
|
|
//// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
|
27 |
|
|
//// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
|
28 |
|
|
//// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
|
29 |
|
|
//// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
|
30 |
|
|
//// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
|
31 |
|
|
//// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
|
32 |
|
|
//// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
|
33 |
|
|
//// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
|
34 |
|
|
//// POSSIBILITY OF SUCH DAMAGE. ////
|
35 |
|
|
//// ////
|
36 |
|
|
/////////////////////////////////////////////////////////////////////
|
37 |
|
|
|
38 |
|
|
// CVS Log
|
39 |
|
|
//
|
40 |
57 |
rherveille |
// $Id: vga_enh_top.v,v 1.6 2003-08-01 11:46:38 rherveille Exp $
|
41 |
30 |
rherveille |
//
|
42 |
57 |
rherveille |
// $Date: 2003-08-01 11:46:38 $
|
43 |
|
|
// $Revision: 1.6 $
|
44 |
30 |
rherveille |
// $Author: rherveille $
|
45 |
|
|
// $Locker: $
|
46 |
|
|
// $State: Exp $
|
47 |
|
|
//
|
48 |
|
|
// Change History:
|
49 |
|
|
// $Log: not supported by cvs2svn $
|
50 |
57 |
rherveille |
// Revision 1.5 2003/07/03 15:09:06 rherveille
|
51 |
|
|
// Removed 'or negedge arst' from sluint/luint sensitivity list
|
52 |
|
|
//
|
53 |
56 |
rherveille |
// Revision 1.4 2003/05/07 09:48:54 rherveille
|
54 |
|
|
// Fixed some Wishbone RevB.3 related bugs.
|
55 |
|
|
// Changed layout of the core. Blocks are located more logically now.
|
56 |
|
|
// Started work on a dual clocked/double edge 12bit output. Commonly used by external devices like DVI transmitters.
|
57 |
|
|
//
|
58 |
53 |
rherveille |
// Revision 1.3 2003/03/18 21:45:48 rherveille
|
59 |
|
|
// Added WISHBONE revB.3 Registered Feedback Cycles support
|
60 |
|
|
//
|
61 |
43 |
rherveille |
// Revision 1.2 2002/03/04 11:01:59 rherveille
|
62 |
|
|
// Added 64x64pixels 4bpp hardware cursor support.
|
63 |
|
|
//
|
64 |
33 |
rherveille |
// Revision 1.1 2002/02/07 05:42:10 rherveille
|
65 |
|
|
// Fixed some bugs discovered by modified testbench
|
66 |
|
|
// Removed / Changed some strange logic constructions
|
67 |
|
|
// Started work on hardware cursor support (not finished yet)
|
68 |
|
|
// Changed top-level name to vga_enh_top.v
|
69 |
|
|
//
|
70 |
30 |
rherveille |
|
71 |
53 |
rherveille |
//synopsys translate_off
|
72 |
30 |
rherveille |
`include "timescale.v"
|
73 |
53 |
rherveille |
//synopsys translate_on
|
74 |
30 |
rherveille |
`include "vga_defines.v"
|
75 |
|
|
|
76 |
53 |
rherveille |
module vga_enh_top (
|
77 |
|
|
wb_clk_i, wb_rst_i, rst_i, wb_inta_o,
|
78 |
|
|
wbs_adr_i, wbs_dat_i, wbs_dat_o, wbs_sel_i, wbs_we_i, wbs_stb_i, wbs_cyc_i, wbs_ack_o, wbs_rty_o, wbs_err_o,
|
79 |
43 |
rherveille |
wbm_adr_o, wbm_dat_i, wbm_cti_o, wbm_bte_o, wbm_sel_o, wbm_we_o, wbm_stb_o, wbm_cyc_o, wbm_ack_i, wbm_err_i,
|
80 |
53 |
rherveille |
clk_p_i,
|
81 |
|
|
`ifdef VGA_12BIT_DVI
|
82 |
|
|
dvi_pclk_p_o, dvi_pclk_m_o, dvi_hsync_o, dvi_vsync_o, dvi_de_o, dvi_d_o,
|
83 |
|
|
`endif
|
84 |
|
|
clk_p_o, hsync_pad_o, vsync_pad_o, csync_pad_o, blank_pad_o, r_pad_o, g_pad_o, b_pad_o
|
85 |
43 |
rherveille |
);
|
86 |
30 |
rherveille |
|
87 |
|
|
//
|
88 |
|
|
// parameters
|
89 |
|
|
//
|
90 |
|
|
parameter ARST_LVL = 1'b0;
|
91 |
|
|
parameter LINE_FIFO_AWIDTH = 7;
|
92 |
|
|
|
93 |
|
|
//
|
94 |
|
|
// inputs & outputs
|
95 |
|
|
//
|
96 |
|
|
|
97 |
|
|
// syscon interface
|
98 |
|
|
input wb_clk_i; // wishbone clock input
|
99 |
|
|
input wb_rst_i; // synchronous active high reset
|
100 |
|
|
input rst_i; // asynchronous reset
|
101 |
|
|
output wb_inta_o; // interrupt request output
|
102 |
|
|
|
103 |
|
|
// slave signals
|
104 |
|
|
input [11:0] wbs_adr_i; // addressbus input (only 32bit databus accesses supported)
|
105 |
|
|
input [31:0] wbs_dat_i; // Slave databus output
|
106 |
|
|
output [31:0] wbs_dat_o; // Slave databus input
|
107 |
|
|
input [ 3:0] wbs_sel_i; // byte select inputs
|
108 |
|
|
input wbs_we_i; // write enabel input
|
109 |
|
|
input wbs_stb_i; // strobe/select input
|
110 |
|
|
input wbs_cyc_i; // valid bus cycle input
|
111 |
|
|
output wbs_ack_o; // bus cycle acknowledge output
|
112 |
53 |
rherveille |
output wbs_rty_o; // busy cycle retry output
|
113 |
30 |
rherveille |
output wbs_err_o; // bus cycle error output
|
114 |
53 |
rherveille |
|
115 |
30 |
rherveille |
// master signals
|
116 |
|
|
output [31:0] wbm_adr_o; // addressbus output
|
117 |
|
|
input [31:0] wbm_dat_i; // Master databus input
|
118 |
|
|
output [ 3:0] wbm_sel_o; // byte select outputs
|
119 |
|
|
output wbm_we_o; // write enable output
|
120 |
|
|
output wbm_stb_o; // strobe output
|
121 |
|
|
output wbm_cyc_o; // valid bus cycle output
|
122 |
53 |
rherveille |
output [ 2:0] wbm_cti_o; // cycle type identifier
|
123 |
43 |
rherveille |
output [ 1:0] wbm_bte_o; // burst type extensions
|
124 |
30 |
rherveille |
input wbm_ack_i; // bus cycle acknowledge input
|
125 |
|
|
input wbm_err_i; // bus cycle error input
|
126 |
|
|
|
127 |
|
|
// VGA signals
|
128 |
|
|
input clk_p_i; // pixel clock
|
129 |
53 |
rherveille |
// in DVI mode this is 2x as high (!!)
|
130 |
|
|
|
131 |
|
|
`ifdef VGA_12BIT_DVI
|
132 |
|
|
output dvi_pclk_p_o; // dvi pclk+
|
133 |
|
|
output dvi_pclk_m_o; // dvi pclk-
|
134 |
|
|
output dvi_hsync_o; // dvi hsync
|
135 |
|
|
output dvi_vsync_o; // dvi vsync
|
136 |
|
|
output dvi_de_o; // dvi data enable
|
137 |
|
|
output [11:0] dvi_d_o; // dvi 12bit output
|
138 |
|
|
`endif
|
139 |
|
|
|
140 |
|
|
output clk_p_o; // VGA pixel clock output
|
141 |
30 |
rherveille |
output hsync_pad_o; // horizontal sync
|
142 |
|
|
output vsync_pad_o; // vertical sync
|
143 |
|
|
output csync_pad_o; // composite sync
|
144 |
|
|
output blank_pad_o; // blanking signal
|
145 |
|
|
output [ 7:0] r_pad_o, g_pad_o, b_pad_o; // RGB color signals
|
146 |
|
|
|
147 |
|
|
//
|
148 |
|
|
// variable declarations
|
149 |
|
|
//
|
150 |
|
|
|
151 |
|
|
// programable asynchronous reset
|
152 |
|
|
wire arst = rst_i ^ ARST_LVL;
|
153 |
|
|
|
154 |
|
|
// from wb_slave
|
155 |
53 |
rherveille |
wire ctrl_bl, ctrl_csl, ctrl_vsl, ctrl_hsl, ctrl_pc, ctrl_cbsw, ctrl_vbsw, ctrl_ven;
|
156 |
|
|
wire [ 1: 0] ctrl_cd, ctrl_vbl, ctrl_dvi_odf;
|
157 |
30 |
rherveille |
wire [ 7: 0] Thsync, Thgdel, Tvsync, Tvgdel;
|
158 |
|
|
wire [15: 0] Thgate, Thlen, Tvgate, Tvlen;
|
159 |
|
|
wire [31: 2] VBARa, VBARb;
|
160 |
53 |
rherveille |
|
161 |
|
|
wire [ 8: 0] cursor_adr;
|
162 |
30 |
rherveille |
wire [31: 0] cursor0_xy, cursor1_xy;
|
163 |
|
|
wire cursor0_en, cursor1_en;
|
164 |
|
|
wire [31:11] cursor0_ba, cursor1_ba;
|
165 |
|
|
wire cursor0_ld, cursor1_ld;
|
166 |
33 |
rherveille |
wire cursor0_res, cursor1_res;
|
167 |
|
|
wire [15: 0] cc0_dat_o, cc1_dat_o;
|
168 |
30 |
rherveille |
|
169 |
|
|
// to wb_slave
|
170 |
|
|
wire stat_avmp, stat_acmp, vmem_swint, clut_swint, hint, vint, sint;
|
171 |
53 |
rherveille |
wire wmb_busy;
|
172 |
30 |
rherveille |
reg luint;
|
173 |
33 |
rherveille |
wire [ 3: 0] cc0_adr_i, cc1_adr_i;
|
174 |
30 |
rherveille |
|
175 |
53 |
rherveille |
// pixel generator
|
176 |
|
|
wire fb_data_fifo_rreq, fb_data_fifo_empty;
|
177 |
|
|
wire [31:0] fb_data_fifo_q;
|
178 |
|
|
wire ImDoneFifoQ;
|
179 |
30 |
rherveille |
|
180 |
|
|
// line fifo connections
|
181 |
53 |
rherveille |
wire line_fifo_wreq, line_fifo_rreq, line_fifo_empty_rd;
|
182 |
|
|
wire [23:0] line_fifo_d, line_fifo_q;
|
183 |
30 |
rherveille |
|
184 |
|
|
// clut connections
|
185 |
|
|
wire ext_clut_req, ext_clut_ack;
|
186 |
|
|
wire [23:0] ext_clut_q;
|
187 |
|
|
wire cp_clut_req, cp_clut_ack;
|
188 |
|
|
wire [ 8:0] cp_clut_adr;
|
189 |
|
|
wire [23:0] cp_clut_q;
|
190 |
|
|
|
191 |
|
|
//
|
192 |
|
|
// Module body
|
193 |
|
|
//
|
194 |
|
|
|
195 |
|
|
// hookup wishbone slave
|
196 |
43 |
rherveille |
vga_wb_slave wbs (
|
197 |
30 |
rherveille |
// wishbone interface
|
198 |
53 |
rherveille |
.clk_i ( wb_clk_i ),
|
199 |
|
|
.rst_i ( wb_rst_i ),
|
200 |
|
|
.arst_i ( arst ),
|
201 |
|
|
.adr_i ( wbs_adr_i[11:2] ),
|
202 |
|
|
.dat_i ( wbs_dat_i ),
|
203 |
|
|
.dat_o ( wbs_dat_o ),
|
204 |
|
|
.sel_i ( wbs_sel_i ),
|
205 |
|
|
.we_i ( wbs_we_i ),
|
206 |
|
|
.stb_i ( wbs_stb_i ),
|
207 |
|
|
.cyc_i ( wbs_cyc_i ),
|
208 |
|
|
.ack_o ( wbs_ack_o ),
|
209 |
|
|
.rty_o ( wbs_rty_o ),
|
210 |
|
|
.err_o ( wbs_err_o ),
|
211 |
|
|
.inta_o ( wb_inta_o ),
|
212 |
30 |
rherveille |
|
213 |
|
|
// internal connections
|
214 |
53 |
rherveille |
.wbm_busy ( wbm_busy ), // Data transfer in progress
|
215 |
|
|
.dvi_odf ( ctrl_dvi_odf ), // DVI output data format
|
216 |
|
|
.bl ( ctrl_bl ), // blank polarization level
|
217 |
|
|
.csl ( ctrl_csl ), // csync polarization level
|
218 |
|
|
.vsl ( ctrl_vsl ), // vsync polarization level
|
219 |
|
|
.hsl ( ctrl_hsl ), // hsync polarization level
|
220 |
|
|
.pc ( ctrl_pc ), // pseudo-color mode (only for 8bpp)
|
221 |
|
|
.cd ( ctrl_cd ), // color depth
|
222 |
|
|
.vbl ( ctrl_vbl ), // video memory burst length
|
223 |
|
|
.cbsw ( ctrl_cbsw ), // color lookup table bank switch enable
|
224 |
|
|
.vbsw ( ctrl_vbsw ), // video bank switch enable
|
225 |
|
|
.ven ( ctrl_ven ), // video enable
|
226 |
|
|
.acmp ( stat_acmp ), // active color lookup table page
|
227 |
|
|
.avmp ( stat_avmp ), // active video memory page
|
228 |
|
|
.cursor0_res ( cursor0_res ), // cursor0 resolution
|
229 |
|
|
.cursor0_en ( cursor0_en ), // cursor0 enable
|
230 |
|
|
.cursor0_xy ( cursor0_xy ), // cursor0 (x,y)
|
231 |
|
|
.cursor0_ba ( cursor0_ba ), // curso0 video memory base address
|
232 |
|
|
.cursor0_ld ( cursor0_ld ), // reload curso0 from video memory
|
233 |
|
|
.cc0_adr_i ( cc0_adr_i ), // cursor0 color registers address
|
234 |
|
|
.cc0_dat_o ( cc0_dat_o ), // cursor0 color registers data
|
235 |
|
|
.cursor1_res ( cursor1_res ), // cursor1 resolution
|
236 |
|
|
.cursor1_en ( cursor1_en ), // cursor1 enable
|
237 |
|
|
.cursor1_xy ( cursor1_xy ), // cursor1 (x,y)
|
238 |
|
|
.cursor1_ba ( cursor1_ba ), // cursor1 video memory base address
|
239 |
|
|
.cursor1_ld ( cursor1_ld ), // reload cursor1 from video memory
|
240 |
|
|
.cc1_adr_i ( cc1_adr_i ), // cursor1 color registers address
|
241 |
|
|
.cc1_dat_o ( cc1_dat_o ), // cursor1 color registers data
|
242 |
|
|
.vbsint_in ( vmem_swint ), // video memory bank switch interrupt
|
243 |
|
|
.cbsint_in ( clut_swint ), // clut memory bank switch interrupt
|
244 |
|
|
.hint_in ( hint ), // horizontal interrupt
|
245 |
|
|
.vint_in ( vint ), // vertical interrupt
|
246 |
|
|
.luint_in ( luint ), // line fifo underrun interrupt
|
247 |
|
|
.sint_in ( sint ), // system-error interrupt
|
248 |
|
|
.Thsync ( Thsync ),
|
249 |
|
|
.Thgdel ( Thgdel ),
|
250 |
|
|
.Thgate ( Thgate ),
|
251 |
|
|
.Thlen ( Thlen ),
|
252 |
|
|
.Tvsync ( Tvsync ),
|
253 |
|
|
.Tvgdel ( Tvgdel ),
|
254 |
|
|
.Tvgate ( Tvgate ),
|
255 |
|
|
.Tvlen ( Tvlen ),
|
256 |
|
|
.VBARa ( VBARa ),
|
257 |
|
|
.VBARb ( VBARb ),
|
258 |
|
|
.clut_acc ( ext_clut_req ),
|
259 |
|
|
.clut_ack ( ext_clut_ack ),
|
260 |
|
|
.clut_q ( ext_clut_q )
|
261 |
30 |
rherveille |
);
|
262 |
|
|
|
263 |
|
|
// hookup wishbone master
|
264 |
43 |
rherveille |
vga_wb_master wbm (
|
265 |
30 |
rherveille |
// wishbone interface
|
266 |
53 |
rherveille |
.clk_i ( wb_clk_i ),
|
267 |
|
|
.rst_i ( wb_rst_i ),
|
268 |
|
|
.nrst_i ( arst ),
|
269 |
|
|
.cyc_o ( wbm_cyc_o ),
|
270 |
|
|
.stb_o ( wbm_stb_o ),
|
271 |
|
|
.cti_o ( wbm_cti_o ),
|
272 |
|
|
.bte_o ( wbm_bte_o ),
|
273 |
|
|
.we_o ( wbm_we_o ),
|
274 |
|
|
.adr_o ( wbm_adr_o ),
|
275 |
|
|
.sel_o ( wbm_sel_o ),
|
276 |
|
|
.ack_i ( wbm_ack_i ),
|
277 |
|
|
.err_i ( wbm_err_i ),
|
278 |
|
|
.dat_i ( wbm_dat_i ),
|
279 |
30 |
rherveille |
|
280 |
|
|
// internal connections
|
281 |
53 |
rherveille |
.sint (sint ),
|
282 |
|
|
.ctrl_ven (ctrl_ven ),
|
283 |
|
|
.ctrl_cd (ctrl_cd ),
|
284 |
|
|
.ctrl_vbl (ctrl_vbl ),
|
285 |
|
|
.ctrl_vbsw (ctrl_vbsw ),
|
286 |
|
|
.busy (wbm_busy ),
|
287 |
|
|
.VBAa (VBARa ),
|
288 |
|
|
.VBAb (VBARb ),
|
289 |
|
|
.Thgate (Thgate ),
|
290 |
|
|
.Tvgate (Tvgate ),
|
291 |
|
|
.stat_avmp (stat_avmp ),
|
292 |
|
|
.vmem_switch (vmem_swint ),
|
293 |
|
|
.ImDoneFifoQ ( ImDoneFifoQ ),
|
294 |
30 |
rherveille |
|
295 |
53 |
rherveille |
.cursor_adr ( cursor_adr ),
|
296 |
|
|
.cursor0_ba ( cursor0_ba ), // curso0 video memory base address
|
297 |
|
|
.cursor0_ld ( cursor0_ld ), // reload curso0 from video memory
|
298 |
|
|
.cursor1_ba ( cursor1_ba ), // cursor1 video memory base address
|
299 |
|
|
.cursor1_ld ( cursor1_ld ), // reload cursor1 from video memory
|
300 |
30 |
rherveille |
|
301 |
53 |
rherveille |
.fb_data_fifo_rreq ( fb_data_fifo_rreq ),
|
302 |
|
|
.fb_data_fifo_q ( fb_data_fifo_q ),
|
303 |
|
|
.fb_data_fifo_empty ( fb_data_fifo_empty )
|
304 |
30 |
rherveille |
);
|
305 |
|
|
|
306 |
|
|
// hookup CLUT <cycle shared memory>
|
307 |
|
|
vga_csm_pb #(24, 9) clut_mem(
|
308 |
|
|
.clk_i(wb_clk_i),
|
309 |
|
|
|
310 |
|
|
// color processor access
|
311 |
|
|
.req0_i(cp_clut_req),
|
312 |
|
|
.ack0_o(cp_clut_ack),
|
313 |
|
|
.adr0_i(cp_clut_adr),
|
314 |
|
|
.dat0_i(24'h0),
|
315 |
|
|
.dat0_o(cp_clut_q),
|
316 |
|
|
.we0_i(1'b0), // no writes
|
317 |
|
|
|
318 |
|
|
// external access
|
319 |
|
|
.req1_i(ext_clut_req),
|
320 |
|
|
.ack1_o(ext_clut_ack),
|
321 |
|
|
.adr1_i(wbs_adr_i[10:2]),
|
322 |
|
|
.dat1_i(wbs_dat_i[23:0]),
|
323 |
|
|
.dat1_o(ext_clut_q),
|
324 |
|
|
.we1_i(wbs_we_i)
|
325 |
|
|
);
|
326 |
|
|
|
327 |
|
|
// hookup pixel and video timing generator
|
328 |
43 |
rherveille |
vga_pgen pixel_generator (
|
329 |
53 |
rherveille |
.clk_i ( wb_clk_i ),
|
330 |
|
|
.ctrl_ven ( ctrl_ven ),
|
331 |
|
|
.ctrl_HSyncL ( ctrl_hsl ),
|
332 |
|
|
.Thsync ( Thsync ),
|
333 |
|
|
.Thgdel ( Thgdel ),
|
334 |
|
|
.Thgate ( Thgate ),
|
335 |
|
|
.Thlen ( Thlen ),
|
336 |
|
|
.ctrl_VSyncL ( ctrl_vsl ),
|
337 |
|
|
.Tvsync ( Tvsync ),
|
338 |
|
|
.Tvgdel ( Tvgdel ),
|
339 |
|
|
.Tvgate ( Tvgate ),
|
340 |
|
|
.Tvlen ( Tvlen ),
|
341 |
|
|
.ctrl_CSyncL ( ctrl_csl ),
|
342 |
|
|
.ctrl_BlankL ( ctrl_bl ),
|
343 |
|
|
.eoh ( hint ),
|
344 |
|
|
.eov ( vint ),
|
345 |
30 |
rherveille |
|
346 |
53 |
rherveille |
// frame buffer data (from wbm)
|
347 |
|
|
.fb_data_fifo_rreq ( fb_data_fifo_rreq ),
|
348 |
|
|
.fb_data_fifo_q ( fb_data_fifo_q ),
|
349 |
|
|
.fb_data_fifo_empty ( fb_data_fifo_empty ),
|
350 |
|
|
.ImDoneFifoQ ( ImDoneFifoQ ),
|
351 |
30 |
rherveille |
|
352 |
53 |
rherveille |
// clut memory signals
|
353 |
|
|
.stat_acmp ( stat_acmp ),
|
354 |
|
|
.clut_req ( cp_clut_req ),
|
355 |
|
|
.clut_ack ( cp_clut_ack ),
|
356 |
|
|
.clut_adr ( cp_clut_adr ),
|
357 |
|
|
.clut_q ( cp_clut_q ),
|
358 |
|
|
.ctrl_cbsw ( ctrl_cbsw ),
|
359 |
|
|
.clut_switch ( clut_swint ),
|
360 |
30 |
rherveille |
|
361 |
53 |
rherveille |
.cursor_adr ( cursor_adr ), // cursor data address (from wbm)
|
362 |
|
|
.cursor0_en ( cursor0_en ), // cursor0 enable
|
363 |
|
|
.cursor0_res ( cursor0_res ), // cursor0 resolution
|
364 |
|
|
.cursor0_xy ( cursor0_xy ), // cursor0 (x,y)
|
365 |
|
|
.cc0_adr_o ( cc0_adr_i ), // cursor0 color registers address
|
366 |
|
|
.cc0_dat_i ( cc0_dat_o ), // cursor0 color registers data
|
367 |
|
|
.cursor1_en ( cursor1_en ), // cursor1 enable
|
368 |
|
|
.cursor1_res ( cursor1_res ), // cursor1 resolution
|
369 |
|
|
.cursor1_xy ( cursor1_xy ), // cursor1 (x,y)
|
370 |
|
|
.cc1_adr_o ( cc1_adr_i ), // cursor1 color registers address
|
371 |
|
|
.cc1_dat_i ( cc1_dat_o ), // cursor1 color registers data
|
372 |
|
|
|
373 |
|
|
.ctrl_dvi_odf ( ctrl_dvi_odf ),
|
374 |
|
|
.ctrl_cd ( ctrl_cd ),
|
375 |
|
|
.ctrl_pc ( ctrl_pc ),
|
376 |
|
|
|
377 |
|
|
// line fifo memory signals
|
378 |
|
|
.line_fifo_wreq ( line_fifo_wreq ),
|
379 |
|
|
.line_fifo_d ( line_fifo_d ),
|
380 |
|
|
.line_fifo_full ( line_fifo_full_wr ),
|
381 |
|
|
.line_fifo_rreq ( line_fifo_rreq ),
|
382 |
|
|
.line_fifo_q ( line_fifo_q ),
|
383 |
|
|
|
384 |
|
|
.pclk_i ( clk_p_i ),
|
385 |
|
|
`ifdef VGA_12BIT_DVI
|
386 |
|
|
.dvi_pclk_p_o ( dvi_pclk_p_o ),
|
387 |
|
|
.dvi_pclk_m_o ( dvi_pclk_m_o ),
|
388 |
|
|
.dvi_hsync_o ( dvi_hsync_o ),
|
389 |
|
|
.dvi_vsync_o ( dvi_vsync_o ),
|
390 |
|
|
.dvi_de_o ( dvi_de_o ),
|
391 |
|
|
.dvi_d_o ( dvi_d_o ),
|
392 |
|
|
`endif
|
393 |
|
|
.pclk_o ( clk_p_o ),
|
394 |
|
|
.hsync_o ( hsync_pad_o ),
|
395 |
|
|
.vsync_o ( vsync_pad_o ),
|
396 |
|
|
.csync_o ( csync_pad_o ),
|
397 |
|
|
.blank_o ( blank_pad_o ),
|
398 |
|
|
.r_o ( r_pad_o ),
|
399 |
|
|
.g_o ( g_pad_o ),
|
400 |
|
|
.b_o ( b_pad_o )
|
401 |
|
|
|
402 |
|
|
);
|
403 |
|
|
|
404 |
30 |
rherveille |
// hookup line-fifo
|
405 |
57 |
rherveille |
wire ctrl_ven_not = ~ctrl_ven;
|
406 |
43 |
rherveille |
vga_fifo_dc #(LINE_FIFO_AWIDTH, 24) line_fifo (
|
407 |
57 |
rherveille |
.rclk ( clk_p_i ),
|
408 |
|
|
.wclk ( wb_clk_i ),
|
409 |
|
|
.rclr ( 1'b0 ),
|
410 |
|
|
.wclr ( ctrl_ven_not ),
|
411 |
|
|
.wreq ( line_fifo_wreq ),
|
412 |
|
|
.d ( line_fifo_d ),
|
413 |
|
|
.rreq ( line_fifo_rreq ),
|
414 |
|
|
.q ( line_fifo_q ),
|
415 |
|
|
.empty ( line_fifo_empty_rd ),
|
416 |
|
|
.full ( line_fifo_full_wr )
|
417 |
30 |
rherveille |
);
|
418 |
|
|
|
419 |
|
|
// generate interrupt signal when reading line-fifo while it is empty (line-fifo under-run interrupt)
|
420 |
|
|
reg luint_pclk, sluint;
|
421 |
|
|
|
422 |
43 |
rherveille |
always @(posedge clk_p_i)
|
423 |
53 |
rherveille |
luint_pclk <= #1 line_fifo_rreq & line_fifo_empty_rd;
|
424 |
30 |
rherveille |
|
425 |
56 |
rherveille |
always @(posedge wb_clk_i)
|
426 |
53 |
rherveille |
if (!ctrl_ven)
|
427 |
43 |
rherveille |
begin
|
428 |
|
|
sluint <= #1 1'b0;
|
429 |
|
|
luint <= #1 1'b0;
|
430 |
|
|
end
|
431 |
|
|
else
|
432 |
|
|
begin
|
433 |
|
|
sluint <= #1 luint_pclk; // resample at wb_clk_i clock
|
434 |
|
|
luint <= #1 sluint; // sample again, reduce metastability risk
|
435 |
|
|
end
|
436 |
30 |
rherveille |
|
437 |
|
|
endmodule
|
438 |
33 |
rherveille |
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
|