w11 - vhd
0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
simclkv.vhd
Go to the documentation of this file.
1
-- $Id: simclkv.vhd 1181 2019-07-08 17:00:50Z mueller $
2
-- SPDX-License-Identifier: GPL-3.0-or-later
3
-- Copyright 2007-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
------------------------------------------------------------------------------
6
-- Module Name: simclkv - sim
7
-- Description: Clock generator for test benches, variable period
8
--
9
-- Dependencies: -
10
-- Test bench: -
11
-- Target Devices: generic
12
-- Tool versions: xst 8.2-14.7; viv 2016.2; ghdl 0.18-0.33
13
-- Revision History:
14
-- Date Rev Version Comment
15
-- 2016-09-03 805 2.0.1 CLK_STOP,CLK_HOLD now optional ports
16
-- 2011-12-23 444 2.0 remove CLK_CYCLE output port
17
-- 2011-11-21 432 1.0.2 now numeric_std clean
18
-- 2008-03-24 129 1.0.1 CLK_CYCLE now 31 bits
19
-- 2007-12-27 106 1.0 Initial version
20
------------------------------------------------------------------------------
21
22
library
ieee
;
23
use
ieee.std_logic_1164.
all
;
24
use
ieee.numeric_std.
all
;
25
use
work.
slvtypes
.
all
;
26
27
entity
simclkv
is
-- test bench clock generator
28
-- with variable period
29
port
(
30
CLK
:
out
slbit
;
-- clock
31
CLK_PERIOD
:
in
Delay_length
;
-- clock period
32
CLK_HOLD
:
in
slbit
:=
'
0
'
;
-- if 1, hold clocks in 0 state
33
CLK_STOP
:
in
slbit
:=
'
0
'
-- clock stop trigger
34
)
;
35
end
entity
simclkv
;
36
37
38
architecture
sim
of
simclkv
is
39
begin
40
41
clk_proc:
process
42
variable
half_period
:
Delay_length
:=
0
ns
;
43
begin
44
45
CLK
<=
'
0
'
;
46
47
clk_loop
:
loop
48
49
if
CLK_HOLD
=
'
1
'
then
50
wait
until
CLK_HOLD
=
'
0
'
;
51
end
if
;
52
half_period
:=
CLK_PERIOD
/
2
;
53
54
CLK
<=
'
1
'
;
55
wait
for
half_period
;
56
CLK
<=
'
0
'
;
57
wait
for
CLK_PERIOD
-
half_period
;
58
exit
clk_loop
when
CLK_STOP
=
'
1
'
;
59
end
loop
;
60
61
CLK
<=
'
1
'
;
-- final clock cycle for clk_sim
62
wait
for
CLK_PERIOD
/
2
;
63
CLK
<=
'
0
'
;
64
wait
for
CLK_PERIOD
-
CLK_PERIOD
/
2
;
65
66
wait
;
-- endless wait, simulator will stop
67
68
end
process
;
69
70
end
sim;
simclkv.sim
Definition:
simclkv.vhd:38
simclkv
Definition:
simclkv.vhd:27
simclkv.CLK
out CLK slbit
Definition:
simclkv.vhd:30
simclkv.CLK_HOLD
in CLK_HOLD slbit := '0'
Definition:
simclkv.vhd:32
simclkv.CLK_PERIOD
in CLK_PERIOD Delay_length
Definition:
simclkv.vhd:31
simclkv.CLK_STOP
in CLK_STOP slbit := '0'
Definition:
simclkv.vhd:34
slvtypes
Definition:
slvtypes.vhd:28
slvtypes.slbit
std_logic slbit
Definition:
slvtypes.vhd:30
vlib
simlib
simclkv.vhd
Generated on Thu Feb 9 2023 12:41:06 for w11 - vhd by
1.9.6