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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [rtl/] [vlib/] [simlib/] [simclk.vhd] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 wfjm
-- $Id: simclk.vhd 649 2015-02-21 21:10:16Z mueller $
2 2 wfjm
--
3 13 wfjm
-- Copyright 2007-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    simclk - sim
16
-- Description:    Clock generator for test benches
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
-- Target Devices: generic
21 29 wfjm
-- Tool versions:  xst 8.2-14.7; ghdl 0.18-0.31
22 8 wfjm
--
23 2 wfjm
-- Revision History: 
24
-- Date         Rev Version  Comment
25 17 wfjm
-- 2011-12-23   444   2.0    remove CLK_CYCLE output port
26 13 wfjm
-- 2011-11-18   427   1.0.3  now numeric_std clean
27 2 wfjm
-- 2008-03-24   129   1.0.2  CLK_CYCLE now 31 bits
28
-- 2007-10-12    88   1.0.1  avoid ieee.std_logic_unsigned, use cast to unsigned
29
-- 2007-08-10    72   1.0    Initial version 
30
------------------------------------------------------------------------------
31
 
32
library ieee;
33
use ieee.std_logic_1164.all;
34
use work.slvtypes.all;
35
 
36
entity simclk is                      -- test bench clock generator
37
  generic (
38
    PERIOD : time := 20 ns;           -- clock period
39
    OFFSET : time := 200 ns);         -- clock offset (first up transition)
40
  port (
41
    CLK  : out slbit;                 -- clock
42
    CLK_STOP : in slbit               -- clock stop trigger
43
  );
44
end entity simclk;
45
 
46
architecture sim of simclk is
47
begin
48
 
49 8 wfjm
  proc_clk: process
50 2 wfjm
    constant clock_halfperiod : time := PERIOD/2;
51
  begin
52
 
53
    CLK <= '0';
54
    wait for OFFSET;
55
 
56
    clk_loop: loop
57
      CLK <= '1';
58
      wait for clock_halfperiod;
59
      CLK <= '0';
60 17 wfjm
      wait for PERIOD-clock_halfperiod;
61 2 wfjm
      exit clk_loop when CLK_STOP = '1';
62
    end loop;
63
 
64
    CLK <= '1';                         -- final clock cycle for clk_sim
65
    wait for clock_halfperiod;
66
    CLK <= '0';
67 17 wfjm
    wait for PERIOD-clock_halfperiod;
68 2 wfjm
 
69
    wait;                               -- endless wait, simulator will stop
70
 
71 8 wfjm
  end process proc_clk;
72 2 wfjm
 
73
end sim;

powered by: WebSVN 2.1.0

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