SystemC 3.0.0
Accellera SystemC proof-of-concept library
sc_writer_policy.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 sc_writer_policy.h -- The sc_signal<T> writer policy definition
23
24 Original Author: Philipp A: Hartmann, OFFIS
25
26 CHANGE LOG IS AT THE END OF THE FILE
27 *****************************************************************************/
28
29
30#ifndef SC_WRITER_POLICY_H_INCLUDED_
31#define SC_WRITER_POLICY_H_INCLUDED_
32
33#if !defined(SC_DEFAULT_WRITER_POLICY)
34# if defined(SC_NO_WRITE_CHECK)
35# define SC_DEFAULT_WRITER_POLICY SC_UNCHECKED_WRITERS
36# else
37# define SC_DEFAULT_WRITER_POLICY SC_ONE_WRITER
38# endif
39#endif
40
42
43#if defined(_MSC_VER) && _MSC_VER < 1800
44# pragma warning(push)
45# pragma warning(disable:4512) // assignment operator could not be generated
46#endif // _MSC_VER < 1800
47
48namespace sc_core {
49
50class sc_object;
51class sc_port_base;
52extern
53SC_API void
55 sc_object* second_writer, bool check_delta );
56
57// SIGNAL WRITING POLICIES
58//
59// Note: if you add a new policy to the enum below you will need to add
60// an additional overload of sc_reset::reset_signal_is() for the sc_signal<bool>
61// instance. That will require changes to sysc/kernel/sc_reset.cpp and
62// sysc/kernel/sc_reset.h
63
65{
69};
70
71template< sc_writer_policy >
73
75{
76 bool check_write( sc_object* /* target */, bool /* value_changed */ )
77 { return true; }
78 bool needs_update() const { return false; }
79 void update() {}
80};
81
83{
84 bool check_write( sc_object* target, bool value_changed );
85 bool needs_update() const { return m_delta_only; }
86 void update();
87
88private:
89 static bool only_delta();
90
91protected:
92 sc_writer_policy_check_write( bool delta_only = only_delta() )
93 : m_delta_only( delta_only ), m_writer_p() {}
94
95 const bool m_delta_only;
97};
98
101{
102 // bool write_check(sc_object*, bool); /* inherited */
103
104 // always force update phase to reset process
105 bool needs_update() const { return true; }
106
107 // reset current writer during update phase
108 void update() { sc_process_handle().swap( m_writer_p ); }
109
110protected:
113};
114
116{
118 { return true; }
119};
120
122{
123 bool check_port( sc_object* target, sc_port_base* port, bool is_output );
124
125protected:
128};
129
130template<>
134{};
135
136template<>
140{};
141
142template<>
146{};
147
148} // namespace sc_core
149
150#if defined(_MSC_VER) && _MSC_VER < 1800
151# pragma warning(pop)
152#endif // _MSC_VER < 1800
153
154#endif // SC_WRITER_POLICY_H_INCLUDED_
155// Taf!
#define SC_API
Definition: sc_cmnhdr.h:148
SC_API void sc_signal_invalid_writer(sc_object *target, sc_object *first_writer, sc_object *second_writer, bool check_delta)
class SC_API sc_port_base
Definition: sc_interface.h:37
class SC_API sc_object
Definition: sc_object.h:46
@ SC_ONE_WRITER
unique writer (from a unique port)
@ SC_UNCHECKED_WRITERS
even allow delta cycle conflicts (non-standard)
@ SC_MANY_WRITERS
allow multiple writers (with different ports)
sc_writer_policy_check_write(bool delta_only=only_delta())
bool check_port(sc_object *, sc_port_base *, bool)
bool check_port(sc_object *target, sc_port_base *port, bool is_output)
void swap(sc_process_handle &other)