1 |
3 |
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 code is available for evaluation and validation purposes
|
11 |
|
|
// only. This copyright statement and disclaimer must remain present in
|
12 |
|
|
// the file.
|
13 |
|
|
//
|
14 |
|
|
//
|
15 |
|
|
// NO WARRANTY.
|
16 |
|
|
// THIS Work, IS PROVIDEDED "AS IS" WITH NO WARRANTIES OF ANY KIND, WHETHER
|
17 |
|
|
// EXPRESS OR IMPLIED. The user must assume the entire risk of using the
|
18 |
|
|
// Work.
|
19 |
|
|
//
|
20 |
|
|
// IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
|
21 |
|
|
// INCIDENTAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES WHATSOEVER RELATING TO
|
22 |
|
|
// THE USE OF THIS WORK, OR YOUR RELATIONSHIP WITH THE AUTHOR.
|
23 |
|
|
//
|
24 |
|
|
// IN ADDITION, IN NO EVENT DOES THE AUTHOR AUTHORIZE YOU TO USE THE WORK
|
25 |
|
|
// IN APPLICATIONS OR SYSTEMS WHERE THE WORK'S FAILURE TO PERFORM CAN
|
26 |
|
|
// REASONABLY BE EXPECTED TO RESULT IN A SIGNIFICANT PHYSICAL INJURY, OR IN
|
27 |
|
|
// LOSS OF LIFE. ANY SUCH USE BY YOU IS ENTIRELY AT YOUR OWN RISK, AND YOU
|
28 |
|
|
// AGREE TO HOLD THE AUTHOR AND CONTRIBUTORS HARMLESS FROM ANY CLAIMS OR
|
29 |
|
|
// LOSSES RELATING TO SUCH UNAUTHORIZED USE.
|
30 |
|
|
//
|
31 |
|
|
//
|
32 |
|
|
// Webpack 9.1i xc3s1000-4ft256
|
33 |
|
|
// LUTs / slices / MHz
|
34 |
|
|
// block rams
|
35 |
|
|
//
|
36 |
|
|
// ============================================================================
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
// TC64 color codes
|
40 |
|
|
`define TC64_BLACK 5'd0
|
41 |
|
|
`define TC64_WHITE 5'd1
|
42 |
|
|
`define TC64_RED 5'd2
|
43 |
|
|
`define TC64_CYAN 5'd3
|
44 |
|
|
`define TC64_PURPLE 5'd4
|
45 |
|
|
`define TC64_GREEN 5'd5
|
46 |
|
|
`define TC64_BLUE 5'd6
|
47 |
|
|
`define TC64_YELLOW 5'd7
|
48 |
|
|
`define TC64_ORANGE 5'd8
|
49 |
|
|
`define TC64_BROWN 5'd9
|
50 |
|
|
`define TC64_PINK 5'd10
|
51 |
|
|
`define TC64_DARK_GREY 5'd11
|
52 |
|
|
`define TC64_MEDIUM_GREY 5'd12
|
53 |
|
|
`define TC64_LIGHT_GREEN 5'd13
|
54 |
|
|
`define TC64_LIGHT_BLUE 5'd14
|
55 |
|
|
`define TC64_LIGHT_GREY 5'd15
|
56 |
|
|
|
57 |
|
|
`define TC64_BLACKa 5'd16
|
58 |
|
|
`define TC64_WHITEa 5'd17
|
59 |
|
|
`define TC64_REDa 5'd18
|
60 |
|
|
`define TC64_CYANa 5'd19
|
61 |
|
|
`define TC64_PURPLEa 5'd20
|
62 |
|
|
`define TC64_GREENa 5'd21
|
63 |
|
|
`define TC64_BLUEa 5'd22
|
64 |
|
|
`define TC64_YELLOWa 5'd23
|
65 |
|
|
`define TC64_ORANGEa 5'd24
|
66 |
|
|
`define TC64_BROWNa 5'd25
|
67 |
|
|
`define TC64_PINKa 5'd26
|
68 |
|
|
`define TC64_DARK_GREYa 5'd27
|
69 |
|
|
`define TC64_GREY3 5'd28
|
70 |
|
|
`define TC64_LIGHT_GREENa 5'd29
|
71 |
|
|
`define TC64_LIGHT_BLUEa 5'd30
|
72 |
|
|
`define TC64_GREY5 5'd31
|
73 |
|
|
|
74 |
|
|
module rtfColorROM(clk, ce, code, color);
|
75 |
|
|
input clk;
|
76 |
|
|
input ce;
|
77 |
|
|
input [4:0] code;
|
78 |
|
|
output [23:0] color;
|
79 |
|
|
reg [23:0] color;
|
80 |
|
|
|
81 |
|
|
always @(posedge clk)
|
82 |
|
|
if (ce) begin
|
83 |
|
|
case (code)
|
84 |
|
|
`TC64_BLACK: color = 24'h10_10_10;
|
85 |
|
|
`TC64_WHITE: color = 24'hFF_FF_FF;
|
86 |
|
|
`TC64_RED: color = 24'hE0_40_40;
|
87 |
|
|
`TC64_CYAN: color = 24'h60_FF_FF;
|
88 |
|
|
`TC64_PURPLE: color = 24'hE0_60_E0;
|
89 |
|
|
`TC64_GREEN: color = 24'h40_E0_40;
|
90 |
|
|
`TC64_BLUE: color = 24'h40_40_E0;
|
91 |
|
|
`TC64_YELLOW: color = 24'hFF_FF_40;
|
92 |
|
|
`TC64_ORANGE: color = 24'hE0_A0_40;
|
93 |
|
|
`TC64_BROWN: color = 24'h9C_74_48;
|
94 |
|
|
`TC64_PINK: color = 24'hFF_A0_A0;
|
95 |
|
|
`TC64_DARK_GREY: color = 24'h54_54_54;
|
96 |
|
|
`TC64_MEDIUM_GREY: color = 24'h88_88_88;
|
97 |
|
|
`TC64_LIGHT_GREEN: color = 24'hA0_FF_A0;
|
98 |
|
|
`TC64_LIGHT_BLUE: color = 24'hA0_A0_FF;
|
99 |
|
|
`TC64_LIGHT_GREY: color = 24'hC0_C0_C0;
|
100 |
|
|
|
101 |
|
|
`TC64_BLACKa: color = 24'h10_10_10;
|
102 |
|
|
`TC64_WHITEa: color = 24'hFF_FF_FF;
|
103 |
|
|
`TC64_REDa: color = 24'hE0_40_40;
|
104 |
|
|
`TC64_CYANa: color = 24'h60_FF_FF;
|
105 |
|
|
`TC64_PURPLEa: color = 24'hE0_60_E0;
|
106 |
|
|
`TC64_GREENa: color = 24'h40_E0_40;
|
107 |
|
|
`TC64_BLUEa: color = 24'h40_40_E0;
|
108 |
|
|
`TC64_YELLOWa: color = 24'hFF_FF_40;
|
109 |
|
|
`TC64_ORANGEa: color = 24'hE0_A0_40;
|
110 |
|
|
`TC64_BROWNa: color = 24'h9C_74_48;
|
111 |
|
|
`TC64_PINKa: color = 24'hFF_A0_A0;
|
112 |
|
|
`TC64_DARK_GREYa: color = 24'h54_54_54;
|
113 |
|
|
`TC64_GREY3: color = 24'h30_30_30;
|
114 |
|
|
`TC64_LIGHT_GREENa: color = 24'hA0_FF_A0;
|
115 |
|
|
`TC64_LIGHT_BLUEa: color = 24'hA0_A0_FF;
|
116 |
|
|
`TC64_GREY5: color = 24'h50_50_50;
|
117 |
|
|
|
118 |
|
|
endcase
|
119 |
|
|
end
|
120 |
|
|
|
121 |
|
|
endmodule
|
122 |
|
|
|
123 |
|
|
|