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_signal_resolved_ports.h -- The sc_signal_resolved port classes. 23 24 Original Author: Martin Janssen, Synopsys, Inc., 2001-08-20 25 26 CHANGE LOG IS AT THE END OF THE FILE 27 *****************************************************************************/ 28 29#ifndef SC_SIGNAL_RESOLVED_PORTS_H 30#define SC_SIGNAL_RESOLVED_PORTS_H 31 32 33#include "sysc/communication/sc_signal_ports.h" 34#include "sysc/datatypes/bit/sc_logic.h" 35 36namespace sc_core { 37 38// ---------------------------------------------------------------------------- 39// CLASS : sc_in_resolved 40// 41// The sc_signal_resolved input port class. 42// ---------------------------------------------------------------------------- 43 44class sc_in_resolved 45 : public sc_in<sc_dt::sc_logic> 46{ 47public: 48 49 // typedefs 50 51 typedef sc_dt::sc_logic data_type; 52 53 typedef sc_in_resolved this_type; 54 typedef sc_in<data_type> base_type; 55 56 typedef base_type::in_if_type in_if_type; 57 typedef base_type::in_port_type in_port_type; 58 typedef base_type::inout_port_type inout_port_type; 59 60public: 61 62 // constructors 63 64 sc_in_resolved() 65 : base_type() 66 {} 67 68 explicit sc_in_resolved( const char* name_ ) 69 : base_type( name_ ) 70 {} 71 72 explicit sc_in_resolved( const in_if_type& interface_ ) 73 : base_type( interface_ ) 74 {} 75 76 sc_in_resolved( const char* name_, const in_if_type& interface_ ) 77 : base_type( name_, interface_ ) 78 {} 79 80 explicit sc_in_resolved( in_port_type& parent_ ) 81 : base_type( parent_ ) 82 {} 83 84 sc_in_resolved( const char* name_, in_port_type& parent_ ) 85 : base_type( name_, parent_ ) 86 {} 87 88 explicit sc_in_resolved( inout_port_type& parent_ ) 89 : base_type( parent_ ) 90 {} 91 92 sc_in_resolved( const char* name_, inout_port_type& parent_ ) 93 : base_type( name_, parent_ ) 94 {} 95 96 sc_in_resolved( this_type& parent_ ) 97 : base_type( parent_ ) 98 {} 99 100 sc_in_resolved( const char* name_, this_type& parent_ ) 101 : base_type( name_, parent_ ) 102 {} 103 104 105 // destructor (does nothing) 106 107 virtual ~sc_in_resolved() 108 {} 109 110 111 // called when elaboration is done 112 /* WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */ 113 /* MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */ 114 115 virtual void end_of_elaboration(); 116 117 virtual const char* kind() const 118 { return "sc_in_resolved"; } 119 120private: 121 122 // disabled 123 sc_in_resolved( const this_type& ); 124 this_type& operator = ( const this_type& ); 125}; 126 127 128// ---------------------------------------------------------------------------- 129// CLASS : sc_inout_resolved 130// 131// The sc_signal_resolved input/output port class. 132// ---------------------------------------------------------------------------- 133 134class sc_inout_resolved 135 : public sc_inout<sc_dt::sc_logic> 136{ 137public: 138 139 // typedefs 140 141 typedef sc_dt::sc_logic data_type; 142 143 typedef sc_inout_resolved this_type; 144 typedef sc_inout<data_type> base_type; 145 146 typedef base_type::in_if_type in_if_type; 147 typedef base_type::in_port_type in_port_type; 148 typedef base_type::inout_if_type inout_if_type; 149 typedef base_type::inout_port_type inout_port_type; 150 151public: 152 153 // constructors 154 155 sc_inout_resolved() 156 : base_type() 157 {} 158 159 explicit sc_inout_resolved( const char* name_ ) 160 : base_type( name_ ) 161 {} 162 163 explicit sc_inout_resolved( inout_if_type& interface_ ) 164 : base_type( interface_ ) 165 {} 166 167 sc_inout_resolved( const char* name_, inout_if_type& interface_ ) 168 : base_type( name_, interface_ ) 169 {} 170 171 explicit sc_inout_resolved( inout_port_type& parent_ ) 172 : base_type( parent_ ) 173 {} 174 175 sc_inout_resolved( const char* name_, inout_port_type& parent_ ) 176 : base_type( name_, parent_ ) 177 {} 178 179 sc_inout_resolved( this_type& parent_ ) 180 : base_type( parent_ ) 181 {} 182 183 sc_inout_resolved( const char* name_, this_type& parent_ ) 184 : base_type( name_, parent_ ) 185 {} 186 187 188 // destructor (does nothing) 189 190 virtual ~sc_inout_resolved() 191 {} 192 193 194 // write the new value 195 196 this_type& operator = ( const data_type& value_ ) 197 { (*this)->write( value_ ); return *this; } 198 199 this_type& operator = ( const in_if_type& interface_ ) 200 { (*this)->write( interface_.read() ); return *this; } 201 202 this_type& operator = ( const in_port_type& port_ ) 203 { (*this)->write( port_->read() ); return *this; } 204 205 this_type& operator = ( const inout_port_type& port_ ) 206 { (*this)->write( port_->read() ); return *this; } 207 208 this_type& operator = ( const this_type& port_ ) 209 { (*this)->write( port_->read() ); return *this; } 210 211 212 // called when elaboration is done 213 /* WHEN DEFINING THIS METHOD IN A DERIVED CLASS, */ 214 /* MAKE SURE THAT THIS METHOD IS CALLED AS WELL. */ 215 216 virtual void end_of_elaboration(); 217 218 virtual const char* kind() const 219 { return "sc_inout_resolved"; } 220 221private: 222 223 // disabled 224 sc_inout_resolved( const this_type& ); 225}; 226 227 228// ---------------------------------------------------------------------------- 229// CLASS : sc_out_resolved 230// 231// The sc_signal_resolved output port class. 232// ---------------------------------------------------------------------------- 233 234// sc_out_resolved can also read from its port, hence no difference with 235// sc_inout_resolved. For debugging reasons, a class is provided instead 236// of a typedef. 237 238class sc_out_resolved 239 : public sc_inout_resolved 240{ 241public: 242 243 // typedefs 244 245 typedef sc_out_resolved this_type; 246 typedef sc_inout_resolved base_type; 247 248 typedef base_type::data_type data_type; 249 250 typedef base_type::in_if_type in_if_type; 251 typedef base_type::in_port_type in_port_type; 252 typedef base_type::inout_if_type inout_if_type; 253 typedef base_type::inout_port_type inout_port_type; 254 255public: 256 257 // constructors 258 259 sc_out_resolved() 260 : base_type() 261 {} 262 263 explicit sc_out_resolved( const char* name_ ) 264 : base_type( name_ ) 265 {} 266 267 explicit sc_out_resolved( inout_if_type& interface_ ) 268 : base_type( interface_ ) 269 {} 270 271 sc_out_resolved( const char* name_, inout_if_type& interface_ ) 272 : base_type( name_, interface_ ) 273 {} 274 275 explicit sc_out_resolved( inout_port_type& parent_ ) 276 : base_type( parent_ ) 277 {} 278 279 sc_out_resolved( const char* name_, inout_port_type& parent_ ) 280 : base_type( name_, parent_ ) 281 {} 282 283 sc_out_resolved( this_type& parent_ ) 284 : base_type( parent_ ) 285 {} 286 287 sc_out_resolved( const char* name_, this_type& parent_ ) 288 : base_type( name_, parent_ ) 289 {} 290 291 292 // destructor (does nothing) 293 294 virtual ~sc_out_resolved() 295 {} 296 297 298 // write the new value 299 300 this_type& operator = ( const data_type& value_ ) 301 { (*this)->write( value_ ); return *this; } 302 303 this_type& operator = ( const in_if_type& interface_ ) 304 { (*this)->write( interface_.read() ); return *this; } 305 306 this_type& operator = ( const in_port_type& port_ ) 307 { (*this)->write( port_->read() ); return *this; } 308 309 this_type& operator = ( const inout_port_type& port_ ) 310 { (*this)->write( port_->read() ); return *this; } 311 312 this_type& operator = ( const this_type& port_ ) 313 { (*this)->write( port_->read() ); return *this; } 314 315 virtual const char* kind() const 316 { return "sc_out_resolved"; } 317 318private: 319 320 // disabled 321 sc_out_resolved( const this_type& ); 322}; 323 324} // namespace sc_core 325 326//$Log: sc_signal_resolved_ports.h,v $ 327//Revision 1.3 2011/08/26 20:45:44 acg 328// Andy Goodrich: moved the modification log to the end of the file to 329// eliminate source line number skew when check-ins are done. 330// 331//Revision 1.2 2011/02/18 20:23:45 acg 332// Andy Goodrich: Copyright update. 333// 334//Revision 1.1.1.1 2006/12/15 20:20:04 acg 335//SystemC 2.3 336// 337//Revision 1.2 2006/01/03 23:18:26 acg 338//Changed copyright to include 2006. 339// 340//Revision 1.1.1.1 2005/12/19 23:16:43 acg 341//First check in of SystemC 2.1 into its own archive. 342// 343//Revision 1.9 2005/06/10 22:43:55 acg 344//Added CVS change log annotation. 345// 346 347#endif 348 349// Taf! 350