scc 2025.09
SystemC components library
resetable.h
1/*******************************************************************************
2 * Copyright 2016, 2018 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 _SYSC_RESETTABLE_H_
18#define _SYSC_RESETTABLE_H_
19
20#include "resource_access_if.h"
21#include <vector>
22
23namespace scc {
32class resetable {
33public:
34 virtual ~resetable() = default;
40 virtual void reset_start() {
41 _in_reset = true;
42 for(auto res : resources)
43 res->reset();
44 }
45
50 virtual void reset_stop() {
51 for(auto res : resources)
52 res->reset();
53 _in_reset = false;
54 }
55
61 bool in_reset() { return _in_reset; }
68 void register_resource(resource_access_if* res) { resources.push_back(res); }
69
70protected:
71 std::vector<resource_access_if*> resources;
72 bool _in_reset = false;
73};
74
75} /* namespace scc */
76
77#endif /* _SYSC_RESETTABLE_H_ */
base class for components having a reset
Definition resetable.h:32
virtual void reset_stop()
distributes the end of the reset to all registered components and finishes the reset state
Definition resetable.h:50
void register_resource(resource_access_if *res)
register a resource with this reset domain
Definition resetable.h:68
bool in_reset()
get the current state of this reset domain
Definition resetable.h:61
virtual void reset_start()
distributes the begin of the reset to all registered components and set the reset state
Definition resetable.h:40
interface defining access to a resource e.g. a register
SCC TLM utilities.