Line 76... |
Line 76... |
entity system09 is
|
entity system09 is
|
port(
|
port(
|
CLKA : in Std_Logic; -- 125 MHz Clock input
|
CLKA : in Std_Logic; -- 125 MHz Clock input
|
|
|
-- RS232 Port - via Pmod RS232
|
-- RS232 Port - via Pmod RS232
|
RS232_CTS : in Std_Logic;
|
-- RS232_CTS : in Std_Logic;
|
RS232_RTS : out Std_Logic;
|
-- RS232_RTS : out Std_Logic;
|
RS232_RXD : in Std_Logic;
|
RS232_RXD : in Std_Logic;
|
RS232_TXD : out Std_Logic;
|
RS232_TXD : out Std_Logic;
|
|
|
-- slide switches
|
-- slide switches
|
sw : in std_logic_vector(3 downto 0);
|
sw : in std_logic_vector(3 downto 0);
|
Line 171... |
Line 171... |
signal trap_irq : std_logic;
|
signal trap_irq : std_logic;
|
|
|
signal rst_i : std_logic; -- internal reset signal
|
signal rst_i : std_logic; -- internal reset signal
|
signal clk_i : std_logic; -- internal master clock signal
|
signal clk_i : std_logic; -- internal master clock signal
|
|
|
signal CountL : std_logic_vector(23 downto 0);
|
signal CountL : std_logic_vector(25 downto 0);
|
signal clk_count : natural range 0 to CPU_CLK_DIV;
|
signal clk_count : natural range 0 to CPU_CLK_DIV;
|
signal Clk25 : std_logic;
|
signal Clk25 : std_logic;
|
|
|
|
|
component btn_debounce
|
component btn_debounce
|
Line 405... |
Line 405... |
my_singlestep: btn_debounce
|
my_singlestep: btn_debounce
|
port map ( BTN_I => btn, CLK => CLKA, BTN_O => pbtn);
|
port map ( BTN_I => btn, CLK => CLKA, BTN_O => pbtn);
|
|
|
RESET <= pbtn(0); -- Right PB
|
RESET <= pbtn(0); -- Right PB
|
NMI <= pbtn(1); -- Center PB
|
NMI <= pbtn(1); -- Center PB
|
SINGLE_STEP <= pbtn(2); -- Left PB
|
|
|
|
--
|
--
|
-- Generate CPU & Pixel Clock from Memory Clock
|
-- Generate CPU & Pixel Clock from Memory Clock
|
--
|
--
|
NORMAL: if CLOCK_MODE = 0 generate
|
|
my_prescaler : process( clk_i, clk_count )
|
my_prescaler : process( clk_i, clk_count )
|
begin
|
begin
|
if rising_edge( clk_i ) then
|
if rising_edge( clk_i ) then
|
if clk_count = 0 then
|
if clk_count = 0 then
|
clk_count <= CPU_CLK_DIV-1;
|
clk_count <= CPU_CLK_DIV-1;
|
Line 426... |
Line 425... |
elsif clk_count = (CPU_CLK_DIV/2) then
|
elsif clk_count = (CPU_CLK_DIV/2) then
|
clk25 <= '1';
|
clk25 <= '1';
|
end if;
|
end if;
|
end if;
|
end if;
|
end process;
|
end process;
|
end generate;
|
|
SS: if CLOCK_MODE = 1 generate
|
|
clk25 <= SINGLE_STEP;
|
|
end generate;
|
|
|
|
--
|
--
|
-- Reset button and reset timer
|
-- Reset button and reset timer
|
--
|
--
|
my_switch_assignments : process( rst_i, RESET)
|
my_switch_assignments : process( rst_i, RESET)
|
Line 528... |
Line 523... |
);
|
);
|
|
|
--
|
--
|
-- RS232 signals:
|
-- RS232 signals:
|
--
|
--
|
my_acia_assignments : process( RS232_RXD, RS232_CTS, TXD, RTS_n )
|
my_acia_assignments : process( RS232_RXD, --RS232_CTS,
|
|
TXD, RTS_n )
|
begin
|
begin
|
RXD <= RS232_RXD;
|
RXD <= RS232_RXD;
|
CTS_n <= RS232_CTS;
|
CTS_n <= '0'; -- not RS232_CTS;
|
DCD_n <= '0';
|
DCD_n <= '0';
|
RS232_TXD <= TXD;
|
RS232_TXD <= TXD;
|
RS232_RTS <= RTS_n;
|
-- RS232_RTS <= not RTS_n;
|
end process;
|
end process;
|
|
|
my_ACIA_Clock : ACIA_Clock
|
my_ACIA_Clock : ACIA_Clock
|
generic map(
|
generic map(
|
SYS_CLK_FREQ => SYS_CLK_FREQ,
|
SYS_CLK_FREQ => SYS_CLK_FREQ,
|
Line 755... |
Line 751... |
-- Flash 7 segment LEDS
|
-- Flash 7 segment LEDS
|
--
|
--
|
my_led_flasher: process( clk_i, rst_i, CountL )
|
my_led_flasher: process( clk_i, rst_i, CountL )
|
begin
|
begin
|
if rst_i = '1' then
|
if rst_i = '1' then
|
CountL <= "000000000000000000000000";
|
CountL <= "00000000000000000000000000";
|
elsif rising_edge(clk_i) then
|
elsif rising_edge(clk_i) then
|
CountL <= CountL + 1;
|
CountL <= CountL + 1;
|
end if;
|
end if;
|
--S(7 downto 0) <= CountL(23 downto 16);
|
--S(7 downto 0) <= CountL(23 downto 16);
|
end process;
|
end process;
|
|
|
status_leds : process( rst_i, cpu_reset, cpu_addr, cpu_data_in, sw)
|
status_leds : process( rst_i, cpu_reset, cpu_addr, cpu_data_in, sw)
|
begin
|
begin
|
case sw is
|
case sw is
|
when "0000" =>
|
when "1000" =>
|
led(3 downto 0) <= cpu_addr(3 downto 0);
|
led(3 downto 0) <= cpu_addr(3 downto 0);
|
when "0001" =>
|
when "1001" =>
|
led(3 downto 0) <= cpu_addr(7 downto 4);
|
led(3 downto 0) <= cpu_addr(7 downto 4);
|
when "0010" =>
|
when "1010" =>
|
led(3 downto 0) <= cpu_addr(11 downto 8);
|
led(3 downto 0) <= cpu_addr(11 downto 8);
|
when "0011" =>
|
when "1011" =>
|
led(3 downto 0) <= cpu_addr(15 downto 12);
|
led(3 downto 0) <= cpu_addr(15 downto 12);
|
when "0100" =>
|
when "1100" =>
|
led(3 downto 0) <= cpu_data_in(3 downto 0);
|
led(3 downto 0) <= cpu_data_in(3 downto 0);
|
when "0101" =>
|
when "1101" =>
|
led(3 downto 0) <= cpu_data_in(7 downto 4);
|
led(3 downto 0) <= cpu_data_in(7 downto 4);
|
|
when "0000" =>
|
|
led(3) <= '0';
|
|
led(2) <= CountL(24);
|
|
led(1) <= cpu_reset;
|
|
led(0) <= NMI;
|
when others => led(3 downto 0) <= (others => '0');
|
when others => led(3 downto 0) <= (others => '0');
|
end case;
|
end case;
|
end process;
|
end process;
|
|
|
-- debug_proc : process( cpu_reset, cpu_clk, cpu_rw, cpu_vma,
|
-- debug_proc : process( cpu_reset, cpu_clk, cpu_rw, cpu_vma,
|