From b739fae4ecd00c3e1753b2c68dbfef2a46c659a8 Mon Sep 17 00:00:00 2001 From: Till Harbaum Date: Fri, 9 Oct 2015 09:53:27 +0200 Subject: [PATCH] [BBC] Autoboot option --- cores/bbc/fpga/mist/bbc_mist_top.v | 22 ++++++++++++++++++---- cores/bbc/rtl/bbc.v | 4 ++++ cores/bbc/rtl/keyboard.v | 8 ++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cores/bbc/fpga/mist/bbc_mist_top.v b/cores/bbc/fpga/mist/bbc_mist_top.v index 6b9f744..a3fd38a 100644 --- a/cores/bbc/fpga/mist/bbc_mist_top.v +++ b/cores/bbc/fpga/mist/bbc_mist_top.v @@ -50,10 +50,11 @@ parameter CONF_STR = { "BBC;ROM;", "O1,Scanlines,Off,On;", "O2,ROM mapping,High,Low;", - "T3,Reset;" + "O3,Auto boot,Off,On;", + "T4,Reset;" }; -parameter CONF_STR_LEN = 8+20+24+9; +parameter CONF_STR_LEN = 8+20+24+20+9; // generated clocks wire clk_32m /* synthesis keep */ ; @@ -270,14 +271,25 @@ wire rom_remap_reset = (rom_map_counter != 0); // the bbc is being reset of the pll isn't stable, if the ram isn't ready, // of the arm boots or if the user selects reset from the osd or of the user // presses the "core" button or the io controller uploads a rom -wire reset_in = ~pll_ready || ~sdram_ready || status[0] || status[3] || +wire reset_in = ~pll_ready || ~sdram_ready || status[0] || status[4] || buttons[1] || loader_active || rom_remap_reset; // synchronize reset with memory state machine reg reset; always @(posedge mem_sync) reset <= reset_in; - + +// the autoboot feature simply works by pressing shift for 2 seconds after +// the bbc has been reset +wire autoboot_shift = status[3] && (autoboot_counter != 0 ); +reg [24:0] autoboot_counter; +always @(posedge clk_32m) begin + if(reset) + autoboot_counter <= 25'd32000000; + else if(autoboot_counter != 0) + autoboot_counter <= autoboot_counter - 25'd1; +end + bbc BBC( .CLK32M_I ( clk_32m ), @@ -303,6 +315,8 @@ bbc BBC( .VID_ADR ( vid_adr ), .VID_DI ( vid_data ), + .SHIFT ( autoboot_shift ), + .user_via_pb_out ( user_via_pb_out ), .user_via_cb1_in ( user_via_cb1_in ), .user_via_cb2_in ( user_via_cb2_in ), diff --git a/cores/bbc/rtl/bbc.v b/cores/bbc/rtl/bbc.v index 64da6c3..1e3ca25 100644 --- a/cores/bbc/rtl/bbc.v +++ b/cores/bbc/rtl/bbc.v @@ -36,6 +36,9 @@ module bbc( output [15:0] AUDIO_L, output [15:0] AUDIO_R, + // externally pressed "shift" key for autoboot + input SHIFT, + // expose pins required for mmc output [7:0] user_via_pb_out, input user_via_cb1_in, @@ -372,6 +375,7 @@ keyboard KEYB ( .ROW ( keyb_row ), .KEYPRESS ( keyb_out ), .INT ( keyb_int ), + .SHIFT ( SHIFT ), .BREAK_OUT ( keyb_break ), .DIP_SWITCH ( DIP_SWITCH ) ); diff --git a/cores/bbc/rtl/keyboard.v b/cores/bbc/rtl/keyboard.v index cce8fcc..b36c0a3 100644 --- a/cores/bbc/rtl/keyboard.v +++ b/cores/bbc/rtl/keyboard.v @@ -50,6 +50,8 @@ module keyboard ( input [2:0] ROW, output KEYPRESS, output INT, + // external SHIFT key + input SHIFT, // BREAK key output - 1 when pressed output reg BREAK_OUT, // DIP switch inputs @@ -67,6 +69,7 @@ reg [7:0] keys [0:15]; reg [3:0] col; reg _release_; reg extended; +reg ext_shift; // Shortcut to current key column @@ -144,6 +147,11 @@ always @(posedge CLOCK) begin end else begin + // map external shift key onto left shift + ext_shift <= SHIFT; + if(SHIFT || ext_shift) + keys[0][0] <= SHIFT; + // Copy DIP switches through to row 0 keys[2][0] <= DIP_SWITCH[7]; keys[3][0] <= DIP_SWITCH[6];