scc  2022.4.0
SystemC components library
tick2time.h
1 /*******************************************************************************
2  * Copyright 2021 MINRES Technologies GmbH
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *******************************************************************************/
16 
17 #ifndef _SCC_TICK2TIME_H_
18 #define _SCC_TICK2TIME_H_
19 
20 //clang-format off
21 #include "utilities.h"
22 #include <systemc>
23 #ifdef CWR_SYSTEMC
24 #include "scml_clock/scml_clock_if.h"
25 #endif
26 //clang-format on
27 
33 namespace scc {
39 struct tick2time : public sc_core::sc_module
40 #ifdef CWR_SYSTEMC
41 ,
42  public scml_clock_observer
43 #endif
44 {
46  sc_core::sc_out<sc_core::sc_time> clk_o{"clk_o"};
48  sc_core::sc_in<bool> clk_i{"clk_i"};
54  explicit tick2time(sc_core::sc_module_name nm);
55 
56 protected:
57  void end_of_elaboration() override;
58 
59 private:
60  sc_core::sc_time clk_period;
61  sc_core::sc_time last_tick;
62 #ifdef CWR_SYSTEMC
63  void handle_clock_parameters_updated(scml_clock_if* clk_if);
64  void handle_clock_deleted(scml_clock_if*) override;
65 #endif
66 };
67 } // namespace scc // end of scc-sysc
69 #endif /* _SCC_TICK2TIME_H_ */
SCC SystemC utilities.
tick2time(sc_core::sc_module_name nm)
Definition: time_n_tick.cpp:29
sc_core::sc_out< sc_core::sc_time > clk_o
the clock output
Definition: tick2time.h:46
sc_core::sc_in< bool > clk_i
the clock input
Definition: tick2time.h:48