From 36a47d3c8d89db7f85847c9d0b8985a52a914409 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Thu, 1 May 2008 20:21:00 +0200 Subject: [PATCH 1/1] cleanup rom usage --- galaxian/galaxian.ucf | 32 ---------------- galaxian/src/mc_adec.v | 2 +- galaxian/src/mc_top.v | 82 ++++------------------------------------- galaxian/src/mc_video.v | 31 ++++++++++------ galaxian/src/roms.v | 32 ---------------- 5 files changed, 28 insertions(+), 151 deletions(-) diff --git a/galaxian/galaxian.ucf b/galaxian/galaxian.ucf index 04fc691..b7c2def 100644 --- a/galaxian/galaxian.ucf +++ b/galaxian/galaxian.ucf @@ -20,38 +20,6 @@ NET "I_PSW<6>" LOC = "J13" | IOSTANDARD = LVTTL | PULLDOWN; #s7 - c1 NET "I_PSW<7>" LOC = "J15" | IOSTANDARD = LVTTL | PULLDOWN; #s6 - s2 NET "I_PSW<8>" LOC = "J17" | IOSTANDARD = LVTTL | PULLDOWN; #s5 - c2 #------------------------------------------- -#--------- EEPROM I/F ---------------------- -#NET "I_ROM_DB<0>" LOC = "P70"; -#NET "I_ROM_DB<1>" LOC = "P68"; -#NET "I_ROM_DB<2>" LOC = "P63"; -#NET "I_ROM_DB<3>" LOC = "P58"; -#NET "I_ROM_DB<4>" LOC = "P60"; -#NET "I_ROM_DB<5>" LOC = "P62"; -#NET "I_ROM_DB<6>" LOC = "P57"; -#NET "I_ROM_DB<7>" LOC = "P59"; -#NET "O_ROM_AB<0>" LOC = "P71"; -#NET "O_ROM_AB<1>" LOC = "P74"; -#NET "O_ROM_AB<2>" LOC = "P73"; -#NET "O_ROM_AB<3>" LOC = "P75"; -#NET "O_ROM_AB<4>" LOC = "P81"; -#NET "O_ROM_AB<5>" LOC = "P82"; -#NET "O_ROM_AB<6>" LOC = "P84"; -#NET "O_ROM_AB<7>" LOC = "P86"; -#NET "O_ROM_AB<8>" LOC = "P89"; -#NET "O_ROM_AB<9>" LOC = "P87"; -#NET "O_ROM_AB<10>" LOC = "P64"; -#NET "O_ROM_AB<11>" LOC = "P83"; -#NET "O_ROM_AB<12>" LOC = "P88"; -#NET "O_ROM_AB<13>" LOC = "P95"; -#NET "O_ROM_AB<14>" LOC = "P97"; -#NET "O_ROM_AB<15>" LOC = "P93"; -#NET "O_ROM_AB<16>" LOC = "P96"; -#NET "O_ROM_AB<17>" LOC = "P98"; -#NET "O_ROM_AB<18>" LOC = "P94"; -#NET "O_ROM_CSn" LOC = "P61"; -#NET "O_ROM_OEn" LOC = "P69"; -#NET "O_ROM_WEn" LOC = "P100"; -#------------------------------------------- #--------- SOUND I/F ----------------------- NET "O_SOUND_OUT_L" LOC = "AA22" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8; NET "O_SOUND_OUT_R" LOC = "V19" | IOSTANDARD = LVTTL | SLEW = SLOW | DRIVE = 8; diff --git a/galaxian/src/mc_adec.v b/galaxian/src/mc_adec.v index 75f3b28..65525ba 100644 --- a/galaxian/src/mc_adec.v +++ b/galaxian/src/mc_adec.v @@ -271,4 +271,4 @@ assign O_H_FLIP = W_9N_Q[6]; // assign O_V_FLIP = W_9N_Q[7]; // -endmodule \ No newline at end of file +endmodule diff --git a/galaxian/src/mc_top.v b/galaxian/src/mc_top.v index 08d25de..99a4a6a 100644 --- a/galaxian/src/mc_top.v +++ b/galaxian/src/mc_top.v @@ -33,13 +33,6 @@ psTXD, psRXD, `endif -// ROM IF -//O_ROM_AB, -//I_ROM_DB, -//O_ROM_OEn, -//O_ROM_CSn, -//O_ROM_WEn, - // INPORT SW IF I_PSW, @@ -80,13 +73,6 @@ input psRXD; output psTXD,psCLK,psSEL; `endif -// ROM IF -//output [18:0]O_ROM_AB; -//input [7:0]I_ROM_DB; -//output O_ROM_OEn; -//output O_ROM_CSn; -//output O_ROM_WEn; - // INPORT SW IF input [8:0]I_PSW; @@ -107,13 +93,11 @@ wire I_CLK_18432M; wire W_CLK_12M,WB_CLK_12M; wire W_CLK_6M,WB_CLK_6M; wire W_STARS_CLK; -wire W_ROM_CLK; mc_dcm clockgen( .CLKIN_IN(I_CLK_125M), .RST_IN(! W_RESETn), -.CLKFX_OUT(I_CLK_18432M), -.CLK0_OUT(W_ROM_CLK) +.CLKFX_OUT(I_CLK_18432M) ); //------ H&V COUNTER ------------------------- @@ -412,71 +396,23 @@ mc_inport MC_INPORT( //----------------------------------------------------------------------------- //------- ROM ------------------------------------------------------- reg [18:0]ROM_A; -wire [10:0]W_OBJ_ROM_A; -reg [7:0]W_OBJ_ROM_A_D; -reg [7:0]W_OBJ_ROM_B_D; wire [18:0]W_WAV_A0,W_WAV_A1,W_WAV_A2; reg [7:0]W_WAV_D0,W_WAV_D1,W_WAV_D2; -wire [7:0]ROM_D; // = I_ROM_DB; -//assign O_ROM_AB = ROM_A; - -//assign O_ROM_OEn = 1'b0; -//assign O_ROM_CSn = 1'b0; -//assign O_ROM_WEn = 1'b1; +wire [7:0]ROM_D; galaxian_roms ROMS( -.I_ROM_CLK(W_ROM_CLK), -.I_ADDR(ROM_A), +.I_ROM_CLK(W_CLK_12M), +.I_ADDR({3'h0,W_A[15:0]}), .O_DATA(ROM_D) ); - -reg [1:0]clk_d; -reg [4:0]seq; -always @(posedge I_CLK_18432M) +always@(posedge W_CLK_12M) begin - // 24 phase generator - clk_d[0] <= W_H_CNT[0] & W_H_CNT[1] & W_H_CNT[2]; - clk_d[1] <= clk_d[0]; - seq <= (~clk_d[1] & clk_d[0]) ? 0 : seq+1; - case(seq) - 0:begin - ROM_A <= W_WAV_A0; - W_CPU_ROM_DO <= ROM_D; - end - 2:begin - ROM_A <= W_WAV_A1; - W_WAV_D0 <= ROM_D; - end - 4:begin - ROM_A <= {3'h0,W_A[15:0]}; - W_WAV_D1 <= ROM_D; - end - 6:begin - ROM_A <= W_WAV_A2; - W_CPU_ROM_DO <= ROM_D; - end - 8:W_WAV_D2 <= ROM_D; - 10:ROM_A <= {3'h0,W_A[15:0]}; - 12:W_CPU_ROM_DO <= ROM_D; - 14:ROM_A <= {3'h0,W_A[15:0]}; - 16:begin - ROM_A <= {3'h0,4'h4,1'b0,W_OBJ_ROM_A}; - W_CPU_ROM_DO <= ROM_D; - end - 18:begin - ROM_A <= {3'h0,4'h5,1'b0,W_OBJ_ROM_A}; - W_OBJ_ROM_A_D <= ROM_D; - end - 20:begin - ROM_A <= {3'h0,W_A[15:0]}; - W_OBJ_ROM_B_D <= ROM_D; - end - default:; - endcase + W_CPU_ROM_DO <= ROM_D; end + //----------------------------------------------------------------------------- wire W_V_BL2n; @@ -527,10 +463,6 @@ mc_video MC_VID( .I_VID_RAM_RDn(W_VID_RAM_RDn), .I_VID_RAM_WRn(W_VID_RAM_WRn), -.O_OBJ_ROM_A(W_OBJ_ROM_A), -.I_OBJ_ROM_A_D(W_OBJ_ROM_A_D), -.I_OBJ_ROM_B_D(W_OBJ_ROM_B_D), - .O_C_BLnX(W_C_BLnX), .O_8HF(W_8HF), .O_256HnX(W_256HnX), diff --git a/galaxian/src/mc_video.v b/galaxian/src/mc_video.v index c93b557..c184923 100644 --- a/galaxian/src/mc_video.v +++ b/galaxian/src/mc_video.v @@ -45,10 +45,6 @@ I_OBJ_RAM_WRn, I_VID_RAM_RDn, I_VID_RAM_WRn, -O_OBJ_ROM_A, -I_OBJ_ROM_A_D, -I_OBJ_ROM_B_D, - O_C_BLnX, O_8HF, O_256HnX, @@ -80,10 +76,6 @@ input I_OBJ_RAM_WRn; input I_VID_RAM_RDn; input I_VID_RAM_WRn; -output [10:0]O_OBJ_ROM_A; -input [7:0]I_OBJ_ROM_A_D; -input [7:0]I_OBJ_ROM_B_D; - output O_C_BLnX; output O_8HF; output O_256HnX; @@ -243,10 +235,27 @@ wire [7:0]W_OBJ_ROM_AB = {W_OBJ_D[5:0],W_1M[3],W_OBJ_D[6]^I_H_CNT[3]}; wire [7:0]W_OBJ_ROM_A = I_H_CNT[8] ? W_OBJ_ROM_AB: W_VID_RAM_DOB; -assign O_OBJ_ROM_A = {W_OBJ_ROM_A,W_1M[2:0]}; +wire [10:0]W_O_OBJ_ROM_A = {W_OBJ_ROM_A,W_1M[2:0]}; + +wire [7:0]W_1K_D; +wire [7:0]W_1H_D; + +//1K VID-Rom +GALAXIAN_1K K_ROM( +.CLK(I_CLK_12M), +.ADDR(W_O_OBJ_ROM_A), +.DATA(W_1K_D), +.ENA(1'b1) +); + +//1H VID-Rom +GALAXIAN_1H H_ROM( +.CLK(I_CLK_12M), +.ADDR(W_O_OBJ_ROM_A), +.DATA(W_1H_D), +.ENA(1'b1) +); -wire [7:0]W_1K_D = I_OBJ_ROM_A_D; -wire [7:0]W_1H_D = I_OBJ_ROM_B_D; //--------------------------------------------------------------------------------- wire W_2L_Qa,W_2K_Qd; diff --git a/galaxian/src/roms.v b/galaxian/src/roms.v index 8498a35..84c5a8c 100644 --- a/galaxian/src/roms.v +++ b/galaxian/src/roms.v @@ -55,26 +55,6 @@ GALAXIAN_7L L_ROM( .ENA(1'b1) ); -//1K VID-Rom -wire [7:0]K_ROM_D; - -GALAXIAN_1K K_ROM( -.CLK(I_ROM_CLK), -.ADDR(I_ADDR[10:0]), -.DATA(K_ROM_D), -.ENA(1'b1) -); - -//1H VID-Rom -wire [7:0]H_ROM_D; - -GALAXIAN_1H H_ROM( -.CLK(I_ROM_CLK), -.ADDR(I_ADDR[10:0]), -.DATA(H_ROM_D), -.ENA(1'b1) -); - reg [7:0]DATA_OUT; // address map @@ -109,18 +89,6 @@ begin //7l DATA_OUT <= L_ROM_D; end - else if (I_ADDR >= 18'h4000 && I_ADDR <= 18'h47ff) begin - //1k - DATA_OUT <= K_ROM_D; - end - else if (I_ADDR >= 18'h5000 && I_ADDR <= 18'h57ff) begin - //1h - DATA_OUT <= H_ROM_D; - end - else if (I_ADDR >= 18'h10000 && I_ADDR <= 18'h3fff) begin - //sound - DATA_OUT <= 8'h00; - end else begin DATA_OUT <= DATA_OUT; end -- 2.39.5