port.hh (13239:0fe49a9e1754) port.hh (13260:4d18f1d20093)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 28 unchanged lines hidden (view full) ---

37#include "systemc/ext/core/sc_interface.hh"
38#include "systemc/ext/core/sc_port.hh"
39
40namespace sc_gem5
41{
42
43class StaticSensitivityPort;
44class StaticSensitivityFinder;
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 28 unchanged lines hidden (view full) ---

37#include "systemc/ext/core/sc_interface.hh"
38#include "systemc/ext/core/sc_port.hh"
39
40namespace sc_gem5
41{
42
43class StaticSensitivityPort;
44class StaticSensitivityFinder;
45class ResetSensitivityPort;
45
46class Port;
47
48extern std::list<Port *> allPorts;
49
50class Port
51{
52 private:
53 ::sc_core::sc_port_base *portBase;
54
55 bool finalized;
56 int _maxSize;
57 int _size;
58
59 void finalizePort(StaticSensitivityPort *port);
60 void finalizeFinder(StaticSensitivityFinder *finder);
46
47class Port;
48
49extern std::list<Port *> allPorts;
50
51class Port
52{
53 private:
54 ::sc_core::sc_port_base *portBase;
55
56 bool finalized;
57 int _maxSize;
58 int _size;
59
60 void finalizePort(StaticSensitivityPort *port);
61 void finalizeFinder(StaticSensitivityFinder *finder);
62 void finalizeReset(ResetSensitivityPort *reset);
61
62 void
63 addInterface(::sc_core::sc_interface *iface)
64 {
65 for (int i = 0; i < _size; i++) {
66 if (getInterface(i) == iface) {
67 std::string msg =
68 csprintf("interface already bound to port: port '%s' (%s)",

--- 31 unchanged lines hidden (view full) ---

100
101 ::sc_core::sc_interface *interface;
102 ::sc_core::sc_port_base *port;
103 };
104
105 struct Sensitivity
106 {
107 Sensitivity(StaticSensitivityPort *port) :
63
64 void
65 addInterface(::sc_core::sc_interface *iface)
66 {
67 for (int i = 0; i < _size; i++) {
68 if (getInterface(i) == iface) {
69 std::string msg =
70 csprintf("interface already bound to port: port '%s' (%s)",

--- 31 unchanged lines hidden (view full) ---

102
103 ::sc_core::sc_interface *interface;
104 ::sc_core::sc_port_base *port;
105 };
106
107 struct Sensitivity
108 {
109 Sensitivity(StaticSensitivityPort *port) :
108 port(port), finder(nullptr)
110 port(port), finder(nullptr), reset(nullptr)
109 {}
110
111 Sensitivity(StaticSensitivityFinder *finder) :
111 {}
112
113 Sensitivity(StaticSensitivityFinder *finder) :
112 port(nullptr), finder(finder)
114 port(nullptr), finder(finder), reset(nullptr)
113 {}
114
115 {}
116
117 Sensitivity(ResetSensitivityPort *reset) :
118 port(nullptr), finder(nullptr), reset(reset)
119 {}
120
115 StaticSensitivityPort *port;
116 StaticSensitivityFinder *finder;
121 StaticSensitivityPort *port;
122 StaticSensitivityFinder *finder;
123 ResetSensitivityPort *reset;
117 };
118
119 std::vector<Binding *> bindings;
120 std::vector<Sensitivity *> sensitivities;
121
122 public:
123 static Port *
124 fromPort(const ::sc_core::sc_port_base *pb)

--- 18 unchanged lines hidden (view full) ---

143 void
144 bind(::sc_core::sc_port_base *port)
145 {
146 bindings.push_back(new Binding(port));
147 }
148
149 void sensitive(StaticSensitivityPort *port);
150 void sensitive(StaticSensitivityFinder *finder);
124 };
125
126 std::vector<Binding *> bindings;
127 std::vector<Sensitivity *> sensitivities;
128
129 public:
130 static Port *
131 fromPort(const ::sc_core::sc_port_base *pb)

--- 18 unchanged lines hidden (view full) ---

150 void
151 bind(::sc_core::sc_port_base *port)
152 {
153 bindings.push_back(new Binding(port));
154 }
155
156 void sensitive(StaticSensitivityPort *port);
157 void sensitive(StaticSensitivityFinder *finder);
158 void sensitive(ResetSensitivityPort *reset);
151
152 void finalize();
153
154 int size() { return _size; }
155 int maxSize() { return _maxSize; }
156};
157
158} // namespace sc_gem5
159
160#endif // __SYSTEMC_CORE_PORT_HH__
159
160 void finalize();
161
162 int size() { return _size; }
163 int maxSize() { return _maxSize; }
164};
165
166} // namespace sc_gem5
167
168#endif // __SYSTEMC_CORE_PORT_HH__