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_fxval_observer.h - 23 24 Original Author: Martin Janssen, Synopsys, Inc. 25 26 *****************************************************************************/ 27 28/***************************************************************************** 29 30 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 31 changes you are making here. 32 33 Name, Affiliation, Date: 34 Description of Modification: 35 36 *****************************************************************************/ 37 38// $Log: sc_fxval_observer.h,v $ 39// Revision 1.1.1.1 2006/12/15 20:20:04 acg 40// SystemC 2.3 41// 42// Revision 1.3 2006/01/13 18:53:58 acg 43// Andy Goodrich: added $Log command so that CVS comments are reproduced in 44// the source. 45// 46 47#ifndef __SYSTEMC_EXT_DT_FX_SC_FXVAL_OBSERVER_HH__ 48#define __SYSTEMC_EXT_DT_FX_SC_FXVAL_OBSERVER_HH__ 49 50#include "sc_fxdefs.hh" 51 52namespace sc_dt 53{ 54 55// classes defined in this module 56class sc_fxval_observer; 57class sc_fxval_fast_observer; 58 59// forward class declarations 60class sc_fxval; 61class sc_fxval_fast; 62 63#ifdef SC_ENABLE_OBSERVERS 64 65#define SC_FXVAL_OBSERVER_CONSTRUCT_(object) \ 66 SC_OBSERVER_(object, sc_fxval_observer *, construct) 67#define SC_FXVAL_OBSERVER_DESTRUCT_(object) \ 68 SC_OBSERVER_(object, sc_fxval_observer *, destruct) 69#define SC_FXVAL_OBSERVER_READ_(object) \ 70 SC_OBSERVER_(object, sc_fxval_observer *, read) 71#define SC_FXVAL_OBSERVER_WRITE_(object) \ 72 SC_OBSERVER_(object, sc_fxval_observer *, write) 73#define SC_FXVAL_OBSERVER_DEFAULT_ \ 74 SC_OBSERVER_DEFAULT_(sc_fxval_observer) 75 76#define SC_FXVAL_FAST_OBSERVER_CONSTRUCT_(object) \ 77 SC_OBSERVER_(object, sc_fxval_fast_observer *, construct) 78#define SC_FXVAL_FAST_OBSERVER_DESTRUCT_(object) \ 79 SC_OBSERVER_(object, sc_fxval_fast_observer *, destruct) 80#define SC_FXVAL_FAST_OBSERVER_READ_(object) \ 81 SC_OBSERVER_(object, sc_fxval_fast_observer *, read) 82#define SC_FXVAL_FAST_OBSERVER_WRITE_(object) \ 83 SC_OBSERVER_(object, sc_fxval_fast_observer *, write) 84#define SC_FXVAL_FAST_OBSERVER_DEFAULT_ \ 85 SC_OBSERVER_DEFAULT_(sc_fxval_fast_observer) 86 87#else 88 89#define SC_FXVAL_OBSERVER_CONSTRUCT_(object) 90#define SC_FXVAL_OBSERVER_DESTRUCT_(object) 91#define SC_FXVAL_OBSERVER_READ_(object) 92#define SC_FXVAL_OBSERVER_WRITE_(object) 93#define SC_FXVAL_OBSERVER_DEFAULT_ 94 95#define SC_FXVAL_FAST_OBSERVER_CONSTRUCT_(object) 96#define SC_FXVAL_FAST_OBSERVER_DESTRUCT_(object) 97#define SC_FXVAL_FAST_OBSERVER_READ_(object) 98#define SC_FXVAL_FAST_OBSERVER_WRITE_(object) 99#define SC_FXVAL_FAST_OBSERVER_DEFAULT_ 100 101#endif 102 103 104// ---------------------------------------------------------------------------- 105// CLASS : sc_fxval_observer 106// 107// Abstract base class for fixed-point value type observers; 108// arbitrary precision. 109// ---------------------------------------------------------------------------- 110 111class sc_fxval_observer 112{ 113 protected: 114 sc_fxval_observer() {} 115 virtual ~sc_fxval_observer() {} 116 public: 117 virtual void construct(const sc_fxval &); 118 virtual void destruct(const sc_fxval &); 119 virtual void read(const sc_fxval &); 120 virtual void write(const sc_fxval &); 121 122 static sc_fxval_observer *(*default_observer) (); 123}; 124 125 126// ---------------------------------------------------------------------------- 127// CLASS : sc_fxval_fast_observer 128// 129// Abstract base class for fixed-point value type observers; 130// limited precision. 131// ---------------------------------------------------------------------------- 132 133class sc_fxval_fast_observer 134{ 135 protected: 136 sc_fxval_fast_observer() {} 137 virtual ~sc_fxval_fast_observer() {} 138 139 public: 140 virtual void construct(const sc_fxval_fast &); 141 virtual void destruct(const sc_fxval_fast &); 142 virtual void read(const sc_fxval_fast &); 143 virtual void write(const sc_fxval_fast &); 144 145 static sc_fxval_fast_observer *(*default_observer) (); 146}; 147 148 149// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 150 151// ---------------------------------------------------------------------------- 152// CLASS : sc_fxval_observer 153// 154// Abstract base class for fixed-point value type observers; 155// arbitrary precision. 156// ---------------------------------------------------------------------------- 157 158inline void sc_fxval_observer::construct(const sc_fxval &) {} 159inline void sc_fxval_observer::destruct(const sc_fxval &) {} 160inline void sc_fxval_observer::read(const sc_fxval &) {} 161inline void sc_fxval_observer::write(const sc_fxval &) {} 162 163 164// ---------------------------------------------------------------------------- 165// CLASS : sc_fxval_fast_observer 166// 167// Abstract base class for fixed-point value type observers; 168// limited precision. 169// ---------------------------------------------------------------------------- 170 171inline void sc_fxval_fast_observer::construct(const sc_fxval_fast &) {} 172inline void sc_fxval_fast_observer::destruct(const sc_fxval_fast &) {} 173inline void sc_fxval_fast_observer::read(const sc_fxval_fast &) {} 174inline void sc_fxval_fast_observer::write(const sc_fxval_fast &) {} 175 176} // namespace sc_dt 177 178#endif // __SYSTEMC_EXT_DT_FX_SC_FXVAL_OBSERVER_HH__ 179