1 |
3 |
olivier.gi |
//----------------------------------------------------------------------------
|
2 |
|
|
// Copyright (C) 2016 Authors
|
3 |
|
|
//
|
4 |
|
|
// This source file may be used and distributed without restriction provided
|
5 |
|
|
// that this copyright statement is not removed from the file and that any
|
6 |
|
|
// derivative work contains the original copyright notice and the associated
|
7 |
|
|
// disclaimer.
|
8 |
|
|
//
|
9 |
|
|
// This source file is free software; you can redistribute it and/or modify
|
10 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
11 |
|
|
// by the Free Software Foundation; either version 2.1 of the License, or
|
12 |
|
|
// (at your option) any later version.
|
13 |
|
|
//
|
14 |
|
|
// This source is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
16 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
17 |
|
|
// License for more details.
|
18 |
|
|
//
|
19 |
|
|
// You should have received a copy of the GNU Lesser General Public License
|
20 |
|
|
// along with this source; if not, write to the Free Software Foundation,
|
21 |
|
|
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
22 |
|
|
//
|
23 |
|
|
//----------------------------------------------------------------------------
|
24 |
|
|
//
|
25 |
|
|
// *File Name: openGFX430.v
|
26 |
|
|
//
|
27 |
|
|
// *Module Description:
|
28 |
|
|
// This is a basic video controller for the openMSP430.
|
29 |
|
|
//
|
30 |
|
|
// It is currently supporting the LT24 LCD Board but
|
31 |
|
|
// can be extended to anything.
|
32 |
|
|
//
|
33 |
|
|
// *Author(s):
|
34 |
|
|
// - Olivier Girard, olgirard@gmail.com
|
35 |
|
|
//
|
36 |
|
|
//----------------------------------------------------------------------------
|
37 |
|
|
// $Rev$
|
38 |
|
|
// $LastChangedBy$
|
39 |
|
|
// $LastChangedDate$
|
40 |
|
|
//----------------------------------------------------------------------------
|
41 |
|
|
`ifdef OGFX_NO_INCLUDE
|
42 |
|
|
`else
|
43 |
|
|
`include "openGFX430_defines.v"
|
44 |
|
|
`endif
|
45 |
|
|
|
46 |
|
|
module openGFX430 (
|
47 |
|
|
|
48 |
|
|
// OUTPUTs
|
49 |
11 |
olivier.gi |
irq_gfx_o, // Graphic Controller interrupt
|
50 |
3 |
olivier.gi |
|
51 |
11 |
olivier.gi |
lt24_cs_n_o, // LT24 Chip select (Active low)
|
52 |
|
|
lt24_rd_n_o, // LT24 Read strobe (Active low)
|
53 |
|
|
lt24_wr_n_o, // LT24 Write strobe (Active low)
|
54 |
|
|
lt24_rs_o, // LT24 Command/Param selection (Cmd=0/Param=1)
|
55 |
|
|
lt24_d_o, // LT24 Data output
|
56 |
|
|
lt24_d_en_o, // LT24 Data output enable
|
57 |
|
|
lt24_reset_n_o, // LT24 Reset (Active Low)
|
58 |
|
|
lt24_on_o, // LT24 on/off
|
59 |
3 |
olivier.gi |
|
60 |
11 |
olivier.gi |
per_dout_o, // Peripheral data output
|
61 |
3 |
olivier.gi |
|
62 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
63 |
11 |
olivier.gi |
lut_ram_addr_o, // LUT-RAM address
|
64 |
|
|
lut_ram_wen_o, // LUT-RAM write enable (active low)
|
65 |
|
|
lut_ram_cen_o, // LUT-RAM enable (active low)
|
66 |
|
|
lut_ram_din_o, // LUT-RAM data input
|
67 |
3 |
olivier.gi |
`endif
|
68 |
|
|
|
69 |
11 |
olivier.gi |
vid_ram_addr_o, // Video-RAM address
|
70 |
|
|
vid_ram_wen_o, // Video-RAM write enable (active low)
|
71 |
|
|
vid_ram_cen_o, // Video-RAM enable (active low)
|
72 |
|
|
vid_ram_din_o, // Video-RAM data input
|
73 |
3 |
olivier.gi |
|
74 |
|
|
// INPUTs
|
75 |
11 |
olivier.gi |
dbg_freeze_i, // Freeze address auto-incr on read
|
76 |
|
|
mclk, // Main system clock
|
77 |
|
|
per_addr_i, // Peripheral address
|
78 |
|
|
per_din_i, // Peripheral data input
|
79 |
|
|
per_en_i, // Peripheral enable (high active)
|
80 |
|
|
per_we_i, // Peripheral write enable (high active)
|
81 |
|
|
puc_rst, // Main system reset
|
82 |
3 |
olivier.gi |
|
83 |
11 |
olivier.gi |
lt24_d_i, // LT24 Data input
|
84 |
3 |
olivier.gi |
|
85 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
86 |
11 |
olivier.gi |
lut_ram_dout_i, // LUT-RAM data output
|
87 |
3 |
olivier.gi |
`endif
|
88 |
11 |
olivier.gi |
vid_ram_dout_i // Video-RAM data output
|
89 |
3 |
olivier.gi |
);
|
90 |
|
|
|
91 |
11 |
olivier.gi |
// PARAMETERs
|
92 |
|
|
//============
|
93 |
|
|
|
94 |
|
|
parameter [14:0] BASE_ADDR = 15'h0200; // Register base address
|
95 |
|
|
// - 7 LSBs must stay cleared: 0x0080, 0x0100,
|
96 |
|
|
// 0x0180, 0x0200,
|
97 |
|
|
// 0x0280, ...
|
98 |
3 |
olivier.gi |
// OUTPUTs
|
99 |
|
|
//=========
|
100 |
11 |
olivier.gi |
output irq_gfx_o; // Graphic Controller interrupt
|
101 |
3 |
olivier.gi |
|
102 |
11 |
olivier.gi |
output lt24_cs_n_o; // LT24 Chip select (Active low)
|
103 |
|
|
output lt24_rd_n_o; // LT24 Read strobe (Active low)
|
104 |
|
|
output lt24_wr_n_o; // LT24 Write strobe (Active low)
|
105 |
|
|
output lt24_rs_o; // LT24 Command/Param selection (Cmd=0/Param=1)
|
106 |
|
|
output [15:0] lt24_d_o; // LT24 Data output
|
107 |
|
|
output lt24_d_en_o; // LT24 Data output enable
|
108 |
|
|
output lt24_reset_n_o; // LT24 Reset (Active Low)
|
109 |
|
|
output lt24_on_o; // LT24 on/off
|
110 |
3 |
olivier.gi |
|
111 |
11 |
olivier.gi |
output [15:0] per_dout_o; // Peripheral data output
|
112 |
3 |
olivier.gi |
|
113 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
114 |
11 |
olivier.gi |
output [`LRAM_MSB:0] lut_ram_addr_o; // LUT-RAM address
|
115 |
|
|
output lut_ram_wen_o; // LUT-RAM write enable (active low)
|
116 |
|
|
output lut_ram_cen_o; // LUT-RAM enable (active low)
|
117 |
|
|
output [15:0] lut_ram_din_o; // LUT-RAM data input
|
118 |
3 |
olivier.gi |
`endif
|
119 |
|
|
|
120 |
11 |
olivier.gi |
output [`VRAM_MSB:0] vid_ram_addr_o; // Video-RAM address
|
121 |
|
|
output vid_ram_wen_o; // Video-RAM write enable (active low)
|
122 |
|
|
output vid_ram_cen_o; // Video-RAM enable (active low)
|
123 |
|
|
output [15:0] vid_ram_din_o; // Video-RAM data input
|
124 |
3 |
olivier.gi |
|
125 |
|
|
// INPUTs
|
126 |
|
|
//=========
|
127 |
11 |
olivier.gi |
input dbg_freeze_i; // Freeze address auto-incr on read
|
128 |
|
|
input mclk; // Main system clock
|
129 |
|
|
input [13:0] per_addr_i; // Peripheral address
|
130 |
|
|
input [15:0] per_din_i; // Peripheral data input
|
131 |
|
|
input per_en_i; // Peripheral enable (high active)
|
132 |
|
|
input [1:0] per_we_i; // Peripheral write enable (high active)
|
133 |
|
|
input puc_rst; // Main system reset
|
134 |
3 |
olivier.gi |
|
135 |
11 |
olivier.gi |
input [15:0] lt24_d_i; // LT24 Data input
|
136 |
3 |
olivier.gi |
|
137 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
138 |
11 |
olivier.gi |
input [15:0] lut_ram_dout_i; // LUT-RAM data output
|
139 |
3 |
olivier.gi |
`endif
|
140 |
11 |
olivier.gi |
input [15:0] vid_ram_dout_i; // Video-RAM data output
|
141 |
3 |
olivier.gi |
|
142 |
|
|
|
143 |
|
|
//=============================================================================
|
144 |
|
|
// 1) WIRE & PARAMETER DECLARATION
|
145 |
|
|
//=============================================================================
|
146 |
|
|
|
147 |
|
|
wire [2:0] lt24_cfg_clk;
|
148 |
|
|
wire [11:0] lt24_cfg_refr;
|
149 |
|
|
wire lt24_cfg_refr_sync_en;
|
150 |
|
|
wire [9:0] lt24_cfg_refr_sync_val;
|
151 |
|
|
wire lt24_cmd_refr;
|
152 |
|
|
wire [7:0] lt24_cmd_val;
|
153 |
|
|
wire lt24_cmd_has_param;
|
154 |
|
|
wire [15:0] lt24_cmd_param;
|
155 |
|
|
wire lt24_cmd_param_rdy;
|
156 |
|
|
wire [15:0] lt24_cmd_dfill;
|
157 |
|
|
wire lt24_cmd_dfill_wr;
|
158 |
|
|
|
159 |
|
|
wire [`LPIX_MSB:0] display_width;
|
160 |
|
|
wire [`LPIX_MSB:0] display_height;
|
161 |
|
|
wire [`SPIX_MSB:0] display_size;
|
162 |
|
|
wire display_y_swap;
|
163 |
|
|
wire display_x_swap;
|
164 |
|
|
wire display_cl_swap;
|
165 |
|
|
wire [2:0] gfx_mode;
|
166 |
|
|
|
167 |
|
|
wire [4:0] lt24_status;
|
168 |
|
|
wire lt24_done_evt;
|
169 |
|
|
wire lt24_start_evt;
|
170 |
|
|
|
171 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
172 |
|
|
wire [`LRAM_MSB:0] lut_ram_sw_addr;
|
173 |
|
|
wire [15:0] lut_ram_sw_din;
|
174 |
|
|
wire lut_ram_sw_wen;
|
175 |
|
|
wire lut_ram_sw_cen;
|
176 |
|
|
wire [15:0] lut_ram_sw_dout;
|
177 |
|
|
wire [`LRAM_MSB:0] lut_ram_refr_addr;
|
178 |
|
|
wire lut_ram_refr_cen;
|
179 |
|
|
wire [15:0] lut_ram_refr_dout;
|
180 |
|
|
wire lut_ram_refr_dout_rdy_nxt;
|
181 |
|
|
`endif
|
182 |
|
|
wire [`VRAM_MSB:0] vid_ram_sw_addr;
|
183 |
|
|
wire [15:0] vid_ram_sw_din;
|
184 |
|
|
wire vid_ram_sw_wen;
|
185 |
|
|
wire vid_ram_sw_cen;
|
186 |
|
|
wire [15:0] vid_ram_sw_dout;
|
187 |
|
|
wire [`VRAM_MSB:0] vid_ram_gpu_addr;
|
188 |
|
|
wire [15:0] vid_ram_gpu_din;
|
189 |
|
|
wire vid_ram_gpu_wen;
|
190 |
|
|
wire vid_ram_gpu_cen;
|
191 |
|
|
wire [15:0] vid_ram_gpu_dout;
|
192 |
|
|
wire vid_ram_gpu_dout_rdy_nxt;
|
193 |
|
|
wire [`VRAM_MSB:0] vid_ram_refr_addr;
|
194 |
|
|
wire vid_ram_refr_cen;
|
195 |
|
|
wire [15:0] vid_ram_refr_dout;
|
196 |
|
|
wire vid_ram_refr_dout_rdy_nxt;
|
197 |
|
|
|
198 |
|
|
wire refresh_active;
|
199 |
|
|
wire [15:0] refresh_data;
|
200 |
|
|
wire refresh_data_ready;
|
201 |
|
|
wire refresh_data_request;
|
202 |
|
|
wire [`APIX_MSB:0] refresh_frame_addr;
|
203 |
11 |
olivier.gi |
wire [2:0] hw_lut_palette_sel;
|
204 |
|
|
wire [3:0] hw_lut_bgcolor;
|
205 |
|
|
wire [3:0] hw_lut_fgcolor;
|
206 |
|
|
wire sw_lut_enable;
|
207 |
|
|
wire sw_lut_bank_select;
|
208 |
3 |
olivier.gi |
|
209 |
|
|
wire gpu_cmd_done_evt;
|
210 |
|
|
wire gpu_cmd_error_evt;
|
211 |
6 |
olivier.gi |
wire gpu_dma_busy;
|
212 |
3 |
olivier.gi |
wire gpu_get_data;
|
213 |
|
|
wire [15:0] gpu_data;
|
214 |
|
|
wire gpu_data_avail;
|
215 |
|
|
wire gpu_enable;
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
//============================================================================
|
219 |
|
|
// 2) REGISTERS
|
220 |
|
|
//============================================================================
|
221 |
|
|
|
222 |
11 |
olivier.gi |
ogfx_reg #(.BASE_ADDR(BASE_ADDR)) ogfx_reg_inst (
|
223 |
3 |
olivier.gi |
|
224 |
|
|
// OUTPUTs
|
225 |
|
|
.irq_gfx_o ( irq_gfx_o ), // Graphic Controller interrupt
|
226 |
|
|
|
227 |
|
|
.gpu_data_o ( gpu_data ), // GPU data
|
228 |
|
|
.gpu_data_avail_o ( gpu_data_avail ), // GPU data available
|
229 |
|
|
.gpu_enable_o ( gpu_enable ), // GPU enable
|
230 |
|
|
|
231 |
|
|
.lt24_reset_n_o ( lt24_reset_n_o ), // LT24 Reset (Active Low)
|
232 |
|
|
.lt24_on_o ( lt24_on_o ), // LT24 on/off
|
233 |
|
|
.lt24_cfg_clk_o ( lt24_cfg_clk ), // LT24 Interface clock configuration
|
234 |
|
|
.lt24_cfg_refr_o ( lt24_cfg_refr ), // LT24 Interface refresh configuration
|
235 |
|
|
.lt24_cfg_refr_sync_en_o ( lt24_cfg_refr_sync_en ), // LT24 Interface refresh sync enable configuration
|
236 |
|
|
.lt24_cfg_refr_sync_val_o ( lt24_cfg_refr_sync_val ), // LT24 Interface refresh sync value configuration
|
237 |
|
|
.lt24_cmd_refr_o ( lt24_cmd_refr ), // LT24 Interface refresh command
|
238 |
|
|
.lt24_cmd_val_o ( lt24_cmd_val ), // LT24 Generic command value
|
239 |
|
|
.lt24_cmd_has_param_o ( lt24_cmd_has_param ), // LT24 Generic command has parameters
|
240 |
|
|
.lt24_cmd_param_o ( lt24_cmd_param ), // LT24 Generic command parameter value
|
241 |
|
|
.lt24_cmd_param_rdy_o ( lt24_cmd_param_rdy ), // LT24 Generic command trigger
|
242 |
|
|
.lt24_cmd_dfill_o ( lt24_cmd_dfill ), // LT24 Data fill value
|
243 |
|
|
.lt24_cmd_dfill_wr_o ( lt24_cmd_dfill_wr ), // LT24 Data fill trigger
|
244 |
|
|
|
245 |
|
|
.display_width_o ( display_width ), // Display width
|
246 |
|
|
.display_height_o ( display_height ), // Display height
|
247 |
|
|
.display_size_o ( display_size ), // Display size (number of pixels)
|
248 |
|
|
.display_y_swap_o ( display_y_swap ), // Display configuration: swap Y axis (horizontal symmetry)
|
249 |
|
|
.display_x_swap_o ( display_x_swap ), // Display configuration: swap X axis (vertical symmetry)
|
250 |
|
|
.display_cl_swap_o ( display_cl_swap ), // Display configuration: swap column/lines
|
251 |
|
|
|
252 |
|
|
.gfx_mode_o ( gfx_mode ), // Video mode (1xx:16bpp / 011:8bpp / 010:4bpp / 001:2bpp / 000:1bpp)
|
253 |
|
|
|
254 |
|
|
.per_dout_o ( per_dout_o ), // Peripheral data output
|
255 |
|
|
|
256 |
|
|
.refresh_frame_addr_o ( refresh_frame_addr ), // Refresh frame base address
|
257 |
|
|
|
258 |
11 |
olivier.gi |
.hw_lut_palette_sel_o ( hw_lut_palette_sel ), // Hardware LUT palette configuration
|
259 |
|
|
.hw_lut_bgcolor_o ( hw_lut_bgcolor ), // Hardware LUT background-color selection
|
260 |
|
|
.hw_lut_fgcolor_o ( hw_lut_fgcolor ), // Hardware LUT foreground-color selection
|
261 |
|
|
.sw_lut_enable_o ( sw_lut_enable ), // Refresh LUT-RAM enable
|
262 |
|
|
.sw_lut_bank_select_o ( sw_lut_bank_select ), // Refresh LUT-RAM bank selection
|
263 |
|
|
|
264 |
3 |
olivier.gi |
`ifdef WITH_PROGRAMMABLE_LUT
|
265 |
|
|
.lut_ram_addr_o ( lut_ram_sw_addr ), // LUT-RAM address
|
266 |
|
|
.lut_ram_din_o ( lut_ram_sw_din ), // LUT-RAM data
|
267 |
|
|
.lut_ram_wen_o ( lut_ram_sw_wen ), // LUT-RAM write strobe (active low)
|
268 |
|
|
.lut_ram_cen_o ( lut_ram_sw_cen ), // LUT-RAM chip enable (active low)
|
269 |
|
|
`endif
|
270 |
|
|
|
271 |
|
|
.vid_ram_addr_o ( vid_ram_sw_addr ), // Video-RAM address
|
272 |
|
|
.vid_ram_din_o ( vid_ram_sw_din ), // Video-RAM data
|
273 |
|
|
.vid_ram_wen_o ( vid_ram_sw_wen ), // Video-RAM write strobe (active low)
|
274 |
|
|
.vid_ram_cen_o ( vid_ram_sw_cen ), // Video-RAM chip enable (active low)
|
275 |
|
|
|
276 |
|
|
// INPUTs
|
277 |
|
|
.dbg_freeze_i ( dbg_freeze_i ), // Freeze address auto-incr on read
|
278 |
|
|
.gpu_cmd_done_evt_i ( gpu_cmd_done_evt ), // GPU command done event
|
279 |
|
|
.gpu_cmd_error_evt_i ( gpu_cmd_error_evt ), // GPU command error event
|
280 |
6 |
olivier.gi |
.gpu_dma_busy_i ( gpu_dma_busy ), // GPU DMA execution on going
|
281 |
3 |
olivier.gi |
.gpu_get_data_i ( gpu_get_data ), // GPU get next data
|
282 |
|
|
.lt24_status_i ( lt24_status ), // LT24 FSM Status
|
283 |
|
|
.lt24_start_evt_i ( lt24_start_evt ), // LT24 FSM start event
|
284 |
|
|
.lt24_done_evt_i ( lt24_done_evt ), // LT24 FSM done event
|
285 |
|
|
.mclk ( mclk ), // Main system clock
|
286 |
|
|
.per_addr_i ( per_addr_i ), // Peripheral address
|
287 |
|
|
.per_din_i ( per_din_i ), // Peripheral data input
|
288 |
|
|
.per_en_i ( per_en_i ), // Peripheral enable (high active)
|
289 |
|
|
.per_we_i ( per_we_i ), // Peripheral write enable (high active)
|
290 |
|
|
.puc_rst ( puc_rst ), // Main system reset
|
291 |
|
|
|
292 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
293 |
|
|
.lut_ram_dout_i ( lut_ram_sw_dout ), // LUT-RAM data input
|
294 |
|
|
`endif
|
295 |
|
|
.vid_ram_dout_i ( vid_ram_sw_dout ) // Video-RAM data input
|
296 |
|
|
);
|
297 |
|
|
|
298 |
|
|
|
299 |
|
|
//============================================================================
|
300 |
|
|
// 3) GPU
|
301 |
|
|
//============================================================================
|
302 |
|
|
|
303 |
|
|
ogfx_gpu ogfx_gpu_inst (
|
304 |
|
|
|
305 |
|
|
// OUTPUTs
|
306 |
|
|
.gpu_cmd_done_evt_o ( gpu_cmd_done_evt ), // GPU command done event
|
307 |
|
|
.gpu_cmd_error_evt_o ( gpu_cmd_error_evt ), // GPU command error event
|
308 |
6 |
olivier.gi |
.gpu_dma_busy_o ( gpu_dma_busy ), // GPU DMA execution on going
|
309 |
3 |
olivier.gi |
.gpu_get_data_o ( gpu_get_data ), // GPU get next data
|
310 |
|
|
|
311 |
|
|
.vid_ram_addr_o ( vid_ram_gpu_addr ), // Video-RAM address
|
312 |
|
|
.vid_ram_din_o ( vid_ram_gpu_din ), // Video-RAM data
|
313 |
|
|
.vid_ram_wen_o ( vid_ram_gpu_wen ), // Video-RAM write strobe (active low)
|
314 |
|
|
.vid_ram_cen_o ( vid_ram_gpu_cen ), // Video-RAM chip enable (active low)
|
315 |
|
|
|
316 |
|
|
// INPUTs
|
317 |
|
|
.mclk ( mclk ), // Main system clock
|
318 |
|
|
.puc_rst ( puc_rst ), // Main system reset
|
319 |
|
|
|
320 |
|
|
.display_width_i ( display_width ), // Display width
|
321 |
|
|
|
322 |
|
|
.gfx_mode_i ( gfx_mode ), // Video mode (1xx:16bpp / 011:8bpp / 010:4bpp / 001:2bpp / 000:1bpp)
|
323 |
|
|
|
324 |
|
|
.gpu_data_i ( gpu_data ), // GPU data
|
325 |
|
|
.gpu_data_avail_i ( gpu_data_avail ), // GPU data available
|
326 |
|
|
.gpu_enable_i ( gpu_enable ), // GPU enable
|
327 |
|
|
|
328 |
|
|
.vid_ram_dout_i ( vid_ram_gpu_dout ), // Video-RAM data input
|
329 |
|
|
.vid_ram_dout_rdy_nxt_i ( vid_ram_gpu_dout_rdy_nxt ) // Video-RAM data output ready during next cycle
|
330 |
|
|
);
|
331 |
|
|
|
332 |
|
|
|
333 |
|
|
//============================================================================
|
334 |
|
|
// 4) LT24 INTERFACE
|
335 |
|
|
//============================================================================
|
336 |
|
|
|
337 |
|
|
ogfx_if_lt24 ogfx_if_lt24_inst (
|
338 |
|
|
|
339 |
|
|
// OUTPUTs
|
340 |
|
|
.event_fsm_done_o ( lt24_done_evt ), // LT24 FSM done event
|
341 |
|
|
.event_fsm_start_o ( lt24_start_evt ), // LT24 FSM start event
|
342 |
|
|
|
343 |
|
|
.lt24_cs_n_o ( lt24_cs_n_o ), // LT24 Chip select (Active low)
|
344 |
|
|
.lt24_d_o ( lt24_d_o ), // LT24 Data output
|
345 |
|
|
.lt24_d_en_o ( lt24_d_en_o ), // LT24 Data output enable
|
346 |
|
|
.lt24_rd_n_o ( lt24_rd_n_o ), // LT24 Read strobe (Active low)
|
347 |
|
|
.lt24_rs_o ( lt24_rs_o ), // LT24 Command/Param selection (Cmd=0/Param=1)
|
348 |
|
|
.lt24_wr_n_o ( lt24_wr_n_o ), // LT24 Write strobe (Active low)
|
349 |
|
|
|
350 |
|
|
.refresh_active_o ( refresh_active ), // Display refresh on going
|
351 |
|
|
.refresh_data_request_o ( refresh_data_request ), // Display refresh new data request
|
352 |
|
|
|
353 |
|
|
.status_o ( lt24_status ), // LT24 FSM Status
|
354 |
|
|
|
355 |
|
|
// INPUTs
|
356 |
|
|
.mclk ( mclk ), // Main system clock
|
357 |
|
|
.puc_rst ( puc_rst ), // Main system reset
|
358 |
|
|
|
359 |
|
|
.cfg_lt24_clk_div_i ( lt24_cfg_clk ), // Clock Divider configuration for LT24 interface
|
360 |
|
|
.cfg_lt24_display_size_i ( display_size ), // Display size (number of pixels)
|
361 |
|
|
.cfg_lt24_refresh_i ( lt24_cfg_refr ), // Refresh rate configuration for LT24 interface
|
362 |
|
|
.cfg_lt24_refresh_sync_en_i ( lt24_cfg_refr_sync_en ), // Refresh sync enable configuration for LT24 interface
|
363 |
|
|
.cfg_lt24_refresh_sync_val_i ( lt24_cfg_refr_sync_val ), // Refresh sync value configuration for LT24 interface
|
364 |
|
|
|
365 |
|
|
.cmd_dfill_i ( lt24_cmd_dfill ), // Display data fill
|
366 |
|
|
.cmd_dfill_trig_i ( lt24_cmd_dfill_wr ), // Trigger a full display data fill
|
367 |
|
|
|
368 |
|
|
.cmd_generic_cmd_val_i ( lt24_cmd_val ), // Generic command value
|
369 |
|
|
.cmd_generic_has_param_i ( lt24_cmd_has_param ), // Generic command to be sent has parameter(s)
|
370 |
|
|
.cmd_generic_param_val_i ( lt24_cmd_param ), // Generic command parameter value
|
371 |
|
|
.cmd_generic_trig_i ( lt24_cmd_param_rdy ), // Trigger generic command transmit (or new parameter available)
|
372 |
|
|
|
373 |
|
|
.cmd_refresh_i ( lt24_cmd_refr ), // Display refresh command
|
374 |
|
|
|
375 |
|
|
.lt24_d_i ( lt24_d_i ), // LT24 Data input
|
376 |
|
|
|
377 |
|
|
.refresh_data_i ( refresh_data ), // Display refresh data
|
378 |
|
|
.refresh_data_ready_i ( refresh_data_ready ) // Display refresh new data is ready
|
379 |
|
|
);
|
380 |
|
|
|
381 |
|
|
//============================================================================
|
382 |
|
|
// 5) VIDEO BACKEND
|
383 |
|
|
//============================================================================
|
384 |
|
|
|
385 |
|
|
// Video Backend
|
386 |
|
|
ogfx_backend ogfx_backend_inst (
|
387 |
|
|
|
388 |
|
|
// OUTPUTs
|
389 |
|
|
.refresh_data_o ( refresh_data ), // Display refresh data
|
390 |
|
|
.refresh_data_ready_o ( refresh_data_ready ), // Display refresh new data is ready
|
391 |
|
|
|
392 |
|
|
.vid_ram_addr_o ( vid_ram_refr_addr ), // Video-RAM address
|
393 |
|
|
.vid_ram_cen_o ( vid_ram_refr_cen ), // Video-RAM enable (active low)
|
394 |
|
|
|
395 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
396 |
|
|
.lut_ram_addr_o ( lut_ram_refr_addr ), // LUT-RAM address
|
397 |
|
|
.lut_ram_cen_o ( lut_ram_refr_cen ), // LUT-RAM enable (active low)
|
398 |
|
|
`endif
|
399 |
|
|
|
400 |
|
|
// INPUTs
|
401 |
|
|
.mclk ( mclk ), // Main system clock
|
402 |
|
|
.puc_rst ( puc_rst ), // Main system reset
|
403 |
|
|
|
404 |
|
|
.display_width_i ( display_width ), // Display width
|
405 |
|
|
.display_height_i ( display_height ), // Display height
|
406 |
|
|
.display_size_i ( display_size ), // Display size (number of pixels)
|
407 |
|
|
.display_y_swap_i ( display_y_swap ), // Display configuration: swap Y axis (horizontal symmetry)
|
408 |
|
|
.display_x_swap_i ( display_x_swap ), // Display configuration: swap X axis (vertical symmetry)
|
409 |
|
|
.display_cl_swap_i ( display_cl_swap ), // Display configuration: swap column/lines
|
410 |
|
|
|
411 |
|
|
.gfx_mode_i ( gfx_mode ), // Video mode (1xx:16bpp / 011:8bpp / 010:4bpp / 001:2bpp / 000:1bpp)
|
412 |
|
|
|
413 |
|
|
`ifdef WITH_PROGRAMMABLE_LUT
|
414 |
|
|
.lut_ram_dout_i ( lut_ram_refr_dout ), // LUT-RAM data output
|
415 |
|
|
.lut_ram_dout_rdy_nxt_i ( lut_ram_refr_dout_rdy_nxt ), // LUT-RAM data output ready during next cycle
|
416 |
|
|
`endif
|
417 |
|
|
|
418 |
|
|
.vid_ram_dout_i ( vid_ram_refr_dout ), // Video-RAM data output
|
419 |
|
|
.vid_ram_dout_rdy_nxt_i ( vid_ram_refr_dout_rdy_nxt ), // Video-RAM data output ready during next cycle
|
420 |
|
|
|
421 |
|
|
.refresh_active_i ( refresh_active ), // Display refresh on going
|
422 |
|
|
.refresh_data_request_i ( refresh_data_request ), // Display refresh new data request
|
423 |
|
|
.refresh_frame_base_addr_i ( refresh_frame_addr ), // Refresh frame base address
|
424 |
11 |
olivier.gi |
|
425 |
|
|
.hw_lut_palette_sel_i ( hw_lut_palette_sel ), // Hardware LUT palette configuration
|
426 |
|
|
.hw_lut_bgcolor_i ( hw_lut_bgcolor ), // Hardware LUT background-color selection
|
427 |
|
|
.hw_lut_fgcolor_i ( hw_lut_fgcolor ), // Hardware LUT foreground-color selection
|
428 |
|
|
.sw_lut_enable_i ( sw_lut_enable ), // Refresh LUT-RAM enable
|
429 |
|
|
.sw_lut_bank_select_i ( sw_lut_bank_select ) // Refresh LUT-RAM bank selection
|
430 |
3 |
olivier.gi |
);
|
431 |
|
|
|
432 |
|
|
//============================================================================
|
433 |
|
|
// 6) ARBITER FOR VIDEO AND LUT MEMORIES
|
434 |
|
|
//============================================================================
|
435 |
|
|
|
436 |
|
|
ogfx_ram_arbiter ogfx_ram_arbiter_inst (
|
437 |
|
|
|
438 |
|
|
.mclk ( mclk ), // Main system clock
|
439 |
|
|
.puc_rst ( puc_rst ), // Main system reset
|
440 |
|
|
|
441 |
|
|
//------------------------------------------------------------
|
442 |
|
|
|
443 |
|
|
// SW interface, fixed highest priority
|
444 |
|
|
.lut_ram_sw_addr_i ( lut_ram_sw_addr ), // LUT-RAM Software address
|
445 |
|
|
.lut_ram_sw_din_i ( lut_ram_sw_din ), // LUT-RAM Software data
|
446 |
|
|
.lut_ram_sw_wen_i ( lut_ram_sw_wen ), // LUT-RAM Software write strobe (active low)
|
447 |
|
|
.lut_ram_sw_cen_i ( lut_ram_sw_cen ), // LUT-RAM Software chip enable (active low)
|
448 |
|
|
.lut_ram_sw_dout_o ( lut_ram_sw_dout ), // LUT-RAM Software data input
|
449 |
|
|
|
450 |
|
|
// Refresh-backend, fixed lowest priority
|
451 |
|
|
.lut_ram_refr_addr_i ( lut_ram_refr_addr ), // LUT-RAM Refresh address
|
452 |
|
|
.lut_ram_refr_din_i ( 16'h0000 ), // LUT-RAM Refresh data
|
453 |
|
|
.lut_ram_refr_wen_i ( 1'h1 ), // LUT-RAM Refresh write strobe (active low)
|
454 |
|
|
.lut_ram_refr_cen_i ( lut_ram_refr_cen ), // LUT-RAM Refresh enable (active low)
|
455 |
|
|
.lut_ram_refr_dout_o ( lut_ram_refr_dout ), // LUT-RAM Refresh data output
|
456 |
|
|
.lut_ram_refr_dout_rdy_nxt_o ( lut_ram_refr_dout_rdy_nxt ), // LUT-RAM Refresh data output ready during next cycle
|
457 |
|
|
|
458 |
|
|
// LUT Memory interface
|
459 |
|
|
.lut_ram_addr_o ( lut_ram_addr_o ), // LUT-RAM address
|
460 |
|
|
.lut_ram_din_o ( lut_ram_din_o ), // LUT-RAM data
|
461 |
|
|
.lut_ram_wen_o ( lut_ram_wen_o ), // LUT-RAM write strobe (active low)
|
462 |
|
|
.lut_ram_cen_o ( lut_ram_cen_o ), // LUT-RAM chip enable (active low)
|
463 |
|
|
.lut_ram_dout_i ( lut_ram_dout_i ), // LUT-RAM data input
|
464 |
|
|
|
465 |
|
|
//------------------------------------------------------------
|
466 |
|
|
|
467 |
|
|
// SW interface, fixed highest priority
|
468 |
|
|
.vid_ram_sw_addr_i ( vid_ram_sw_addr ), // Video-RAM Software address
|
469 |
|
|
.vid_ram_sw_din_i ( vid_ram_sw_din ), // Video-RAM Software data
|
470 |
|
|
.vid_ram_sw_wen_i ( vid_ram_sw_wen ), // Video-RAM Software write strobe (active low)
|
471 |
|
|
.vid_ram_sw_cen_i ( vid_ram_sw_cen ), // Video-RAM Software chip enable (active low)
|
472 |
|
|
.vid_ram_sw_dout_o ( vid_ram_sw_dout ), // Video-RAM Software data input
|
473 |
|
|
|
474 |
|
|
// GPU interface (round-robin with refresh-backend)
|
475 |
|
|
.vid_ram_gpu_addr_i ( vid_ram_gpu_addr ), // Video-RAM GPU address
|
476 |
|
|
.vid_ram_gpu_din_i ( vid_ram_gpu_din ), // Video-RAM GPU data
|
477 |
|
|
.vid_ram_gpu_wen_i ( vid_ram_gpu_wen ), // Video-RAM GPU write strobe (active low)
|
478 |
|
|
.vid_ram_gpu_cen_i ( vid_ram_gpu_cen ), // Video-RAM GPU chip enable (active low)
|
479 |
|
|
.vid_ram_gpu_dout_o ( vid_ram_gpu_dout ), // Video-RAM GPU data input
|
480 |
|
|
.vid_ram_gpu_dout_rdy_nxt_o ( vid_ram_gpu_dout_rdy_nxt ), // Video-RAM GPU data output ready during next cycle
|
481 |
|
|
|
482 |
|
|
// Refresh-backend (round-robin with GPU interface)
|
483 |
|
|
.vid_ram_refr_addr_i ( vid_ram_refr_addr ), // Video-RAM Refresh address
|
484 |
|
|
.vid_ram_refr_din_i ( 16'h0000 ), // Video-RAM Refresh data
|
485 |
|
|
.vid_ram_refr_wen_i ( 1'h1 ), // Video-RAM Refresh write strobe (active low)
|
486 |
|
|
.vid_ram_refr_cen_i ( vid_ram_refr_cen ), // Video-RAM Refresh enable (active low)
|
487 |
|
|
.vid_ram_refr_dout_o ( vid_ram_refr_dout ), // Video-RAM Refresh data output
|
488 |
|
|
.vid_ram_refr_dout_rdy_nxt_o ( vid_ram_refr_dout_rdy_nxt ), // Video-RAM Refresh data output ready during next cycle
|
489 |
|
|
|
490 |
|
|
// Video Memory interface
|
491 |
|
|
.vid_ram_addr_o ( vid_ram_addr_o ), // Video-RAM address
|
492 |
|
|
.vid_ram_din_o ( vid_ram_din_o ), // Video-RAM data
|
493 |
|
|
.vid_ram_wen_o ( vid_ram_wen_o ), // Video-RAM write strobe (active low)
|
494 |
|
|
.vid_ram_cen_o ( vid_ram_cen_o ), // Video-RAM chip enable (active low)
|
495 |
|
|
.vid_ram_dout_i ( vid_ram_dout_i ) // Video-RAM data input
|
496 |
|
|
|
497 |
|
|
//------------------------------------------------------------
|
498 |
|
|
);
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
endmodule // openGFX430
|
502 |
|
|
|
503 |
|
|
`ifdef OGFX_NO_INCLUDE
|
504 |
|
|
`else
|
505 |
|
|
`include "openGFX430_undefines.v"
|
506 |
|
|
`endif
|