sc_fifo.hh (13123:c86a8a2bc851) | sc_fifo.hh (13143:87d1097f49b0) |
---|---|
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 --- 128 unchanged lines hidden (view full) --- 137 num_free() const 138 { 139 return _size - _entries.size() - _pending.size(); 140 } 141 142 virtual void 143 print(std::ostream &os=std::cout) const 144 { | 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 --- 128 unchanged lines hidden (view full) --- 137 num_free() const 138 { 139 return _size - _entries.size() - _pending.size(); 140 } 141 142 virtual void 143 print(std::ostream &os=std::cout) const 144 { |
145 for (typename ::std::list<T>::iterator pos = _pending.begin(); 146 pos != _pending.end(); pos++) { 147 os << *pos << ::std::endl; 148 } |
|
145 for (typename ::std::list<T>::iterator pos = _entries.begin(); 146 pos != _entries.end(); pos++) { 147 os << *pos << ::std::endl; 148 } 149 } 150 virtual void | 149 for (typename ::std::list<T>::iterator pos = _entries.begin(); 150 pos != _entries.end(); pos++) { 151 os << *pos << ::std::endl; 152 } 153 } 154 virtual void |
151 dump(std::ostream & =std::cout) const | 155 dump(std::ostream &os=std::cout) const |
152 { | 156 { |
153 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); | 157 os << "name = " << name() << std::endl; 158 int idx = 0; 159 for (typename ::std::list<T>::iterator pos = _pending.begin(); 160 pos != _pending.end(); pos++) { 161 os << "value[" << idx++ << "] = " << *pos << ::std::endl; 162 } 163 for (typename ::std::list<T>::iterator pos = _entries.begin(); 164 pos != _entries.end(); pos++) { 165 os << "value[" << idx++ << "] = " << *pos << ::std::endl; 166 } |
154 } 155 virtual const char *kind() const { return "sc_fifo"; } 156 157 protected: 158 virtual void 159 update() 160 { 161 if (!_pending.empty()) { --- 20 unchanged lines hidden (view full) --- 182 int _size; 183 mutable std::list<T> _entries; 184 mutable std::list<T> _pending; 185 bool _readsHappened; 186}; 187 188template <class T> 189inline std::ostream & | 167 } 168 virtual const char *kind() const { return "sc_fifo"; } 169 170 protected: 171 virtual void 172 update() 173 { 174 if (!_pending.empty()) { --- 20 unchanged lines hidden (view full) --- 195 int _size; 196 mutable std::list<T> _entries; 197 mutable std::list<T> _pending; 198 bool _readsHappened; 199}; 200 201template <class T> 202inline std::ostream & |
190operator << (std::ostream &os, const sc_fifo | 203operator << (std::ostream &os, const sc_fifo<T> &f) |
191{ | 204{ |
192 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); | 205 f.print(os); |
193 return os; 194} 195 196} // namespace sc_core 197 198#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_HH__ | 206 return os; 207} 208 209} // namespace sc_core 210 211#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_HH__ |