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 --- 17 unchanged lines hidden (view full) --- 26 * 27 * Authors: Gabe Black 28 */ 29 30#ifndef __SYSTEMC_CORE_PORT_HH__ 31#define __SYSTEMC_CORE_PORT_HH__ 32 33#include <list> |
34#include <typeinfo> |
35#include <vector> 36 37#include "base/cprintf.hh" 38#include "systemc/ext/core/sc_interface.hh" 39#include "systemc/ext/core/sc_port.hh" 40 41namespace sc_gem5 42{ --- 10 unchanged lines hidden (view full) --- 53{ 54 private: 55 ::sc_core::sc_port_base *portBase; 56 57 bool finalized; 58 int _maxSize; 59 int _size; 60 |
61 bool regPortNeeded; 62 |
63 void finalizePort(StaticSensitivityPort *port); 64 void finalizeFinder(StaticSensitivityFinder *finder); 65 void finalizeReset(ResetSensitivityPort *reset); 66 67 void 68 addInterface(::sc_core::sc_interface *iface) 69 { 70 for (int i = 0; i < _size; i++) { --- 7 unchanged lines hidden (view full) --- 78 } 79 _size++; 80 portBase->_gem5AddInterface(iface); 81 } 82 83 void 84 addInterfaces(::sc_core::sc_port_base *pb) 85 { |
86 // Only the ports farthest from the interfaces call register_port. 87 pb->_gem5Port->regPortNeeded = false; |
88 for (int i = 0; i < pb->size(); i++) 89 addInterface(pb->_gem5Interface(i)); 90 } 91 92 ::sc_core::sc_interface * 93 getInterface(int i) 94 { 95 return portBase->_gem5Interface(i); --- 40 unchanged lines hidden (view full) --- 136 fromPort(const ::sc_core::sc_port_base *pb) 137 { 138 return pb->_gem5Port; 139 } 140 141 ::sc_core::sc_port_base *sc_port_base() { return portBase; } 142 143 Port(::sc_core::sc_port_base *port_base, int max) : |
144 portBase(port_base), finalized(false), _maxSize(max), _size(0), 145 regPortNeeded(true) |
146 { 147 allPorts.push_front(this); 148 } 149 150 void 151 bind(::sc_core::sc_interface *interface) 152 { 153 if (bindings.empty()) --- 8 unchanged lines hidden (view full) --- 162 bindings.push_back(new Binding(port)); 163 } 164 165 void sensitive(StaticSensitivityPort *port); 166 void sensitive(StaticSensitivityFinder *finder); 167 void sensitive(ResetSensitivityPort *reset); 168 169 void finalize(); |
170 void regPort(); |
171 172 int size() { return _size; } 173 int maxSize() { return _maxSize; } 174}; 175 176} // namespace sc_gem5 177 178#endif // __SYSTEMC_CORE_PORT_HH__ |