1 |
19 |
robfinch |
// ============================================================================
|
2 |
|
|
// __
|
3 |
|
|
// \\__/ o\ (C) 2006-2022 Robert Finch, Waterloo
|
4 |
|
|
// \ __ / All rights reserved.
|
5 |
|
|
// \/_// robfinch<remove>@finitron.ca
|
6 |
|
|
// ||
|
7 |
|
|
//
|
8 |
|
|
// rfColorROM.sv
|
9 |
|
|
//
|
10 |
|
|
// BSD 3-Clause License
|
11 |
|
|
// Redistribution and use in source and binary forms, with or without
|
12 |
|
|
// modification, are permitted provided that the following conditions are met:
|
13 |
|
|
//
|
14 |
|
|
// 1. Redistributions of source code must retain the above copyright notice, this
|
15 |
|
|
// list of conditions and the following disclaimer.
|
16 |
|
|
//
|
17 |
|
|
// 2. Redistributions in binary form must reproduce the above copyright notice,
|
18 |
|
|
// this list of conditions and the following disclaimer in the documentation
|
19 |
|
|
// and/or other materials provided with the distribution.
|
20 |
|
|
//
|
21 |
|
|
// 3. Neither the name of the copyright holder nor the names of its
|
22 |
|
|
// contributors may be used to endorse or promote products derived from
|
23 |
|
|
// this software without specific prior written permission.
|
24 |
|
|
//
|
25 |
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
26 |
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
27 |
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
28 |
|
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
29 |
|
|
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
30 |
|
|
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
31 |
|
|
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
32 |
|
|
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
33 |
|
|
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
34 |
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
//
|
36 |
|
|
// ============================================================================
|
37 |
|
|
|
38 |
|
|
// TC64 color codes
|
39 |
|
|
`define TC64_BLACK 5'd0
|
40 |
|
|
`define TC64_WHITE 5'd1
|
41 |
|
|
`define TC64_RED 5'd2
|
42 |
|
|
`define TC64_CYAN 5'd3
|
43 |
|
|
`define TC64_PURPLE 5'd4
|
44 |
|
|
`define TC64_GREEN 5'd5
|
45 |
|
|
`define TC64_BLUE 5'd6
|
46 |
|
|
`define TC64_YELLOW 5'd7
|
47 |
|
|
`define TC64_ORANGE 5'd8
|
48 |
|
|
`define TC64_BROWN 5'd9
|
49 |
|
|
`define TC64_PINK 5'd10
|
50 |
|
|
`define TC64_DARK_GREY 5'd11
|
51 |
|
|
`define TC64_MEDIUM_GREY 5'd12
|
52 |
|
|
`define TC64_LIGHT_GREEN 5'd13
|
53 |
|
|
`define TC64_LIGHT_BLUE 5'd14
|
54 |
|
|
`define TC64_LIGHT_GREY 5'd15
|
55 |
|
|
|
56 |
|
|
`define TC64_BLACKa 5'd16
|
57 |
|
|
`define TC64_WHITEa 5'd17
|
58 |
|
|
`define TC64_REDa 5'd18
|
59 |
|
|
`define TC64_CYANa 5'd19
|
60 |
|
|
`define TC64_PURPLEa 5'd20
|
61 |
|
|
`define TC64_GREENa 5'd21
|
62 |
|
|
`define TC64_BLUEa 5'd22
|
63 |
|
|
`define TC64_YELLOWa 5'd23
|
64 |
|
|
`define TC64_ORANGEa 5'd24
|
65 |
|
|
`define TC64_BROWNa 5'd25
|
66 |
|
|
`define TC64_PINKa 5'd26
|
67 |
|
|
`define TC64_DARK_GREYa 5'd27
|
68 |
|
|
`define TC64_GREY3 5'd28
|
69 |
|
|
`define TC64_LIGHT_GREENa 5'd29
|
70 |
|
|
`define TC64_LIGHT_BLUEa 5'd30
|
71 |
|
|
`define TC64_GREY5 5'd31
|
72 |
|
|
|
73 |
|
|
module rfColorROM(clk, ce, code, color);
|
74 |
|
|
input clk;
|
75 |
|
|
input ce;
|
76 |
|
|
input [4:0] code;
|
77 |
|
|
output [23:0] color;
|
78 |
|
|
reg [23:0] color;
|
79 |
|
|
|
80 |
|
|
always @(posedge clk)
|
81 |
|
|
if (ce) begin
|
82 |
|
|
case (code)
|
83 |
|
|
`TC64_BLACK: color = 24'h10_10_10;
|
84 |
|
|
`TC64_WHITE: color = 24'hFF_FF_FF;
|
85 |
|
|
`TC64_RED: color = 24'hE0_40_40;
|
86 |
|
|
`TC64_CYAN: color = 24'h60_FF_FF;
|
87 |
|
|
`TC64_PURPLE: color = 24'hE0_60_E0;
|
88 |
|
|
`TC64_GREEN: color = 24'h40_E0_40;
|
89 |
|
|
`TC64_BLUE: color = 24'h40_40_E0;
|
90 |
|
|
`TC64_YELLOW: color = 24'hFF_FF_40;
|
91 |
|
|
`TC64_ORANGE: color = 24'hE0_A0_40;
|
92 |
|
|
`TC64_BROWN: color = 24'h9C_74_48;
|
93 |
|
|
`TC64_PINK: color = 24'hFF_A0_A0;
|
94 |
|
|
`TC64_DARK_GREY: color = 24'h54_54_54;
|
95 |
|
|
`TC64_MEDIUM_GREY: color = 24'h88_88_88;
|
96 |
|
|
`TC64_LIGHT_GREEN: color = 24'hA0_FF_A0;
|
97 |
|
|
`TC64_LIGHT_BLUE: color = 24'hA0_A0_FF;
|
98 |
|
|
`TC64_LIGHT_GREY: color = 24'hC0_C0_C0;
|
99 |
|
|
|
100 |
|
|
`TC64_BLACKa: color = 24'h10_10_10;
|
101 |
|
|
`TC64_WHITEa: color = 24'hFF_FF_FF;
|
102 |
|
|
`TC64_REDa: color = 24'hE0_40_40;
|
103 |
|
|
`TC64_CYANa: color = 24'h60_FF_FF;
|
104 |
|
|
`TC64_PURPLEa: color = 24'hE0_60_E0;
|
105 |
|
|
`TC64_GREENa: color = 24'h40_E0_40;
|
106 |
|
|
`TC64_BLUEa: color = 24'h40_40_E0;
|
107 |
|
|
`TC64_YELLOWa: color = 24'hFF_FF_40;
|
108 |
|
|
`TC64_ORANGEa: color = 24'hE0_A0_40;
|
109 |
|
|
`TC64_BROWNa: color = 24'h9C_74_48;
|
110 |
|
|
`TC64_PINKa: color = 24'hFF_A0_A0;
|
111 |
|
|
`TC64_DARK_GREYa: color = 24'h54_54_54;
|
112 |
|
|
`TC64_GREY3: color = 24'h30_30_30;
|
113 |
|
|
`TC64_LIGHT_GREENa: color = 24'hA0_FF_A0;
|
114 |
|
|
`TC64_LIGHT_BLUEa: color = 24'hA0_A0_FF;
|
115 |
|
|
`TC64_GREY5: color = 24'h50_50_50;
|
116 |
|
|
|
117 |
|
|
endcase
|
118 |
|
|
end
|
119 |
|
|
|
120 |
|
|
endmodule
|
121 |
|
|
|
122 |
|
|
|