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

Subversion Repositories opencpu32

[/] [opencpu32/] [trunk/] [hdl/] [opencpu32/] [testOpenCpu.vhd] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 leonardoar
--! @file
2
--! @brief Testbench for OpenCpu top design
3
 
4
--! Use standard library and import the packages (std_logic_1164,std_logic_unsigned,std_logic_arith)
5
LIBRARY ieee;
6
use ieee.std_logic_1164.all;
7
use ieee.std_logic_unsigned.all;
8
use ieee.std_logic_arith.all;
9
 
10
--! Use CPU Definitions package
11
use work.pkgOpenCPU32.all;
12
 
13
--! Adding library for File I/O (Synposys Text I/O package)
14
use std.textio.ALL;
15
use ieee.std_logic_textio.all;
16
 
17
ENTITY testOpenCpu IS
18
END testOpenCpu;
19
 
20
--! @brief openCpu Testbench file
21
--! @details This is the top-level test...
22
ARCHITECTURE behavior OF testOpenCpu IS
23
 
24
    --! Component declaration to instantiate the Multiplexer circuit                    
25
    COMPONENT openCpu
26
    PORT(
27
         rst : IN  std_logic;
28
         clk : IN  std_logic;
29
         mem_rd : OUT  std_logic;
30
         mem_rd_addr : OUT  std_logic_vector(31 downto 0);
31
         mem_wr : OUT  std_logic;
32
         mem_wr_addr : OUT  std_logic_vector(31 downto 0);
33
         mem_data_in : IN  std_logic_vector(31 downto 0);
34
         mem_data_out : OUT  std_logic_vector(31 downto 0)
35
        );
36
    END COMPONENT;
37
 
38
 
39
   --Inputs
40
   signal rst : std_logic := '0';
41
   signal clk : std_logic := '0';
42
   signal mem_data_in : std_logic_vector(31 downto 0) := (others => '0');
43
 
44
        --Outputs
45
   signal mem_rd : std_logic;
46
   signal mem_rd_addr : std_logic_vector(31 downto 0);
47
   signal mem_wr : std_logic;
48
   signal mem_wr_addr : std_logic_vector(31 downto 0);
49
   signal mem_data_out : std_logic_vector(31 downto 0);
50
 
51
   -- Clock period definitions
52
   constant clk_period : time := 10 ns;
53
 
54
BEGIN
55
 
56
        --!Instantiate the Unit Under Test (openCpu) (Doxygen bug if it's not commented!)
57
   uut: openCpu PORT MAP (
58
          rst => rst,
59
          clk => clk,
60
          mem_rd => mem_rd,
61
          mem_rd_addr => mem_rd_addr,
62
          mem_wr => mem_wr,
63
          mem_wr_addr => mem_wr_addr,
64
          mem_data_in => mem_data_in,
65
          mem_data_out => mem_data_out
66
        );
67
 
68
   -- Clock process definitions
69
   clk_process :process
70
   begin
71
                clk <= '0';
72
                wait for clk_period/2;
73
                clk <= '1';
74
                wait for clk_period/2;
75
   end process;
76
 
77
 
78
   -- Stimulus process
79
   stim_proc: process
80
   begin
81
      -- Reset operation
82
                REPORT "RESET" SEVERITY NOTE;
83
                rst <= '1';
84
      wait for 2 ns;
85
                rst <= '0';
86
                wait for 2 ns;
87
 
88
      wait for clk_period*10;
89
 
90
      -- insert stimulus here 
91
 
92
      -- Finish simulation
93
                assert false report "NONE. End of simulation." severity failure;
94
                wait;
95
   end process;
96
 
97
END;

powered by: WebSVN 2.1.0

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