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_fxnum_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_fxnum_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 SC_FXNUM_OBSERVER_H 48#define SC_FXNUM_OBSERVER_H 49 50 51#include "sysc/datatypes/fx/sc_fxdefs.h" 52 53 54namespace sc_dt 55{ 56 57// classes defined in this module 58class sc_fxnum_observer; 59class sc_fxnum_fast_observer; 60 61// forward class declarations 62class sc_fxnum; 63class sc_fxnum_fast; 64 65 66#ifdef SC_ENABLE_OBSERVERS 67 68#define SC_FXNUM_OBSERVER_CONSTRUCT_(object) \ 69 SC_OBSERVER_(object,sc_fxnum_observer*,construct) 70#define SC_FXNUM_OBSERVER_DESTRUCT_(object) \ 71 SC_OBSERVER_(object,sc_fxnum_observer*,destruct) 72#define SC_FXNUM_OBSERVER_READ_(object) \ 73 SC_OBSERVER_(object,sc_fxnum_observer*,read) 74#define SC_FXNUM_OBSERVER_WRITE_(object) \ 75 SC_OBSERVER_(object,sc_fxnum_observer*,write) 76#define SC_FXNUM_OBSERVER_DEFAULT_ \ 77 SC_OBSERVER_DEFAULT_(sc_fxnum_observer) 78 79#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object) \ 80 SC_OBSERVER_(object,sc_fxnum_fast_observer*,construct) 81#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object) \ 82 SC_OBSERVER_(object,sc_fxnum_fast_observer*,destruct) 83#define SC_FXNUM_FAST_OBSERVER_READ_(object) \ 84 SC_OBSERVER_(object,sc_fxnum_fast_observer*,read) 85#define SC_FXNUM_FAST_OBSERVER_WRITE_(object) \ 86 SC_OBSERVER_(object,sc_fxnum_fast_observer*,write) 87#define SC_FXNUM_FAST_OBSERVER_DEFAULT_ \ 88 SC_OBSERVER_DEFAULT_(sc_fxnum_fast_observer) 89 90#else 91 92#define SC_FXNUM_OBSERVER_CONSTRUCT_(object) 93#define SC_FXNUM_OBSERVER_DESTRUCT_(object) 94#define SC_FXNUM_OBSERVER_READ_(object) 95#define SC_FXNUM_OBSERVER_WRITE_(object) 96#define SC_FXNUM_OBSERVER_DEFAULT_ 97 98#define SC_FXNUM_FAST_OBSERVER_CONSTRUCT_(object) 99#define SC_FXNUM_FAST_OBSERVER_DESTRUCT_(object) 100#define SC_FXNUM_FAST_OBSERVER_READ_(object) 101#define SC_FXNUM_FAST_OBSERVER_WRITE_(object) 102#define SC_FXNUM_FAST_OBSERVER_DEFAULT_ 103 104#endif 105 106 107// ---------------------------------------------------------------------------- 108// CLASS : sc_fxnum_observer 109// 110// Abstract base class for fixed-point types observers; arbitrary precision. 111// ---------------------------------------------------------------------------- 112 113class sc_fxnum_observer 114{ 115 116protected: 117 118 sc_fxnum_observer() {} 119 virtual ~sc_fxnum_observer() {} 120 121public: 122 123 virtual void construct( const sc_fxnum& ); 124 virtual void destruct( const sc_fxnum& ); 125 virtual void read( const sc_fxnum& ); 126 virtual void write( const sc_fxnum& ); 127 128 static sc_fxnum_observer* (*default_observer) (); 129 130}; 131 132 133// ---------------------------------------------------------------------------- 134// CLASS : sc_fxnum_fast_observer 135// 136// Abstract base class for fixed-point types observers; limited precision. 137// ---------------------------------------------------------------------------- 138 139class sc_fxnum_fast_observer 140{ 141 142protected: 143 144 sc_fxnum_fast_observer() {} 145 virtual ~sc_fxnum_fast_observer() {} 146 147public: 148 149 virtual void construct( const sc_fxnum_fast& ); 150 virtual void destruct( const sc_fxnum_fast& ); 151 virtual void read( const sc_fxnum_fast& ); 152 virtual void write( const sc_fxnum_fast& ); 153 154 static sc_fxnum_fast_observer* (*default_observer) (); 155 156}; 157 158 159// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 160 161// ---------------------------------------------------------------------------- 162// CLASS : sc_fxnum_observer 163// 164// Abstract base class for fixed-point types observers; arbitrary precision. 165// ---------------------------------------------------------------------------- 166 167inline 168void 169sc_fxnum_observer::construct( const sc_fxnum& ) 170{} 171 172inline 173void 174sc_fxnum_observer::destruct( const sc_fxnum& ) 175{} 176 177inline 178void 179sc_fxnum_observer::read( const sc_fxnum& ) 180{} 181 182inline 183void 184sc_fxnum_observer::write( const sc_fxnum& ) 185{} 186 187 188// ---------------------------------------------------------------------------- 189// CLASS : sc_fxnum_fast_observer 190// 191// Abstract base class for fixed-point types observers; limited precision. 192// ---------------------------------------------------------------------------- 193 194inline 195void 196sc_fxnum_fast_observer::construct( const sc_fxnum_fast& ) 197{} 198 199inline 200void 201sc_fxnum_fast_observer::destruct( const sc_fxnum_fast& ) 202{} 203 204inline 205void 206sc_fxnum_fast_observer::read( const sc_fxnum_fast& ) 207{} 208 209inline 210void 211sc_fxnum_fast_observer::write( const sc_fxnum_fast& ) 212{} 213 214} // namespace sc_dt 215 216 217#endif 218 219// Taf! 220