Skip to content

Commit 3eb0950

Browse files
author
Mike Stirling
committed
...and the rest of the previous commit
1 parent 2527a40 commit 3eb0950

File tree

2 files changed

+37
-59
lines changed

2 files changed

+37
-59
lines changed

bbc_micro_de1.qsf

+2-5
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,9 @@ set_global_assignment -name LL_MEMBER_STATE LOCKED -section_id "Root Region"
501501
set_global_assignment -name MISC_FILE "U:/git_repos/fpga/bbc/bbc_micro_de1.dpf"
502502
set_location_assignment PIN_AB15 -to FL_CE_N
503503
set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"
504-
set_global_assignment -name USE_CONFIGURATION_DEVICE ON
505504
set_global_assignment -name STRATIX_CONFIGURATION_DEVICE EPCS4
506505
set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "AS INPUT TRI-STATED"
507-
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS PROGRAMMING PIN"
506+
set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
508507
set_location_assignment PIN_U20 -to SD_nCS
509508
set_location_assignment PIN_V20 -to SD_SCLK
510509
set_location_assignment PIN_Y20 -to SD_MOSI
@@ -520,7 +519,6 @@ set_global_assignment -name VHDL_FILE "sn76489-1.0/sn76489_attenuator.vhd"
520519
set_global_assignment -name VHDL_FILE "sn76489-1.0/sn76489_clock_div.vhd"
521520
set_global_assignment -name VHDL_FILE "sn76489-1.0/sn76489_latch_ctrl.vhd"
522521
set_global_assignment -name VHDL_FILE ps2_intf.vhd
523-
set_global_assignment -name VHDL_FILE simple_uart.vhd
524522
set_global_assignment -name VHDL_FILE m6522.vhd
525523
set_global_assignment -name VHDL_FILE seg7.vhd
526524
set_global_assignment -name VHDL_FILE vidproc.vhd
@@ -536,5 +534,4 @@ set_global_assignment -name VHDL_FILE m6522_tb.vhd
536534
set_global_assignment -name VHDL_FILE keyboard.vhd
537535
set_global_assignment -name VHDL_FILE debugger.vhd
538536
set_global_assignment -name QIP_FILE saa5050_rom.qip
539-
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
540-
set_global_assignment -name VHDL_FILE mos6522.vhd
537+
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

bbc_micro_de1.vhd

+35-54
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,32 @@ use IEEE.NUMERIC_STD.ALL;
4343

4444
-- Generic top-level entity for Altera DE1 board
4545
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+
);
4672
port (
4773
-- Clocks
4874
CLOCK_24 : in std_logic_vector(1 downto 0);
@@ -151,35 +177,6 @@ component pll32 IS
151177
);
152178
end component;
153179

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-
183180
---------
184181
-- CPU
185182
---------
@@ -561,9 +558,6 @@ signal mhz1_clken : std_logic; -- 1 MHz bus and associated peripherals, 6522 ph
561558
signal ttxt_clken_counter : unsigned(1 downto 0);
562559
signal ttxt_clken : std_logic;
563560

564-
-- Testing
565-
signal test_uart_do : std_logic_vector(7 downto 0);
566-
567561
-- Debugger connections
568562
signal debug_irq_in_n : std_logic;
569563
signal debug_aux : std_logic_vector(15 downto 0);
@@ -746,19 +740,6 @@ begin
746740
LEDR(3), -- BREAKPOINT
747741
LEDR(2) -- WATCHPOINT
748742
);
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-
);
762743

763744
-- 6502 CPU
764745
cpu : T65 port map (
@@ -1094,23 +1075,23 @@ begin
10941075
"00000010" when acia_enable = '1' else
10951076
sys_via_do when sys_via_enable = '1' else
10961077
user_via_do when user_via_enable = '1' else
1097-
test_uart_do when io_fred = '1' else
10981078
(others => '0'); -- un-decoded locations are pulled down by RP1
10991079
debug_irq_in_n <= sys_via_irq_n and user_via_irq_n; -- route IRQ through debugger
11001080
--cpu_irq_n <= sys_via_irq_n and user_via_irq_n;
11011081

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.
11031086
FL_RST_N <= reset_n;
11041087
FL_CE_N <= '0';
11051088
FL_OE_N <= '0';
11061089
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);
11141095

11151096
-- SRAM bus
11161097
SRAM_UB_N <= '1';

0 commit comments

Comments
 (0)