OpenCores
URL https://opencores.org/ocsvn/System09/System09/trunk

Subversion Repositories System09

[/] [System09/] [trunk/] [rtl/] [System09_Digilent_Atlys/] [system09.vhd] - Diff between revs 175 and 185

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 175 Rev 185
Line 127... Line 127...
   use unisim.vcomponents.all;
   use unisim.vcomponents.all;
 
 
entity system09 is
entity system09 is
  port(
  port(
    CLKA         : in  Std_Logic;  -- 100MHz Clock input
    CLKA         : in  Std_Logic;  -- 100MHz Clock input
    RESET_N      : in  Std_logic;  -- Master Reset input (active low)
    --SW2_N        : in  Std_logic;  -- Master Reset input (active low)
    NMI_N        : in  Std_logic;  -- Non Maskable Interrupt input (active low)
    --SW3_N        : in  Std_logic;  -- Non Maskable Interrupt input (active low)
 
 
    -- RS232 Port
    -- RS232 Port
  --RS232_CTS    : in  std_logic;       
    RS232_RXD    : in  Std_Logic;
  --RS232_RTS    : out std_logic;  
    RS232_TXD    : out Std_Logic;
    RS232_RXD    : in  Std_Logic;  -- RS-232 data in
 
    RS232_TXD    : out Std_Logic   -- RS-232 data out
    -- Status 7 segment LED
 
         sw           : in std_logic_vector(7 downto 0);
 
         btn          : in std_logic_vector(4 downto 0);
 
    S            : out std_logic_vector(7 downto 0)
 
 
 
 
-- CPU Debug Interface signals
-- CPU Debug Interface signals
--    cpu_reset_o     : out Std_Logic;
--    cpu_reset_o     : out Std_Logic;
--    cpu_clk_o       : out Std_Logic;
--    cpu_clk_o       : out Std_Logic;
--    cpu_rw_o        : out std_logic;
--    cpu_rw_o        : out std_logic;
Line 161... Line 165...
architecture rtl of system09 is
architecture rtl of system09 is
 
 
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  -- constants
  -- constants
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  constant SYS_CLK_FREQ         : natural := 100_000_000; -- FPGA System Clock (in Hz)
 
  constant CPU_CLK_FREQ         : natural := 25_000_000;  -- CPU Clock (Hz)
  constant MEM_CLK_FREQ         : natural := 100_000; -- operating frequency of Memory in KHz
 
  constant SYS_CLK_DIV          : real    := 2.0;    -- divisor for FREQ (can only be 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 8.0 or 16.0)
 
 
 
  constant SYS_CLK_FREQ         : natural := ((MEM_CLK_FREQ*2)/integer(SYS_CLK_DIV*2.0))*1000;  -- FPGA System Clock (in Hz)
 
  constant CPU_CLK_FREQ         : natural := 1; --25_000_000;  -- CPU Clock (Hz)
  constant CPU_CLK_DIV          : natural := (SYS_CLK_FREQ/CPU_CLK_FREQ);
  constant CPU_CLK_DIV          : natural := (SYS_CLK_FREQ/CPU_CLK_FREQ);
  constant BAUD_RATE            : integer := 57600;     -- Baud Rate
  constant BAUD_RATE            : integer := 57600;     -- Baud Rate
  constant ACIA_CLK_FREQ        : integer := BAUD_RATE * 16;
  constant ACIA_CLK_FREQ        : integer := BAUD_RATE * 16;
 
 
 
  constant TRESET               : natural := 300;      -- min initialization interval (us)
 
  constant RST_CYCLES           : natural := 1+(TRESET*(MEM_CLK_FREQ/1_000));  -- SDRAM power-on initialization interval
 
 
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  -- Signals
  -- Signals
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
 
  signal pbtn           : std_logic_vector(4 downto 0);
 
  signal SW3_N : std_logic;
 
  signal SW2_N : std_logic;
  -- BOOT ROM
  -- BOOT ROM
  signal rom_cs         : Std_logic;
  signal rom_cs         : Std_logic;
  signal rom_data_out   : Std_Logic_Vector(7 downto 0);
  signal rom_data_out   : Std_Logic_Vector(7 downto 0);
 
 
  -- Flex Memory & Monitor Stack
  -- Flex Memory & Monitor Stack
Line 231... Line 244...
  signal clk_i         : std_logic;     -- internal master clock signal
  signal clk_i         : std_logic;     -- internal master clock signal
 
 
  signal rs232_cts    :  Std_Logic;
  signal rs232_cts    :  Std_Logic;
  signal rs232_rts    :  Std_Logic;
  signal rs232_rts    :  Std_Logic;
 
 
 
  signal CountL        : std_logic_vector(23 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
 
    Port ( BTN_I : in  STD_LOGIC_VECTOR (4 downto 0);
 
           CLK : in  STD_LOGIC;
 
           BTN_O : out  STD_LOGIC_VECTOR (4 downto 0));
 
end component;
 
 
 
 
-----------------------------------------------------------------
-----------------------------------------------------------------
--
--
-- CPU09 CPU core
-- CPU09 CPU core
--
--
-----------------------------------------------------------------
-----------------------------------------------------------------
Line 435... Line 457...
    data_in  : in  std_logic_vector(7 downto 0);
    data_in  : in  std_logic_vector(7 downto 0);
    data_out : out std_logic_vector(7 downto 0)
    data_out : out std_logic_vector(7 downto 0)
  );
  );
end component;
end component;
 
 
----------------------------------------
 
--
--
-- Clock buffer
-- Clock buffer
--
--
----------------------------------------
 
 
 
component BUFG
component BUFG
   Port (
   Port (
     i: in std_logic;
     i: in std_logic;
     o: out std_logic
     o: out std_logic
  );
  );
end component;
end component;
 
 
begin
begin
 
 
 
 
 
 
 
 
 
 
  clk_i <= CLKA;
  clk_i <= CLKA;
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  -- Instantiation of internal components
  -- Instantiation of internal components
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
 
 
Line 733... Line 758...
  end process;
  end process;
 
 
  --
  --
  -- Interrupts and other bus control signals
  -- Interrupts and other bus control signals
  --
  --
  interrupts : process( NMI_N,
  interrupts : process( SW3_N,
                      acia_irq,
                      acia_irq,
                      trap_irq,
                      trap_irq,
                      timer_irq
                      timer_irq
                      )
                      )
  begin
  begin
    cpu_irq    <= acia_irq;
    cpu_irq    <= acia_irq;
    cpu_nmi    <= trap_irq or not( NMI_N );
    cpu_nmi    <= trap_irq or not( SW3_N );
    cpu_firq   <= timer_irq;
    cpu_firq   <= timer_irq;
    cpu_halt   <= '0';
    cpu_halt   <= '0';
    cpu_hold   <= '0'; -- pb_hold or ram_hold;
    cpu_hold   <= '0'; -- pb_hold or ram_hold;
  end process;
  end process;
 
 
  --
  --
  -- Generate CPU & Pixel Clock from Memory Clock
  -- Flash 7 segment LEDS
  --
  --
  my_prescaler : process( clk_i, clk_count )
  my_led_flasher: process( clk_i, rst_i, CountL )
  begin
  begin
    if rising_edge( clk_i ) then
    if rst_i = '1' then
      if clk_count = 0 then
         CountL <= "000000000000000000000000";
        clk_count <= CPU_CLK_DIV-1;
    elsif rising_edge(clk_i) then
      else
         CountL <= CountL + 1;
        clk_count <= clk_count - 1;
 
      end if;
 
      if clk_count = 0 then
 
         clk25 <= '0';
 
      elsif clk_count = (CPU_CLK_DIV/2) then
 
         clk25 <= '1';
 
      end if;
 
    end if;
    end if;
 
    --S(7 downto 0) <= CountL(23 downto 16);
  end process;
  end process;
 
 
  --
  --
 
  -- Generate CPU & Pixel Clock from Memory Clock
 
  --
 
--  my_prescaler : process( clk_i, clk_count )
 
--  begin
 
--    if rising_edge( clk_i ) then
 
--      if clk_count = 0 then
 
--        clk_count <= CPU_CLK_DIV-1;
 
--      else
 
--        clk_count <= clk_count - 1;
 
--      end if;
 
--      if clk_count = 0 then
 
--         clk25 <= '0';
 
--      elsif clk_count = (CPU_CLK_DIV/2) then
 
--         clk25 <= '1';
 
--      end if;
 
--    end if;
 
--  end process;
 
 
 
 
 
  my_singlestep: btn_debounce
 
    port map ( BTN_I => btn, CLK => CLKA, BTN_O => pbtn);
 
  SW2_N <= pbtn(0);
 
  SW3_N <= pbtn(1);
 
  clk25 <= pbtn(2);
 
 
 
  --
  -- Reset button and reset timer
  -- Reset button and reset timer
  --
  --
  my_switch_assignments : process( rst_i, RESET_N)
  my_switch_assignments : process( rst_i, SW2_N)
  begin
  begin
    rst_i <= RESET_N;
    rst_i <= SW2_N;
    cpu_reset <= rst_i;
    cpu_reset <= rst_i;
  end process;
  end process;
 
 
  --
  --
  -- RS232 signals:
  -- RS232 signals:
Line 786... Line 831...
    dcd_n     <= '0';
    dcd_n     <= '0';
    RS232_TXD <= txd;
    RS232_TXD <= txd;
    RS232_RTS <= rts_n;
    RS232_RTS <= rts_n;
  end process;
  end process;
 
 
 
  status_leds : process( rst_i, cpu_reset,cpu_addr, cpu_rw, sw)
 
  begin
 
    S(7) <= '0';
 
    S(6) <= cpu_rw;
 
         S(5) <= cpu_vma;
 
         S(4) <= '0';
 
    case sw is
 
         when "00000000" =>
 
           S(3 downto 0) <= cpu_addr(3 downto 0);
 
    when "00000001" =>
 
           S(3 downto 0) <= cpu_addr(7 downto 4);
 
         when "00000010" =>
 
           S(3 downto 0) <= cpu_addr(11 downto 8);
 
    when "00000011" =>
 
           S(3 downto 0) <= cpu_addr(15 downto 12);
 
    when "00000100" =>
 
           S(3 downto 0) <= cpu_data_in(3 downto 0);
 
    when "00000101" =>
 
           S(3 downto 0) <= cpu_data_in(7 downto 4);
 
    when others => S(3 downto 0) <= (others => '0');
 
         end case;
 
  end process;
 
 
--  debug_proc : process( cpu_reset, cpu_clk, cpu_rw, cpu_vma,
--  debug_proc : process( cpu_reset, cpu_clk, cpu_rw, cpu_vma,
--                      cpu_halt, cpu_hold,
--                      cpu_halt, cpu_hold,
--                      cpu_firq, cpu_irq, cpu_nmi,
--                      cpu_firq, cpu_irq, cpu_nmi,
--                      cpu_addr, cpu_data_out, cpu_data_in )
--                      cpu_addr, cpu_data_out, cpu_data_in )
--  begin
--  begin

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.