GBC: routed out T80 stop signal and implemented freq. switch

This commit is contained in:
Bruno Duarte Gouveia
2018-12-17 22:39:25 +00:00
parent 69c3c8f09a
commit 0741ddce90
2 changed files with 11 additions and 2 deletions

11
gb.v
View File

@@ -117,6 +117,7 @@ wire cpu_m1_n;
wire cpu_mreq_n;
wire cpu_clken = isGBC ? !hdma_rd:1'b1; //when hdma is enabled stop CPU (GBC)
wire cpu_stop;
GBse cpu (
.RESET_n ( !reset ),
@@ -136,7 +137,8 @@ GBse cpu (
.BUSAK_n ( ),
.A ( cpu_addr ),
.DI ( cpu_di ),
.DO ( cpu_do )
.DO ( cpu_do ),
.STOP ( cpu_stop )
);
// --------------------------------------------------------------------
@@ -151,8 +153,13 @@ always @(posedge clk2x) begin
cpu_speed <= 1'b0;
end else if (sel_key1 && !cpu_wr_n && isGBC)begin
prepare_switch <= cpu_do[0];
//TODO: wait for stop to toggle speed
end
if (isGBC && prepare_switch && cpu_stop) begin
cpu_speed <= !cpu_speed;
prepare_switch <= 1'b0;
end
end
// --------------------------------------------------------------------

View File

@@ -93,6 +93,7 @@ entity GBse is
RFSH_n : out std_logic;
HALT_n : out std_logic;
BUSAK_n : out std_logic;
STOP : out std_logic;
A : out std_logic_vector(15 downto 0);
DI : in std_logic_vector(7 downto 0);
DO : out std_logic_vector(7 downto 0)
@@ -133,6 +134,7 @@ begin
Write => Write,
RFSH_n => RFSH_n,
HALT_n => HALT_n,
Stop => STOP,
WAIT_n => Wait_n,
INT_n => INT_n,
NMI_n => NMI_n,