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

Subversion Repositories sdhc-sc-core

[/] [sdhc-sc-core/] [trunk/] [grpStrobesClocks/] [unitStrobeGen/] [src/] [tbStrobeGen-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
-- 
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        : tbStrobeGen-Bhv-ea.vhdl
30
-- Owner       : Rainer Kastl
31
-- Description : 
32
-- Links       : See EDS at FH Hagenberg
33
-- 
34
 
35 79 rkastl
library ieee;
36
use ieee.std_logic_1164.all;
37
 
38
use work.Global.all;
39
 
40
entity tbStrobeGen is
41
 
42
end entity tbStrobeGen;
43
 
44
architecture Bhv of tbStrobeGen is
45
 
46
  -- component generics
47
  constant cClkFrequency               : natural := 25E6;
48
  constant cInResetDuration            : time    := 140 ns;
49
  constant cStrobeCycleTime            : time    := 1 us;
50
 
51
 
52
  -- component ports
53
  signal Clk         : std_ulogic := cInactivated;
54
  signal nResetAsync : std_ulogic := cnInactivated;
55
  signal Strobe      : std_ulogic;
56
 
57
begin  -- architecture Bhv
58
 
59
  -- component instantiation
60
  DUT : entity work.StrobeGen
61
    generic map (
62
      gClkFrequency    => cClkFrequency,
63
      gStrobeCycleTime => cStrobeCycleTime)
64
    port map (
65
      iClk         => Clk,
66
      inResetAsync => nResetAsync,
67
      oStrobe      => Strobe);
68
 
69
  Clk <= not Clk after (1 sec / cClkFrequency) / 2;
70
 
71
  nResetAsync <= cnInactivated after 0 ns,
72
                 cnActivated   after cInResetDuration,
73
                 cnInactivated after 2*cInResetDuration;
74
 
75
 
76
  -- Process to measure the frequency of the strobe signal and the
77
  -- active strobe time.
78
  DetermineStrobeFreq : process
79
    variable vHighLevel : boolean := false;
80
    variable vTimestamp : time := 0 sec;
81
  begin
82
    wait until (Strobe'event);
83
    if Strobe = '1' then
84
      vHighLevel := true;
85
      if now > vTimestamp then
86
        assert false
87
          report "Frequency Value (Strobe) = " &
88
                 integer'image((1 sec / (now-vTimestamp))) &
89
                 "Hz; Period (Strobe) = " &
90
                 time'image(now-vTimestamp)
91
          severity note;
92
            end if;
93
      vTimestamp := now;
94
    elsif vHighLevel and Strobe = '0' and
95
          ((now-vTimestamp)<(1 sec / cClkFrequency)) then
96
      assert false
97
        report "Strobe Active Time: " & time'image(now-vTimestamp) & "; " &
98
               "Clock Cycle time: " & time'image((1 sec / cClkFrequency))
99
        severity error;
100
          end if;
101
 
102
  end process DetermineStrobeFreq;
103
 
104
  -- Simulation is finished after predefined time.
105
  SimulationFinished : process
106
  begin
107
    wait for (10*cStrobeCycleTime);
108
    assert false
109
      report "This is not a failure: Simulation finished !!!"
110
      severity failure;
111
  end process SimulationFinished;
112
 
113
end architecture Bhv;
114
 

powered by: WebSVN 2.1.0

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