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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [VHDL/] [datapath/] [tb_1.vhdl] - Blame information for rev 22

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

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
--------------------------------------------------------------------------------
21
-- Company: 
22
-- Engineer:
23
--
24
-- Create Date:   17:52:44 08/10/2013
25
-- Design Name:   
26
-- Module Name:   /home/jurgen/Projects/lisp/projects/datapath/tb_1.vhdl
27
-- Project Name:  datapath
28
-- Target Device:  
29
-- Tool versions:  
30
-- Description:   
31
-- 
32
-- VHDL Test Bench Created by ISE for module: dp
33
-- 
34
-- Dependencies:
35
-- 
36
-- Revision:
37
-- Revision 0.01 - File Created
38
-- Additional Comments:
39
--
40
-- Notes: 
41
-- This testbench has been automatically generated using types std_logic and
42
-- std_logic_vector for the ports of the unit under test.  Xilinx recommends
43
-- that these types always be used for the top-level I/O of a design in order
44
-- to guarantee that the testbench will bind correctly to the post-implementation 
45
-- simulation model.
46
--------------------------------------------------------------------------------
47
LIBRARY ieee;
48
USE ieee.std_logic_1164.ALL;
49
 
50
-- Uncomment the following library declaration if using
51
-- arithmetic functions with Signed or Unsigned values
52
--USE ieee.numeric_std.ALL;
53
 
54
ENTITY tb_1 IS
55
END tb_1;
56
 
57
ARCHITECTURE behavior OF tb_1 IS
58
 
59
  -- Component Declaration for the Unit Under Test (UUT)
60
 
61
  COMPONENT dp
62
    PORT(
63
      reset     : IN  STD_LOGIC;
64
      clock     : IN  STD_LOGIC;
65
      reg_a     : IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
66
      reg_b     : IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
67
      reg_c     : IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
68
      data_in   : IN  STD_LOGIC_VECTOR(15 DOWNTO 0);
69
      reg_input : IN  STD_LOGIC_VECTOR(1 DOWNTO 0);
70
      op_sel    : IN  STD_LOGIC_VECTOR(3 DOWNTO 0);
71
      we        : IN  STD_LOGIC;
72
      pc_input  : IN  STD_LOGIC_VECTOR(1 DOWNTO 0);
73
      addr_sel  : IN  STD_LOGIC;
74
      data_out  : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
75
      addr_out  : OUT STD_LOGIC_VECTOR(14 DOWNTO 0);
76
      zero      : OUT STD_LOGIC;
77
      n_zero    : OUT STD_LOGIC
78
      );
79
  END COMPONENT;
80
 
81
 
82
  --Inputs
83
  SIGNAL reset     : STD_LOGIC                     := '0';
84
  SIGNAL clock     : STD_LOGIC                     := '0';
85
  SIGNAL reg_a     : STD_LOGIC_VECTOR(3 DOWNTO 0)  := (OTHERS => '0');
86
  SIGNAL reg_b     : STD_LOGIC_VECTOR(3 DOWNTO 0)  := (OTHERS => '0');
87
  SIGNAL reg_c     : STD_LOGIC_VECTOR(3 DOWNTO 0)  := (OTHERS => '0');
88
  SIGNAL data_in   : STD_LOGIC_VECTOR(15 DOWNTO 0) := (OTHERS => '0');
89
  SIGNAL reg_input : STD_LOGIC_VECTOR(1 DOWNTO 0)  := (OTHERS => '0');
90
  SIGNAL op_sel    : STD_LOGIC_VECTOR(3 DOWNTO 0)  := (OTHERS => '0');
91
  SIGNAL we        : STD_LOGIC                     := '0';
92
  SIGNAL pc_input  : STD_LOGIC_VECTOR(1 DOWNTO 0)  := (OTHERS => '0');
93
  SIGNAL addr_sel  : STD_LOGIC                     := '0';
94
 
95
  --Outputs
96
  SIGNAL data_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
97
  SIGNAL addr_out : STD_LOGIC_VECTOR(14 DOWNTO 0);
98
  SIGNAL zero     : STD_LOGIC;
99
  SIGNAL n_zero   : STD_LOGIC;
100
 
101
  -- Clock period definitions
102
  CONSTANT clock_period : TIME := 10 ns;
103
 
104
BEGIN
105
 
106
  -- Instantiate the Unit Under Test (UUT)
107
  uut : dp PORT MAP (
108
    reset     => reset,
109
    clock     => clock,
110
    reg_a     => reg_a,
111
    reg_b     => reg_b,
112
    reg_c     => reg_c,
113
    data_in   => data_in,
114
    reg_input => reg_input,
115
    op_sel    => op_sel,
116
    we        => we,
117
    pc_input  => pc_input,
118
    addr_sel  => addr_sel,
119
    data_out  => data_out,
120
    addr_out  => addr_out,
121
    zero      => zero,
122
    n_zero    => n_zero
123
    );
124
 
125
  -- Clock process definitions
126
  clock_process : PROCESS
127
  BEGIN
128
    clock <= '0';
129
    WAIT FOR clock_period/2;
130
    clock <= '1';
131
    WAIT FOR clock_period/2;
132
  END PROCESS;
133
 
134
 
135
  -- Stimulus process
136
  stim_proc : PROCESS
137
  BEGIN
138
    -- hold reset state for 100 ns.
139
    WAIT FOR 100 ns;
140
 
141
    WAIT FOR clock_period*10;
142
 
143
    -- insert stimulus here 
144
 
145
    WAIT;
146
  END PROCESS;
147
 
148
END;

powered by: WebSVN 2.1.0

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