1 |
2 |
robfinch |
// ============================================================================
|
2 |
|
|
// 2006-2011 Robert Finch
|
3 |
|
|
// robfinch@<remove>sympatico.ca
|
4 |
|
|
//
|
5 |
|
|
// rtfColorROM.v
|
6 |
|
|
// Color lookup ROM for TextController.
|
7 |
|
|
// Converts a 5-bit color code to a 24 bit RGB value.
|
8 |
|
|
//
|
9 |
|
|
//
|
10 |
|
|
// This source file is free software: you can redistribute it and/or modify
|
11 |
|
|
// it under the terms of the GNU Lesser General Public License as published
|
12 |
|
|
// by the Free Software Foundation, either version 3 of the License, or
|
13 |
|
|
// (at your option) any later version.
|
14 |
|
|
//
|
15 |
|
|
// This source file is distributed in the hope that it will be useful,
|
16 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
// GNU General Public License for more details.
|
19 |
|
|
//
|
20 |
|
|
// You should have received a copy of the GNU General Public License
|
21 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22 |
|
|
//
|
23 |
|
|
// ============================================================================
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
// TC64 color codes
|
27 |
|
|
`define TC64_BLACK 5'd0
|
28 |
|
|
`define TC64_WHITE 5'd1
|
29 |
|
|
`define TC64_RED 5'd2
|
30 |
|
|
`define TC64_CYAN 5'd3
|
31 |
|
|
`define TC64_PURPLE 5'd4
|
32 |
|
|
`define TC64_GREEN 5'd5
|
33 |
|
|
`define TC64_BLUE 5'd6
|
34 |
|
|
`define TC64_YELLOW 5'd7
|
35 |
|
|
`define TC64_ORANGE 5'd8
|
36 |
|
|
`define TC64_BROWN 5'd9
|
37 |
|
|
`define TC64_PINK 5'd10
|
38 |
|
|
`define TC64_DARK_GREY 5'd11
|
39 |
|
|
`define TC64_MEDIUM_GREY 5'd12
|
40 |
|
|
`define TC64_LIGHT_GREEN 5'd13
|
41 |
|
|
`define TC64_LIGHT_BLUE 5'd14
|
42 |
|
|
`define TC64_LIGHT_GREY 5'd15
|
43 |
|
|
|
44 |
|
|
`define TC64_BLACKa 5'd16
|
45 |
|
|
`define TC64_WHITEa 5'd17
|
46 |
|
|
`define TC64_REDa 5'd18
|
47 |
|
|
`define TC64_CYANa 5'd19
|
48 |
|
|
`define TC64_PURPLEa 5'd20
|
49 |
|
|
`define TC64_GREENa 5'd21
|
50 |
|
|
`define TC64_BLUEa 5'd22
|
51 |
|
|
`define TC64_YELLOWa 5'd23
|
52 |
|
|
`define TC64_ORANGEa 5'd24
|
53 |
|
|
`define TC64_BROWNa 5'd25
|
54 |
|
|
`define TC64_PINKa 5'd26
|
55 |
|
|
`define TC64_DARK_GREYa 5'd27
|
56 |
|
|
`define TC64_GREY3 5'd28
|
57 |
|
|
`define TC64_LIGHT_GREENa 5'd29
|
58 |
|
|
`define TC64_LIGHT_BLUEa 5'd30
|
59 |
|
|
`define TC64_GREY5 5'd31
|
60 |
|
|
|
61 |
|
|
module rtfColorROM(clk, ce, code, color);
|
62 |
|
|
input clk;
|
63 |
|
|
input ce;
|
64 |
|
|
input [4:0] code;
|
65 |
|
|
output [23:0] color;
|
66 |
|
|
reg [23:0] color;
|
67 |
|
|
|
68 |
|
|
always @(posedge clk)
|
69 |
|
|
if (ce) begin
|
70 |
|
|
case (code)
|
71 |
|
|
`TC64_BLACK: color = 24'h10_10_10;
|
72 |
|
|
`TC64_WHITE: color = 24'hFF_FF_FF;
|
73 |
|
|
`TC64_RED: color = 24'hE0_40_40;
|
74 |
|
|
`TC64_CYAN: color = 24'h60_FF_FF;
|
75 |
|
|
`TC64_PURPLE: color = 24'hE0_60_E0;
|
76 |
|
|
`TC64_GREEN: color = 24'h40_E0_40;
|
77 |
|
|
`TC64_BLUE: color = 24'h40_40_E0;
|
78 |
|
|
`TC64_YELLOW: color = 24'hFF_FF_40;
|
79 |
|
|
`TC64_ORANGE: color = 24'hE0_A0_40;
|
80 |
|
|
`TC64_BROWN: color = 24'h9C_74_48;
|
81 |
|
|
`TC64_PINK: color = 24'hFF_A0_A0;
|
82 |
|
|
`TC64_DARK_GREY: color = 24'h54_54_54;
|
83 |
|
|
`TC64_MEDIUM_GREY: color = 24'h88_88_88;
|
84 |
|
|
`TC64_LIGHT_GREEN: color = 24'hA0_FF_A0;
|
85 |
|
|
`TC64_LIGHT_BLUE: color = 24'hA0_A0_FF;
|
86 |
|
|
`TC64_LIGHT_GREY: color = 24'hC0_C0_C0;
|
87 |
|
|
|
88 |
|
|
`TC64_BLACKa: color = 24'h10_10_10;
|
89 |
|
|
`TC64_WHITEa: color = 24'hFF_FF_FF;
|
90 |
|
|
`TC64_REDa: color = 24'hE0_40_40;
|
91 |
|
|
`TC64_CYANa: color = 24'h60_FF_FF;
|
92 |
|
|
`TC64_PURPLEa: color = 24'hE0_60_E0;
|
93 |
|
|
`TC64_GREENa: color = 24'h40_E0_40;
|
94 |
|
|
`TC64_BLUEa: color = 24'h40_40_E0;
|
95 |
|
|
`TC64_YELLOWa: color = 24'hFF_FF_40;
|
96 |
|
|
`TC64_ORANGEa: color = 24'hE0_A0_40;
|
97 |
|
|
`TC64_BROWNa: color = 24'h9C_74_48;
|
98 |
|
|
`TC64_PINKa: color = 24'hFF_A0_A0;
|
99 |
|
|
`TC64_DARK_GREYa: color = 24'h54_54_54;
|
100 |
|
|
`TC64_GREY3: color = 24'h30_30_30;
|
101 |
|
|
`TC64_LIGHT_GREENa: color = 24'hA0_FF_A0;
|
102 |
|
|
`TC64_LIGHT_BLUEa: color = 24'hA0_A0_FF;
|
103 |
|
|
`TC64_GREY5: color = 24'h50_50_50;
|
104 |
|
|
|
105 |
|
|
endcase
|
106 |
|
|
end
|
107 |
|
|
|
108 |
|
|
endmodule
|
109 |
|
|
|
110 |
|
|
|