OpenCores
URL https://opencores.org/ocsvn/sdhc-sc-core/sdhc-sc-core/trunk

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpStrobesClocks/] [unitTimeoutGenerator/] [src/] [tbTimeoutGenerator-Bhv-ea.vhdl] - Blame information for rev 185

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 164 rkastl
-- SDHC-SC-Core
2
-- Secure Digital High Capacity Self Configuring Core
3 79 rkastl
-- 
4 170 rkastl
-- (C) Copyright 2010, Rainer Kastl
5
-- All rights reserved.
6 164 rkastl
-- 
7 170 rkastl
-- Redistribution and use in source and binary forms, with or without
8
-- modification, are permitted provided that the following conditions are met:
9
--     * Redistributions of source code must retain the above copyright
10
--       notice, this list of conditions and the following disclaimer.
11
--     * Redistributions in binary form must reproduce the above copyright
12
--       notice, this list of conditions and the following disclaimer in the
13
--       documentation and/or other materials provided with the distribution.
14
--     * Neither the name of the <organization> nor the
15
--       names of its contributors may be used to endorse or promote products
16
--       derived from this software without specific prior written permission.
17 164 rkastl
-- 
18 170 rkastl
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  "AS IS" AND
19
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
-- DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
22
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 164 rkastl
-- 
29
-- File        : tbTimeoutGenerator-Bhv-ea.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : Testbench
32
-- Links       : 
33
-- 
34 79 rkastl
 
35
library ieee;
36
use ieee.std_logic_1164.all;
37
use ieee.numeric_std.all;
38
use work.Global.all;
39
 
40
entity tbTimeoutGenerator is
41
 
42
        end entity tbTimeoutGenerator;
43
 
44
architecture Bhv of tbTimeoutGenerator is
45
 
46
        constant cClkFrequency : natural     := 25E6;
47
        constant cClkPeriod    : time        := 1 sec / cClkFrequency;
48
        constant cResetTime    : time        := 4 * cClkPeriod;
49
        constant cTimeoutTime  : time        := 10 us;
50
        signal Clk             : std_ulogic  := '1';
51 178 rkastl
        signal ResetSync       : std_ulogic  := cActivated;
52 79 rkastl
        signal Done            : std_ulogic  := cInactivated;
53
        signal Timeout         : std_ulogic;
54
        signal Enable          : std_ulogic  := cInactivated;
55
 
56
begin
57
 
58 178 rkastl
        Clk       <= not Clk after (cClkPeriod / 2) when Done = cInactivated else '0';
59
        ResetSync <= cInactivated after cResetTime;
60 79 rkastl
 
61
        DUT : entity work.TimeoutGenerator
62
        generic map (
63
                gClkFrequency => cClkFrequency,
64
                gTimeoutTime  => cTimeoutTime
65
        )
66
        port map (
67 178 rkastl
                iClk     => Clk,
68
                iRstSync => ResetSync,
69
                iDisable => cInactivated,
70
                iEnable  => Enable,
71
                oTimeout => Timeout
72 79 rkastl
        );
73
 
74
        Stimuli : process
75
        begin
76
                wait for cResetTime;
77
 
78
                wait for cTimeoutTime;
79
                Enable <= cActivated,
80
                                  cInactivated after 2 * cClkPeriod;
81
 
82
                wait for 2*cTimeoutTime;
83
                Enable <= cActivated;
84
 
85
                wait;
86
        end process Stimuli;
87
 
88
        Checker : process (Timeout)
89
        begin
90
                if (Timeout = cActivated or Timeout = cInactivated) then -- first 'U'
91
                        if (now = cResetTime + 2 * cTimeoutTime or
92
                        now = cResetTime + 4 * cTimeoutTime) then
93
                                assert (Timeout = cActivated)
94
                                report "Timeout was not activated at the right time"
95
                                severity error;
96
                        elsif (now = cResetTime + 5 * cTimeoutTime) then
97
                                assert (Timeout = cActivated)
98
                                report "Timeout was not activated at the right time"
99
                                severity error;
100
                                Done <= cActivated;
101
                        else
102
                                assert (Timeout = cInactivated)
103
                                report "Timeout was activated at a wrong time"
104
                                severity error;
105
                        end if;
106
                end if;
107
        end process Checker;
108
 
109
end architecture Bhv;
110
 

powered by: WebSVN 2.1.0

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