good_char_mode.v
来自「Viertex 2 开发板的接口程序」· Verilog 代码 · 共 654 行
V
654 行
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
// SOLELY FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR
// XILINX DEVICES. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION
// AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION
// OR STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS
// IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
// AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
// FOR YOUR IMPLEMENTATION. XILINX EXPRESSLY DISCLAIMS ANY
// WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
// IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
// REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
// INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE.
//
// (c) Copyright 2004 Xilinx, Inc.
// All rights reserved.
//
/*
-------------------------------------------------------------------------------
Title : Character Mode Video Data Creation
Project : XUP Virtex-II Pro Development System
-------------------------------------------------------------------------------
File : HW_BIST.v
Company : Xilinx, Inc.
Created : 2004/08/12
Last Update: 2004/08/13
Copyright : (c) Xilinx Inc, 2004
-------------------------------------------------------------------------------
Uses : CHARACTER_MODE.v
-------------------------------------------------------------------------------
Used by : HW_BIST.v
-------------------------------------------------------------------------------
Description: This module is used to create the character mode video data.
The board serial number and the keyboard and mouse port data is
written into the character mode BRAM.
The user can augment the character mode area of the display
with 10 rows of text corresponding to character address 800-1599
using the external character mode control signals.
The data write side of the BRAMs is clocked by the system clock
and the read side is clocked by the pixel clock. This is done
to allow for synchronization between the processor bus and the
external character mode control signals.
To use the external data mode the address and data should be presented
on the ext_char_addr and ext_char_data buses, ext_write_enable and
ext_request should then be asserted. If the character address is
within the valid range, the data will be written into character mode
video RAM on the next rising edge of the system clock.
Conventions:
All external port signals are UPPER CASE.
All internal signals are LOWER CASE and are active HIGH.
-------------------------------------------------------------------------------
*/
module CHAR_MODE
(
char_mode_address,
char_line_count,
char_pixel,
pixel_clock,
write_clock,
reset,
sn_1,
sn_2,
sn_3,
sn_4,
sn_5,
sn_6,
sn_7,
sn_8,
sn_9,
sn_10,
sn_11,
sn_12,
ps2_mouse_ascii,
ps2_kbd_ascii,
char_mode_data,
ext_char_addr,
ext_char_data,
ext_write_enable,
ext_request
);
input [12:0] char_mode_address; // the block address of the character in character mode
input [2:0] char_line_count; // the line number within a character block 0-8
input [2:0] char_pixel; // the pixel number within a character block 0-8
input pixel_clock;
input write_clock; // clock for the write address counter
input reset;
input [7:0] sn_1; // Silicon Serial Number
input [7:0] sn_2;
input [7:0] sn_3;
input [7:0] sn_4;
input [7:0] sn_5;
input [7:0] sn_6;
input [7:0] sn_7;
input [7:0] sn_8;
input [7:0] sn_9;
input [7:0] sn_10;
input [7:0] sn_11;
input [7:0] sn_12;
input [7:0] ps2_mouse_ascii; // PS/2 mouse port character
input [7:0] ps2_kbd_ascii; // PS/2 keyboard port character
output [7:0] char_mode_data; // character mode video data
input [11:0] ext_char_addr; // character address for external data
input [7:0] ext_char_data; // external character data
input ext_write_enable; // external write enable
input ext_request; // flag to request external access to the character RAM
reg [7:0] char_write_data;
reg [12:0] char_write_addr;
wire write_enable = 1'b1;
wire [11:0] ext_char_addr;
wire [7:0] ext_char_data;
wire ext_write_enable;
wire ext_request;
reg valid_ext_request;
// create a flag to allow external access to the RAM if the address is in row 11 to row 20
always @ (ext_request or ext_char_addr) begin
if (ext_char_addr > 799 & ext_char_addr < 1600) begin
valid_ext_request <= ext_request;
end
else begin
valid_ext_request <= 1'b0;
end
end
// create the write address counter
always @ (posedge write_clock or posedge reset) begin
if (reset) begin
char_write_addr <= 13'h0000;
end
else if (char_write_addr == 751) begin
char_write_addr <= 13'h0000;
end
else begin
char_write_addr <= char_write_addr + 1;
end
end
// create the character mode text data in memory
always @ (char_write_addr or sn_12 or sn_11 or sn_10 or sn_9 or sn_8 or sn_7
or sn_6 or sn_5 or sn_4 or sn_3 or sn_2 or sn_1 or ps2_mouse_ascii[7:0] or ps2_kbd_ascii[7:0]) begin
case (char_write_addr)
00:begin // 1st row
char_write_data = 8'h01; // Xilinx bug top left
end
01:begin
char_write_data = 8'h02; // Xilinx bug top right
end
80:begin // 2nd row
char_write_data = 8'h03; // Xilinx bug bottom left
end
81:begin
char_write_data = 8'h04; // Xilinx bug bottom right
end
83:begin
char_write_data = 8'h58; // X
end
84:begin
char_write_data = 8'h49; // I
end
85:begin
char_write_data = 8'h4C; // L
end
86:begin
char_write_data = 8'h49; // I
end
87:begin
char_write_data = 8'h4E; // N
end
88:begin
char_write_data = 8'h58; // X
end
89:begin
char_write_data = 8'h20; // space
end
90:begin
char_write_data = 8'h52; // R
end
91:begin
char_write_data = 8'h45; // E
end
92:begin
char_write_data = 8'h53; // S
end
93:begin
char_write_data = 8'h45; // E
end
94:begin
char_write_data = 8'h41; // A
end
95:begin
char_write_data = 8'h52; // R
end
96:begin
char_write_data = 8'h43; // C
end
97:begin
char_write_data = 8'h48; // H
end
98:begin
char_write_data = 8'h20; // space
end
99:begin
char_write_data = 8'h4C; // L
end
100:begin
char_write_data = 8'h41; // A
end
101:begin
char_write_data = 8'h42; // B
end
102:begin
char_write_data = 8'h53; // S
end
240:begin //4th ROW
char_write_data = 8'h58; // X
end
241:begin
char_write_data = 8'h55; // U
end
242:begin
char_write_data = 8'h50; // P
end
243:begin
char_write_data = 8'h20; // space
end
244:begin
char_write_data = 8'h56; // V
end
245:begin
char_write_data = 8'h69; // i
end
246:begin
char_write_data = 8'h72; // r
end
247:begin
char_write_data = 8'h74; // t
end
248:begin
char_write_data = 8'h65; // e
end
249:begin
char_write_data = 8'h78; // x
end
250:begin
char_write_data = 8'h2D; // -
end
251:begin
char_write_data = 8'h49; // I
end
252:begin
char_write_data = 8'h49; // I
end
253:begin
char_write_data = 8'h20; // space
end
254:begin
char_write_data = 8'h50; // P
end
255:begin
char_write_data = 8'h72; // r
end
256:begin
char_write_data = 8'h6F; // o
end
257:begin
char_write_data = 8'h20; // space
end
258:begin
char_write_data = 8'h44; // D
end
259:begin
char_write_data = 8'h65; // e
end
260:begin
char_write_data = 8'h76; // v
end
261:begin
char_write_data = 8'h65; // e
end
262:begin
char_write_data = 8'h6C; // l
end
263:begin
char_write_data = 8'h6F; // o
end
264:begin
char_write_data = 8'h70; // p
end
265:begin
char_write_data = 8'h6D; // m
end
266:begin
char_write_data = 8'h65; // e
end
267:begin
char_write_data = 8'h6E; // n
end
268:begin
char_write_data = 8'h74; // t
end
269:begin
char_write_data = 8'h20; // SPACE
end
270:begin
char_write_data = 8'h53; // S
end
271:begin
char_write_data = 8'h79; // y
end
272:begin
char_write_data = 8'h73; // s
end
273:begin
char_write_data = 8'h74; // t
end
274:begin
char_write_data = 8'h65; // e
end
275:begin
char_write_data = 8'h6D; // m
end
400:begin // 6th ROW
char_write_data = 8'h42; // B
end
401:begin
char_write_data = 8'h4F; // O
end
402:begin
char_write_data = 8'h41; // A
end
403:begin
char_write_data = 8'h52; // R
end
404:begin
char_write_data = 8'h44; // D
end
405:begin
char_write_data = 8'h20; // space
end
406:begin
char_write_data = 8'h53; // S
end
407:begin
char_write_data = 8'h45; // E
end
408:begin
char_write_data = 8'h52; // R
end
409:begin
char_write_data = 8'h49; // I
end
410:begin
char_write_data = 8'h41; // A
end
411:begin
char_write_data = 8'h4C; // L
end
412:begin
char_write_data = 8'h20; // SPACE
end
413:begin
char_write_data = 8'h4E; // N
end
414:begin
char_write_data = 8'h55; // U
end
415:begin
char_write_data = 8'h4D; // M
end
416:begin
char_write_data = 8'h42; // B
end
417:begin
char_write_data = 8'h45; // E
end
418:begin
char_write_data = 8'h52; // R
end
419:begin
char_write_data = 8'h20; // space
end
420:begin
char_write_data = 8'h20; // space
end
421:begin
char_write_data = sn_12[7:0]; // digit 12 of serial number
end
422:begin
char_write_data = sn_11[7:0]; // digit 11 of serial number
end
423:begin
char_write_data = sn_10[7:0]; // digit 10 of serial number
end
424:begin
char_write_data = sn_9[7:0]; // digit 9 of serial number
end
425:begin
char_write_data = sn_8[7:0]; // digit 8 of serial number
end
426:begin
char_write_data = sn_7[7:0]; // digit 7 of serial number
end
427:begin
char_write_data = sn_6[7:0]; // digit 6 of serial number
end
428:begin
char_write_data = sn_5[7:0]; // digit 5 of serial number
end
429:begin
char_write_data = sn_4[7:0]; // digit 4 of serial number
end
430:begin
char_write_data = sn_3[7:0]; // digit 3 of serial number
end
431:begin
char_write_data = sn_2[7:0]; // digit 2 of serial number
end
432:begin
char_write_data = sn_1[7:0]; // digit 1 of serial number
end
560:begin //8th row
char_write_data = 8'h4D; // M
end
561:begin
char_write_data = 8'h4F; // O
end
562:begin
char_write_data = 8'h55; // U
end
563:begin
char_write_data = 8'h53; // S
end
564:begin //
char_write_data = 8'h45; // E
end
565:begin //
char_write_data = 8'h20; // SPACE
end
566:begin //
char_write_data = 8'h50; // P
end
567:begin //
char_write_data = 8'h4F; // O
end
568:begin //
char_write_data = 8'h52; // R
end
569:begin //
char_write_data = 8'h54; // T
end
570:begin //
char_write_data = 8'h20; // SPACE
end
571:begin //
char_write_data = 8'h41; // A
end
572:begin
char_write_data = 8'h53; // S
end
573:begin
char_write_data = 8'h43; // C
end
574:begin
char_write_data = 8'h49; // I
end
575:begin
char_write_data = 8'h49; // I
end
576:begin
char_write_data = 8'h20; // space
end
577:begin
char_write_data = 8'h43; // C
end
578:begin
char_write_data = 8'h48; // H
end
579:begin
char_write_data = 8'h41; // A
end
580:begin
char_write_data = 8'h52; // R
end
581:begin
char_write_data = 8'h41; // A
end
582:begin
char_write_data = 8'h43; // C
end
583:begin
char_write_data = 8'h54; // T
end
584:begin
char_write_data = 8'h45; // E
end
585:begin
char_write_data = 8'h52; // R
end
586:begin
char_write_data = 8'h20; // space
end
587:begin
char_write_data = 8'h20; // space
end
588:begin
char_write_data = 8'h22; // "
end
589:begin
char_write_data = ps2_mouse_ascii[7:0]; // the PS/2 character
end
590:begin
char_write_data = 8'h22; // "
end
720:begin // 10th row
char_write_data = 8'h4B; // K
end
721:begin
char_write_data = 8'h45; // E
end
722:begin
char_write_data = 8'h59; // Y
end
723:begin
char_write_data = 8'h42; // B
end
724:begin //
char_write_data = 8'h44; // D
end
725:begin //
char_write_data = 8'h20; // SPACE
end
726:begin //
char_write_data = 8'h50; // P
end
727:begin //
char_write_data = 8'h4F; // O
end
728:begin //
char_write_data = 8'h52; // R
end
729:begin //
char_write_data = 8'h54; // T
end
730:begin //
char_write_data = 8'h20; // SPACE
end
731:begin //
char_write_data = 8'h41; // A
end
732:begin
char_write_data = 8'h53; // S
end
733:begin
char_write_data = 8'h43; // C
end
734:begin
char_write_data = 8'h49; // I
end
735:begin
char_write_data = 8'h49; // I
end
736:begin
char_write_data = 8'h20; // space
end
737:begin
char_write_data = 8'h43; // C
end
738:begin
char_write_data = 8'h48; // H
end
739:begin
char_write_data = 8'h41; // A
end
740:begin
char_write_data = 8'h52; // R
end
741:begin
char_write_data = 8'h41; // A
end
742:begin
char_write_data = 8'h43; // C
end
743:begin
char_write_data = 8'h54; // T
end
744:begin
char_write_data = 8'h45; // E
end
745:begin
char_write_data = 8'h52; // R
end
746:begin
char_write_data = 8'h20; // space
end
747:begin
char_write_data = 8'h20; // space
end
748:begin
char_write_data = 8'h22; // "
end
749:begin
char_write_data = ps2_kbd_ascii[7:0]; // the PS/2 character
end
750:begin
char_write_data = 8'h22; // "
end
default:begin
char_write_data = 8'h20; // space
end
endcase
end
// the character mode block includes the character RAM and the character
// generator ROM
CHARACTER_MODE CHARACTER_MODE(
(valid_ext_request ? ext_char_addr : char_write_addr), // write address
(valid_ext_request ? ext_char_data : char_write_data), // write data
(valid_ext_request ? ext_write_enable : write_enable), // write enable
write_clock, // write clock
char_mode_address,
char_line_count,
char_pixel,
pixel_clock, // read clock
char_mode_data, // read data
reset
);
endmodule //CHAR_MODE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?