gem5
[DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
systemc
tests
systemc
misc
unit
structure
clocks
clocks.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4
more contributor license agreements. See the NOTICE file distributed
5
with this work for additional information regarding copyright ownership.
6
Accellera licenses this file to you under the Apache License, Version 2.0
7
(the "License"); you may not use this file except in compliance with the
8
License. You may obtain a copy of the License at
9
10
http://www.apache.org/licenses/LICENSE-2.0
11
12
Unless required by applicable law or agreed to in writing, software
13
distributed under the License is distributed on an "AS IS" BASIS,
14
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
implied. See the License for the specific language governing
16
permissions and limitations under the License.
17
18
*****************************************************************************/
19
20
/*****************************************************************************
21
22
clocks.h --
23
24
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
25
26
*****************************************************************************/
27
28
/*****************************************************************************
29
30
MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31
changes you are making here.
32
33
Name, Affiliation, Date:
34
Description of Modification:
35
36
*****************************************************************************/
37
38
#include "systemc.h"
39
40
/******************************************************************************/
41
/*************************** CLK_POS Function **********************/
42
/******************************************************************************/
43
44
SC_MODULE
( CLK_POS )
45
{
46
SC_HAS_PROCESS
( CLK_POS );
47
48
sc_in_clk
clk;
49
50
sc_signal<bool>
& out_clk_pos;
51
52
CLK_POS (
sc_module_name
NAME,
53
sc_clock
& TICK_P,
54
sc_signal<bool>
& OUT_CLK_POS )
55
56
:
57
out_clk_pos (OUT_CLK_POS)
58
{
59
clk (TICK_P);
60
SC_CTHREAD
( entry, clk.pos() );
61
}
62
63
void
entry();
64
};
65
66
void
67
CLK_POS::entry()
68
{
69
cout <<
sc_time_stamp
() <<
" : CLK UP\n"
<< endl;
70
out_clk_pos.write(1);
71
wait
();
72
cout <<
sc_time_stamp
() <<
" : CLK UP\n"
<< endl;
73
out_clk_pos.write(0);
74
wait
();
75
cout <<
sc_time_stamp
() <<
" : CLK UP\n"
<< endl;
76
wait
();
77
cout <<
sc_time_stamp
() <<
" : CLK UP\n"
<< endl;
78
}
79
80
/******************************************************************************/
81
/*************************** CLK_NEG Function **********************/
82
/******************************************************************************/
83
84
SC_MODULE
( CLK_NEG )
85
{
86
SC_HAS_PROCESS
( CLK_NEG );
87
88
sc_in_clk
clk;
89
90
sc_signal<bool>
& out_clk_neg;
91
92
CLK_NEG (
sc_module_name
NAME,
93
sc_clock
& TICK_N,
94
sc_signal<bool>
& OUT_CLK_NEG )
95
:
96
out_clk_neg (OUT_CLK_NEG)
97
{
98
clk (TICK_N);
99
SC_CTHREAD
( entry, clk.neg() );
100
}
101
102
void
entry();
103
};
104
105
void
106
CLK_NEG::entry()
107
{
108
cout <<
sc_time_stamp
() <<
" : CLK DN\n"
<< endl;
109
out_clk_neg.write(1);
110
wait
();
111
cout <<
sc_time_stamp
() <<
" : CLK DN\n"
<< endl;
112
out_clk_neg.write(0);
113
wait
();
114
cout <<
sc_time_stamp
() <<
" : CLK DN\n"
<< endl;
115
wait
();
116
cout <<
sc_time_stamp
() <<
" : CLK DN\n"
<< endl;
117
}
118
119
/******************************************************************************/
120
/*************************** CLK2_POS Function **********************/
121
/******************************************************************************/
122
123
SC_MODULE
( CLK2_POS )
124
{
125
SC_HAS_PROCESS
( CLK2_POS );
126
127
sc_in_clk
clk;
128
129
sc_signal<bool>
& out_clk2_pos;
130
131
CLK2_POS (
sc_module_name
NAME,
132
sc_clock
& TICK2_P,
133
sc_signal<bool>
& OUT_CLK2_POS )
134
:
135
out_clk2_pos (OUT_CLK2_POS)
136
{
137
clk (TICK2_P);
138
SC_CTHREAD
( entry, clk.pos() );
139
}
140
141
void
entry();
142
};
143
144
void
145
CLK2_POS::entry()
146
{
147
cout <<
sc_time_stamp
() <<
" : _____________CLK2 UP\n"
<< endl;
148
out_clk2_pos.write(1);
149
wait
();
150
cout <<
sc_time_stamp
() <<
" : _____________CLK2 UP\n"
<< endl;
151
out_clk2_pos.write(0);
152
wait
();
153
cout <<
sc_time_stamp
() <<
" : _____________CLK2 UP\n"
<< endl;
154
wait
();
155
cout <<
sc_time_stamp
() <<
" : _____________CLK2 UP\n"
<< endl;
156
}
157
158
/******************************************************************************/
159
/*************************** CLK2_NEG Function **********************/
160
/******************************************************************************/
161
162
SC_MODULE
( CLK2_NEG )
163
{
164
SC_HAS_PROCESS
( CLK2_NEG );
165
166
sc_in_clk
clk;
167
168
sc_signal<bool>
& out_clk2_neg;
169
170
CLK2_NEG (
sc_module_name
NAME,
171
sc_clock
& TICK2_N,
172
sc_signal<bool>
& OUT_CLK2_NEG )
173
:
174
out_clk2_neg (OUT_CLK2_NEG)
175
{
176
clk (TICK2_N);
177
SC_CTHREAD
( entry, clk.neg() );
178
}
179
180
void
entry();
181
};
182
183
void
184
CLK2_NEG::entry()
185
{
186
cout <<
sc_time_stamp
() <<
" : _____________CLK2 DN\n"
<< endl;
187
out_clk2_neg.write(1);
188
wait
();
189
cout <<
sc_time_stamp
() <<
" : _____________CLK2 DN\n"
<< endl;
190
out_clk2_neg.write(0);
191
wait
();
192
cout <<
sc_time_stamp
() <<
" : _____________CLK2 DN\n"
<< endl;
193
wait
();
194
cout <<
sc_time_stamp
() <<
" : _____________CLK2 DN\n"
<< endl;
195
}
sc_in_clk
sc_in< bool > sc_in_clk
Definition
sc_clock.hh:116
sc_clock
Definition
sc_clock.hh:50
sc_module_name
Definition
sc_module_name.hh:42
sc_signal
Definition
sc_signal.hh:273
sc_time_stamp
const sc_time & sc_time_stamp()
Definition
sc_main.cc:127
wait
void wait()
Definition
sc_module.cc:653
SC_CTHREAD
#define SC_CTHREAD(name, clk)
Definition
sc_module.hh:323
SC_MODULE
#define SC_MODULE(name)
Definition
sc_module.hh:295
SC_HAS_PROCESS
#define SC_HAS_PROCESS(name)
Definition
sc_module.hh:301
Generated on Mon May 26 2025 09:19:15 for gem5 by
doxygen
1.13.2