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 36

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
    PORT(
18
         rst : IN  std_logic;
19
         clk : IN  std_logic;
20 15 leonardoar
         quotient : OUT  std_logic_vector((nBitsLarge-1) downto 0);
21
         reminder : OUT  std_logic_vector((nBitsLarge-1) downto 0);
22
         numerator : IN  std_logic_vector((nBitsLarge-1) downto 0);
23
         divident : IN  std_logic_vector((nBitsLarge-1) downto 0);
24 5 leonardoar
         done : OUT  std_logic
25
        );
26
    END COMPONENT;
27
 
28
 
29
   --Inputs
30
   signal rst : std_logic := '0';
31
   signal clk : std_logic := '0';
32 15 leonardoar
   signal numerator : std_logic_vector((nBitsLarge-1) downto 0) := (others => '0');
33
   signal divident : std_logic_vector((nBitsLarge-1) downto 0) := (others => '0');
34 5 leonardoar
 
35
        --Outputs
36 15 leonardoar
   signal quotient : std_logic_vector((nBitsLarge-1) downto 0);
37
   signal reminder : std_logic_vector((nBitsLarge-1) downto 0);
38 5 leonardoar
   signal done : std_logic;
39
 
40
   -- Clock period definitions
41
   constant clk_period : time := 10 ns;
42
 
43
BEGIN
44
 
45 36 leonardoar
        --! Instantiate the Unit Under Test (UUT)
46 5 leonardoar
   uut: divisor PORT MAP (
47
          rst => rst,
48
          clk => clk,
49
          quotient => quotient,
50
          reminder => reminder,
51
          numerator => numerator,
52
          divident => divident,
53
          done => done
54
        );
55
 
56
   -- Clock process definitions
57
   clk_process :process
58
   begin
59
                clk <= '0';
60
                wait for clk_period/2;
61
                clk <= '1';
62
                wait for clk_period/2;
63
   end process;
64
 
65
 
66
   -- Stimulus process
67
   stim_proc: process
68
   begin
69
      -- hold reset state for 100 ns.
70
                rst <= '1';
71
                numerator <= conv_std_logic_vector(50000000, 32);
72
                divident <= conv_std_logic_vector(115200, 32);
73
      wait for 20 ns;
74
                rst <= '0';
75 6 leonardoar
 
76
                wait until done = '1';
77
      wait for clk_period;
78
 
79
                rst <= '1';
80
                numerator <= conv_std_logic_vector(40, 32);
81
                divident <= conv_std_logic_vector(5, 32);
82
      wait for 20 ns;
83
                rst <= '0';
84
 
85
                wait until done = '1';
86
                wait for clk_period;
87 5 leonardoar
 
88
      -- insert stimulus here 
89 6 leonardoar
                assert false report "NONE. End of simulation." severity failure;
90
 
91 5 leonardoar
   end process;
92
 
93
END;

powered by: WebSVN 2.1.0

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