cleanup rom usage
[fpga-games] / galaxian / src / roms.v
1 module galaxian_roms(
2 I_ROM_CLK,
3 I_ADDR,
4 O_DATA
5 );
6
7 input I_ROM_CLK;
8 input [18:0]I_ADDR;
9 output [7:0]O_DATA;
10
11 //CPU-Roms
12 wire [7:0]U_ROM_D;
13
14 GALAXIAN_U U_ROM(
15 .CLK(I_ROM_CLK),
16 .ADDR(I_ADDR[10:0]),
17 .DATA(U_ROM_D),
18 .ENA(1'b1)
19 );
20
21 wire [7:0]V_ROM_D;
22
23 GALAXIAN_V V_ROM(
24 .CLK(I_ROM_CLK),
25 .ADDR(I_ADDR[10:0]),
26 .DATA(V_ROM_D),
27 .ENA(1'b1)
28 );
29
30 wire [7:0]W_ROM_D;
31
32 GALAXIAN_W W_ROM(
33 .CLK(I_ROM_CLK),
34 .ADDR(I_ADDR[10:0]),
35 .DATA(W_ROM_D),
36 .ENA(1'b1)
37 );
38
39 wire [7:0]Y_ROM_D;
40
41 GALAXIAN_Y Y_ROM(
42 .CLK(I_ROM_CLK),
43 .ADDR(I_ADDR[10:0]),
44 .DATA(Y_ROM_D),
45 .ENA(1'b1)
46 );
47
48 //7L CPU-Rom
49 wire [7:0]L_ROM_D;
50
51 GALAXIAN_7L L_ROM(
52 .CLK(I_ROM_CLK),
53 .ADDR(I_ADDR[10:0]),
54 .DATA(L_ROM_D),
55 .ENA(1'b1)
56 );
57
58 reg [7:0]DATA_OUT;
59
60 // address map
61 //--------------------------------------------------
62 // 0x00000 - 0x007FF galmidw.u CPU-ROM
63 // 0x00800 - 0x00FFF galmidw.v CPU-ROM
64 // 0x01000 - 0x017FF galmidw.w CPU-ROM
65 // 0x01800 - 0x01FFF galmidw.y CPU-ROM
66 // 0x02000 - 0x027FF 7l CPU-ROM
67 // 0x04000 - 0x047FF 1k.bin VID-ROM
68 // 0x05000 - 0x057FF 1h.bin VID-ROM
69 // 0x10000 - 0x3FFFF mc_wav_2.bin Sound(Wav)Data
70 always@(posedge I_ROM_CLK)
71 begin
72 if (I_ADDR <= 18'h7ff) begin
73 //u
74 DATA_OUT <= U_ROM_D;
75 end
76 else if (I_ADDR >= 18'h800 && I_ADDR <= 18'hfff) begin
77 //v
78 DATA_OUT <= V_ROM_D;
79 end
80 else if (I_ADDR >= 18'h1000 && I_ADDR <= 18'h17ff) begin
81 //w
82 DATA_OUT <= W_ROM_D;
83 end
84 else if (I_ADDR >= 18'h1800 && I_ADDR <= 18'h1fff) begin
85 //y
86 DATA_OUT <= Y_ROM_D;
87 end
88 else if (I_ADDR >= 18'h2000 && I_ADDR <= 18'h27ff) begin
89 //7l
90 DATA_OUT <= L_ROM_D;
91 end
92 else begin
93 DATA_OUT <= DATA_OUT;
94 end
95 end
96
97 assign O_DATA = DATA_OUT;
98
99 endmodule
Impressum, Datenschutz