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

Subversion Repositories uart_block

[/] [uart_block/] [trunk/] [hdl/] [iseProject/] [testDivisor.vhd] - Blame information for rev 37

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

Line No. Rev Author Line
1 15 leonardoar
--! Test divisor module
2 5 leonardoar
library IEEE;
3
use IEEE.STD_LOGIC_1164.ALL;
4
use IEEE.std_logic_arith.all;
5
 
6 15 leonardoar
--! Use Global Definitions package
7
use work.pkgDefinitions.all;
8 5 leonardoar
 
9
ENTITY testDivisor IS
10
END testDivisor;
11
 
12
ARCHITECTURE behavior OF testDivisor IS
13
 
14
    -- Component Declaration for the Unit Under Test (UUT)
15
 
16
    COMPONENT divisor
17 37 leonardoar
    Port ( rst : in  STD_LOGIC;                                                                                                         --! Reset input
18
           clk : in  STD_LOGIC;                                                                                                         --! Clock input
19
           quotient : out  STD_LOGIC_VECTOR ((nBitsLarge-1) downto 0);   --! Division result (32 bits)
20
                          reminder : out  STD_LOGIC_VECTOR ((nBitsLarge-1) downto 0);    --! Reminder result (32 bits)
21
           numerator : in  STD_LOGIC_VECTOR ((nBitsLarge-1) downto 0);   --! Numerator (32 bits)
22
           divident : in  STD_LOGIC_VECTOR ((nBitsLarge-1) downto 0);    --! "Divide by" number (32 bits)
23
           done : out  STD_LOGIC);
24 5 leonardoar
    END COMPONENT;
25
 
26
 
27
   --Inputs
28 37 leonardoar
   signal rst : std_logic := '0';                                                                                                                                        --! Signal to connect with UUT
29
   signal clk : std_logic := '0';                                                                                                                                        --! Signal to connect with UUT
30
   signal numerator : std_logic_vector((nBitsLarge-1) downto 0) := (others => '0');       --! Signal to connect with UUT
31
   signal divident : std_logic_vector((nBitsLarge-1) downto 0) := (others => '0');        --! Signal to connect with UUT
32 5 leonardoar
 
33
        --Outputs
34 37 leonardoar
   signal quotient : std_logic_vector((nBitsLarge-1) downto 0);                                                  --! Signal to connect with UUT
35
   signal reminder : std_logic_vector((nBitsLarge-1) downto 0);                                                  --! Signal to connect with UUT
36 5 leonardoar
   signal done : std_logic;
37
 
38
   -- Clock period definitions
39
   constant clk_period : time := 10 ns;
40
 
41
BEGIN
42
 
43 36 leonardoar
        --! Instantiate the Unit Under Test (UUT)
44 5 leonardoar
   uut: divisor PORT MAP (
45
          rst => rst,
46
          clk => clk,
47
          quotient => quotient,
48
          reminder => reminder,
49
          numerator => numerator,
50
          divident => divident,
51
          done => done
52
        );
53
 
54
   -- Clock process definitions
55
   clk_process :process
56
   begin
57
                clk <= '0';
58
                wait for clk_period/2;
59
                clk <= '1';
60
                wait for clk_period/2;
61
   end process;
62
 
63
 
64
   -- Stimulus process
65
   stim_proc: process
66
   begin
67
      -- hold reset state for 100 ns.
68
                rst <= '1';
69
                numerator <= conv_std_logic_vector(50000000, 32);
70
                divident <= conv_std_logic_vector(115200, 32);
71
      wait for 20 ns;
72
                rst <= '0';
73 6 leonardoar
 
74
                wait until done = '1';
75
      wait for clk_period;
76
 
77
                rst <= '1';
78
                numerator <= conv_std_logic_vector(40, 32);
79
                divident <= conv_std_logic_vector(5, 32);
80
      wait for 20 ns;
81
                rst <= '0';
82
 
83
                wait until done = '1';
84
                wait for clk_period;
85 5 leonardoar
 
86
      -- insert stimulus here 
87 6 leonardoar
                assert false report "NONE. End of simulation." severity failure;
88
 
89 5 leonardoar
   end process;
90
 
91
END;

powered by: WebSVN 2.1.0

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