Line 8... |
Line 8... |
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
|
|
--! Use CPU Definitions package
|
--! Use CPU Definitions package
|
use work.pkgOpenCPU32.all;
|
use work.pkgOpenCPU32.all;
|
|
|
--! Adding library for File I/O (Synposys Text I/O package)
|
--! Adding library for File I/O
|
|
-- More information on this site:
|
|
-- http://eesun.free.fr/DOC/vhdlref/refguide/language_overview/test_benches/reading_and_writing_files_with_text_i_o.htm
|
use std.textio.ALL;
|
use std.textio.ALL;
|
use ieee.std_logic_textio.all;
|
use ieee.std_logic_textio.all;
|
|
|
ENTITY testOpenCpu IS
|
ENTITY testOpenCpu IS
|
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
END testOpenCpu;
|
END testOpenCpu;
|
|
|
--! @brief openCpu Testbench file
|
--! @brief openCpu Testbench file
|
--! @details This is the top-level test...
|
--! @details This is the top-level test...
|
ARCHITECTURE behavior OF testOpenCpu IS
|
ARCHITECTURE behavior OF testOpenCpu IS
|
|
|
--! Component declaration to instantiate the Multiplexer circuit
|
--! Component declaration to instantiate the Multiplexer circuit
|
COMPONENT openCpu
|
COMPONENT openCpu
|
PORT(
|
generic (n : integer := nBits - 1); --! Generic value (Used to easily change the size of the Alu on the package)
|
rst : IN std_logic;
|
Port ( rst : in STD_LOGIC; --! Reset signal
|
clk : IN std_logic;
|
clk : in STD_LOGIC; --! Clock signal
|
mem_rd : OUT std_logic;
|
mem_rd : out STD_LOGIC; --! Main memory Read enable
|
mem_rd_addr : OUT std_logic_vector(31 downto 0);
|
mem_rd_addr : out STD_LOGIC_VECTOR (n downto 0); --! Main memory Read address
|
mem_wr : OUT std_logic;
|
mem_wr : out STD_LOGIC; --! Main memory Write enable
|
mem_wr_addr : OUT std_logic_vector(31 downto 0);
|
mem_wr_addr : out STD_LOGIC_VECTOR (n downto 0); --! Main memory Write address
|
mem_data_in : IN std_logic_vector(31 downto 0);
|
mem_data_in : in STD_LOGIC_VECTOR (n downto 0); --! Data comming from main memory
|
mem_data_out : OUT std_logic_vector(31 downto 0)
|
mem_data_out : out STD_LOGIC_VECTOR (n downto 0) --! Data to main memory
|
);
|
);
|
END COMPONENT;
|
END COMPONENT;
|
|
|
|
|
--Inputs
|
--Inputs
|
signal rst : std_logic := '0';
|
signal rst : std_logic := '0'; --! Wire to connect Test signal to component
|
signal clk : std_logic := '0';
|
signal clk : std_logic := '0'; --! Wire to connect Test signal to component
|
signal mem_data_in : std_logic_vector(31 downto 0) := (others => '0');
|
signal mem_data_in : std_logic_vector(n downto 0) := (others => '0'); --! Wire to connect Test signal to component
|
|
|
--Outputs
|
--Outputs
|
signal mem_rd : std_logic;
|
signal mem_rd : std_logic; --! Wire to connect Test signal to component
|
signal mem_rd_addr : std_logic_vector(31 downto 0);
|
signal mem_rd_addr : std_logic_vector(n downto 0); --! Wire to connect Test signal to component
|
signal mem_wr : std_logic;
|
signal mem_wr : std_logic; --! Wire to connect Test signal to component
|
signal mem_wr_addr : std_logic_vector(31 downto 0);
|
signal mem_wr_addr : std_logic_vector(n downto 0); --! Wire to connect Test signal to component
|
signal mem_data_out : std_logic_vector(31 downto 0);
|
signal mem_data_out : std_logic_vector(n downto 0); --! Wire to connect Test signal to component
|
|
|
-- Clock period definitions
|
-- Clock period definitions
|
constant clk_period : time := 10 ns;
|
constant clk_period : time := 10 ns;
|
|
|
BEGIN
|
BEGIN
|