@@ -43,6 +43,32 @@ use IEEE.NUMERIC_STD.ALL;
43
43
44
44
-- Generic top-level entity for Altera DE1 board
45
45
entity bbc_micro_de1 is
46
+ generic (
47
+ -- ROM offset
48
+ -- The 4MB Flash is used in 16KB banks as a simple mechanism for
49
+ -- different machines to address different parts of the ROM, saving
50
+ -- on re-flashing each time a new machine is run on the board.
51
+ -- This generic sets the upper 8 address bits.
52
+ -- Note that the lower bits may be ignored by the implementation,
53
+ -- e.g. where ROMs are bigger than 16K or where multiple banks
54
+ -- are required. In this case it is important to ensure that the
55
+ -- ROM images are aligned correctly (such that these ignored bits are 0).
56
+ --
57
+ -- For the BBC the ROMs start in bank 8 (the first 8 banks are used by
58
+ -- the Spectrum project). The particular bank is selected by the sideways
59
+ -- ROM paging register, and bank 7 is used for the MOS. Recommended layout
60
+ -- is:
61
+ --
62
+ -- 0 Sideways
63
+ -- 1 Sideways
64
+ -- 2 Sideways - SuperMMC (DFS)
65
+ -- 3 Sideways - BASIC
66
+ -- 4 Not used
67
+ -- 5 Not used
68
+ -- 6 Not used
69
+ -- 7 MOS
70
+ ROM_OFFSET : std_logic_vector (7 downto 0 ) := "00001000"
71
+ );
46
72
port (
47
73
-- Clocks
48
74
CLOCK_24 : in std_logic_vector (1 downto 0 );
@@ -151,35 +177,6 @@ component pll32 IS
151
177
);
152
178
end component ;
153
179
154
- -- ----------------------------
155
- -- Test UART for custom ROM
156
- -- ----------------------------
157
-
158
- component simple_uart is
159
- generic (
160
- f_clock : natural := 32000000 ;
161
- baud_rate : natural := 19200
162
- );
163
- port (
164
- CLOCK : in std_logic ;
165
- nRESET : in std_logic ;
166
-
167
- ENABLE : in std_logic ;
168
- -- Read not write
169
- R_nW : in std_logic ;
170
- -- Data not status (address)
171
- S_nD : in std_logic ;
172
- -- Data bus in
173
- DI : in std_logic_vector (7 downto 0 );
174
- -- Data bus out
175
- DO : out std_logic_vector (7 downto 0 );
176
-
177
- -- Port pins
178
- RXD : in std_logic ;
179
- TXD : out std_logic
180
- );
181
- end component ;
182
-
183
180
-- -------
184
181
-- CPU
185
182
-- -------
@@ -561,9 +558,6 @@ signal mhz1_clken : std_logic; -- 1 MHz bus and associated peripherals, 6522 ph
561
558
signal ttxt_clken_counter : unsigned (1 downto 0 );
562
559
signal ttxt_clken : std_logic ;
563
560
564
- -- Testing
565
- signal test_uart_do : std_logic_vector (7 downto 0 );
566
-
567
561
-- Debugger connections
568
562
signal debug_irq_in_n : std_logic ;
569
563
signal debug_aux : std_logic_vector (15 downto 0 );
@@ -746,19 +740,6 @@ begin
746
740
LEDR(3 ), -- BREAKPOINT
747
741
LEDR(2 ) -- WATCHPOINT
748
742
);
749
-
750
- -- Test UART
751
- test_uart : simple_uart port map (
752
- clock,
753
- reset_n,
754
- io_fred,
755
- cpu_r_nw,
756
- cpu_a(0 ),
757
- cpu_do,
758
- test_uart_do,
759
- UART_RXD,
760
- UART_TXD
761
- );
762
743
763
744
-- 6502 CPU
764
745
cpu : T65 port map (
@@ -1094,23 +1075,23 @@ begin
1094
1075
"00000010" when acia_enable = '1' else
1095
1076
sys_via_do when sys_via_enable = '1' else
1096
1077
user_via_do when user_via_enable = '1' else
1097
- test_uart_do when io_fred = '1' else
1098
1078
(others => '0' ); -- un-decoded locations are pulled down by RP1
1099
1079
debug_irq_in_n <= sys_via_irq_n and user_via_irq_n; -- route IRQ through debugger
1100
1080
-- cpu_irq_n <= sys_via_irq_n and user_via_irq_n;
1101
1081
1102
- -- ROMs are in external flash
1082
+ -- ROMs are in external flash and split into 16K slots (since this also suits other
1083
+ -- computers that might be run on the same board).
1084
+ -- The first 8 slots are allocated for use here, and the first 4 are decoded as
1085
+ -- the sideways ROMs. Slot 7 is used for the MOS.
1103
1086
FL_RST_N <= reset_n;
1104
1087
FL_CE_N <= '0' ;
1105
1088
FL_OE_N <= '0' ;
1106
1089
FL_WE_N <= '1' ;
1107
- FL_ADDR(13 downto 0 ) <= cpu_a(13 downto 0 );
1108
- FL_ADDR(21 downto 16 ) <= (others => '0' );
1109
- FL_ADDR(15 downto 14 ) <=
1110
- "00" when mos_enable = '1' else
1111
- "01" when rom_enable = '1' and romsel(1 downto 0 ) = "11" else -- BASIC
1112
- "10" when rom_enable = '1' and romsel(1 downto 0 ) = "00" else -- DFS/MMC
1113
- "11" ; -- Spare
1090
+ FL_ADDR(21 downto 17 ) <= ROM_OFFSET(7 downto 3 );
1091
+ FL_ADDR(16 downto 14 ) <=
1092
+ "111" when mos_enable = '1' else
1093
+ "0" & romsel(1 downto 0 );
1094
+ FL_ADDR(13 downto 0 ) <= cpu_a(13 downto 0 );
1114
1095
1115
1096
-- SRAM bus
1116
1097
SRAM_UB_N <= '1' ;
0 commit comments