]> cvs.zerfleddert.de Git - fpga-games/blame - galaxian/src/mc_col_pal.v
faster clock for roms
[fpga-games] / galaxian / src / mc_col_pal.v
CommitLineData
782690d0
MG
1//===============================================================================\r
2// FPGA MOONCRESTA COLOR-PALETTE\r
3//\r
4// Version : 2.00\r
5//\r
6// Copyright(c) 2004 Katsumi Degawa , All rights reserved\r
7//\r
8// Important !\r
9//\r
10// This program is freeware for non-commercial use. \r
11// An author does no guarantee about this program.\r
12// You can use this under your own risk.\r
13//\r
14// 2004- 9-18 added Xilinx Device. K.Degawa\r
15//================================================================================\r
16`include "src/mc_conf.v"\r
17\r
18module mc_col_pal(\r
19\r
20I_CLK_12M,\r
21I_CLK_6M,\r
22I_VID,\r
23I_COL,\r
24I_C_BLnX,\r
25\r
26O_C_BLX,\r
27O_STARS_OFFn,\r
28O_R,\r
29O_G,\r
30O_B\r
31\r
32);\r
33\r
34input I_CLK_12M;\r
35input I_CLK_6M;\r
36input [1:0]I_VID;\r
37input [2:0]I_COL;\r
38input I_C_BLnX;\r
39\r
40output O_C_BLX;\r
41output O_STARS_OFFn;\r
42output [2:0]O_R;\r
43output [2:0]O_G;\r
44output [1:0]O_B;\r
45\r
46//--- Parts 6M --------------------------------------------------------\r
47wire [6:0]W_6M_DI = {I_COL[2:0],I_VID[1:0],~(I_VID[0]|I_VID[1]),I_C_BLnX};\r
48reg [6:0]W_6M_DO;\r
49\r
50wire W_6M_CLR = W_6M_DI[0]|W_6M_DO[0];\r
51assign O_C_BLX = ~(W_6M_DI[0]|W_6M_DO[0]);\r
52assign O_STARS_OFFn = W_6M_DO[1];\r
53\r
54always@(posedge I_CLK_6M or negedge W_6M_CLR)\r
55begin\r
56 if(W_6M_CLR==1'b0)\r
57 W_6M_DO <= 7'h00;\r
58 else\r
59 W_6M_DO <= W_6M_DI;\r
60end\r
61//--- COL ROM --------------------------------------------------------\r
62wire [4:0]W_COL_ROM_A = W_6M_DO[6:2];\r
63wire [7:0]W_COL_ROM_DO;\r
64wire W_COL_ROM_OEn = W_6M_DO[1];\r
65\r
66`ifdef DEVICE_CYCLONE\r
67mc_col_rom COL_ROM(\r
68\r
69.I_CLK(I_CLK_12M),\r
70.I_ADDR(W_COL_ROM_A),\r
71.O_DO(W_COL_ROM_DO),\r
72.I_OEn(W_COL_ROM_OEn)\r
73\r
74);\r
75`endif\r
76`ifdef DEVICE_SPARTAN2E\r
77GALAXIAN_6L COL_ROM(\r
78.CLK(I_CLK_12M),\r
79.ADDR(W_COL_ROM_A),\r
80.DATA(W_COL_ROM_DO),\r
81.ENA(1'b1)\r
82);\r
83//RAMB4_S8 col_rom00(\r
84//\r
85//.CLK(I_CLK_12M),\r
86//.ADDR({4'b0000,W_COL_ROM_A[4:0]}),\r
87//.DI(8'h00),\r
88//.DO(W_COL_ROM_DO),\r
89//.EN(1'b1),\r
90//.WE(1'b0),\r
91//.RST(1'b0)\r
92//\r
93//);\r
94`endif\r
95//--- VID OUT --------------------------------------------------------\r
96assign O_R[0] = W_COL_ROM_DO[2];\r
97assign O_R[1] = W_COL_ROM_DO[1];\r
98assign O_R[2] = W_COL_ROM_DO[0];\r
99\r
100assign O_G[0] = W_COL_ROM_DO[5];\r
101assign O_G[1] = W_COL_ROM_DO[4];\r
102assign O_G[2] = W_COL_ROM_DO[3];\r
103\r
104assign O_B[0] = W_COL_ROM_DO[7];\r
105assign O_B[1] = W_COL_ROM_DO[6];\r
106\r
107\r
108endmodule\r
Impressum, Datenschutz