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

Subversion Repositories System09

[/] [System09/] [rev_86/] [rtl/] [Testbench/] [testbench4.vhd] - Diff between revs 66 and 112

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 66 Rev 112
--===========================================================================--
--===========================================================================--
--
--
-- MC6809 Microprocessor Test Bench 4
-- MC6809 Microprocessor Test Bench 4
-- Test Software - SBUG ROM
-- Test Software - SBUG ROM
--
--
--
--
-- John Kent 12st April 2003
-- John Kent 12st April 2003
--
--
-- Version 1.1 - 25th Jan 2004 - John Kent
-- Version 1.1 - 25th Jan 2004 - John Kent
-- removed "test_alu" and "test_cc"
-- removed "test_alu" and "test_cc"
--
--
--
--
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
library ieee;
library ieee;
   use ieee.std_logic_1164.all;
   use ieee.std_logic_1164.all;
   use IEEE.STD_LOGIC_ARITH.ALL;
   use IEEE.STD_LOGIC_ARITH.ALL;
   use ieee.numeric_std.all;
   use ieee.numeric_std.all;
 
 
entity my_testbench is
entity my_testbench is
end my_testbench;
end my_testbench;
 
 
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Architecture for memio Controller Unit
-- Architecture for memio Controller Unit
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
architecture behavior of my_testbench is
architecture behavior of my_testbench is
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  -- Signals
  -- Signals
  -----------------------------------------------------------------------------
  -----------------------------------------------------------------------------
  signal cpu_irq    : std_Logic;
  signal cpu_irq    : std_Logic;
  signal cpu_firq   : std_logic;
  signal cpu_firq   : std_logic;
  signal cpu_nmi    : std_logic;
  signal cpu_nmi    : std_logic;
 
 
  -- CPU Interface signals
  -- CPU Interface signals
  signal SysClk      : Std_Logic;
  signal SysClk      : Std_Logic;
  signal cpu_reset   : Std_Logic;
  signal cpu_reset   : Std_Logic;
  signal cpu_rw      : Std_Logic;
  signal cpu_rw      : Std_Logic;
  signal cpu_vma     : Std_Logic;
  signal cpu_vma     : Std_Logic;
  signal cpu_addr    : Std_Logic_Vector(15 downto 0);
  signal cpu_addr    : Std_Logic_Vector(15 downto 0);
  signal cpu_data_in : Std_Logic_Vector(7 downto 0);
  signal cpu_data_in : Std_Logic_Vector(7 downto 0);
  signal cpu_data_out: Std_Logic_Vector(7 downto 0);
  signal cpu_data_out: Std_Logic_Vector(7 downto 0);
  signal cpu_halt    : Std_logic;
  signal cpu_halt    : Std_logic;
  signal cpu_hold    : Std_logic;
  signal cpu_hold    : Std_logic;
  signal rom_data_out: Std_Logic_Vector(7 downto 0);
  signal rom_data_out: Std_Logic_Vector(7 downto 0);
  signal ram_data_out: Std_Logic_Vector(7 downto 0);
  signal ram_data_out: Std_Logic_Vector(7 downto 0);
  signal ram_cs      : Std_Logic;
  signal ram_cs      : Std_Logic;
 
 
component cpu09
component cpu09
  port (
  port (
         clk:        in std_logic;
         clk:        in std_logic;
    rst:             in std_logic;
    rst:             in std_logic;
    rw:      out        std_logic;              -- Asynchronous memory interface
    rw:      out        std_logic;              -- Asynchronous memory interface
    vma:             out        std_logic;
    vma:             out        std_logic;
    address:  out       std_logic_vector(15 downto 0);
    address:  out       std_logic_vector(15 downto 0);
    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);
         halt:     in  std_logic;
         halt:     in  std_logic;
         hold:     in  std_logic;
         hold:     in  std_logic;
         irq:      in  std_logic;
         irq:      in  std_logic;
         nmi:      in  std_logic;
         nmi:      in  std_logic;
         firq:     in  std_logic
         firq:     in  std_logic
  );
  );
end component;
end component;
 
 
 
 
component sbug_rom
component sbug_rom
    Port (
    Port (
       MEMclk   : in  std_logic;
       MEMclk   : in  std_logic;
       MEMaddr  : in  std_logic_vector (10 downto 0);
       MEMaddr  : in  std_logic_vector (10 downto 0);
       MEMrdata : out std_logic_vector (7 downto 0)
       MEMrdata : out std_logic_vector (7 downto 0)
    );
    );
end component;
end component;
 
 
component block_ram
component block_ram
    Port (
    Port (
       MEMclk   : in  std_logic;
       MEMclk   : in  std_logic;
       MEMcs    : in  std_logic;
       MEMcs    : in  std_logic;
                 MEMrw    : in  std_logic;
                 MEMrw    : in  std_logic;
       MEMaddr  : in  std_logic_vector (10 downto 0);
       MEMaddr  : in  std_logic_vector (10 downto 0);
       MEMrdata : out std_logic_vector (7 downto 0);
       MEMrdata : out std_logic_vector (7 downto 0);
       MEMwdata : in  std_logic_vector (7 downto 0)
       MEMwdata : in  std_logic_vector (7 downto 0)
    );
    );
end component;
end component;
 
 
begin
begin
my_cpu : cpu09  port map (
my_cpu : cpu09  port map (
         clk         => SysClk,
         clk         => SysClk,
    rst      => cpu_reset,
    rst      => cpu_reset,
    rw       => cpu_rw,
    rw       => cpu_rw,
    vma       => cpu_vma,
    vma       => cpu_vma,
    address   => cpu_addr(15 downto 0),
    address   => cpu_addr(15 downto 0),
    data_in   => cpu_data_in,
    data_in   => cpu_data_in,
         data_out  => cpu_data_out,
         data_out  => cpu_data_out,
         halt      => cpu_halt,
         halt      => cpu_halt,
         hold      => cpu_hold,
         hold      => cpu_hold,
         irq       => cpu_irq,
         irq       => cpu_irq,
         nmi       => cpu_nmi,
         nmi       => cpu_nmi,
         firq      => cpu_firq
         firq      => cpu_firq
  );
  );
 
 
 
 
my_ram : block_ram port map (
my_ram : block_ram port map (
       MEMclk   => SysClk,
       MEMclk   => SysClk,
                 MEMcs    => ram_cs,
                 MEMcs    => ram_cs,
                 MEMrw    => cpu_rw,
                 MEMrw    => cpu_rw,
       MEMaddr  => cpu_addr(10 downto 0),
       MEMaddr  => cpu_addr(10 downto 0),
       MEMrdata => ram_data_out,
       MEMrdata => ram_data_out,
       MEMwdata => cpu_data_out
       MEMwdata => cpu_data_out
    );
    );
 
 
my_rom : sbug_rom port map (
my_rom : sbug_rom port map (
       MEMclk   => SysClk,
       MEMclk   => SysClk,
       MEMaddr  => cpu_addr(10 downto 0),
       MEMaddr  => cpu_addr(10 downto 0),
       MEMrdata => rom_data_out
       MEMrdata => rom_data_out
    );
    );
 
 
  -- *** Test Bench - User Defined Section ***
  -- *** Test Bench - User Defined Section ***
   tb : PROCESS
   tb : PROCESS
        variable count : integer;
        variable count : integer;
   BEGIN
   BEGIN
 
 
        cpu_reset <= '0';
        cpu_reset <= '0';
        SysClk <= '0';
        SysClk <= '0';
   cpu_irq <= '0';
   cpu_irq <= '0';
   cpu_nmi <= '0';
   cpu_nmi <= '0';
        cpu_firq <= '0';
        cpu_firq <= '0';
   cpu_halt <= '0';
   cpu_halt <= '0';
        cpu_hold <= '0';
        cpu_hold <= '0';
 
 
                for count in 0 to 512 loop
                for count in 0 to 512 loop
                        SysClk <= '0';
                        SysClk <= '0';
                        if count = 0 then
                        if count = 0 then
                                cpu_reset <= '1';
                                cpu_reset <= '1';
                        elsif count = 1 then
                        elsif count = 1 then
                                cpu_reset <= '0';
                                cpu_reset <= '0';
                        end if;
                        end if;
                        wait for 100 ns;
                        wait for 100 ns;
                        SysClk <= '1';
                        SysClk <= '1';
                        wait for 100 ns;
                        wait for 100 ns;
                end loop;
                end loop;
 
 
      wait; -- will wait forever
      wait; -- will wait forever
   END PROCESS;
   END PROCESS;
-- *** End Test Bench - User Defined Section ***
-- *** End Test Bench - User Defined Section ***
 
 
 
 
  rom : PROCESS( cpu_addr, rom_data_out, ram_data_out )
  rom : PROCESS( cpu_addr, rom_data_out, ram_data_out )
  begin
  begin
    if( cpu_addr(15 downto 11) = "11111" ) then
    if( cpu_addr(15 downto 11) = "11111" ) then
      cpu_data_in <= rom_data_out;
      cpu_data_in <= rom_data_out;
                ram_cs <= '0';
                ram_cs <= '0';
         else
         else
      cpu_data_in <= ram_data_out;
      cpu_data_in <= ram_data_out;
                ram_cs <= '1';
                ram_cs <= '1';
         end if;
         end if;
  end process;
  end process;
 
 
end behavior; --===================== End of architecture =======================--
end behavior; --===================== End of architecture =======================--
 
 
 
 

powered by: WebSVN 2.1.0

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