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 add_big.cpp -- 23 24 Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15 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// This may look like C code, but it is really -*- C++ -*- 39// 40// add_big.cxx -- 41// Copyright Synopsys 1998 42// Author : Ric Hilderink 43// Created On : Fri Jan 15 12:35:43 1999 44// Status : none 45// 46 47 48#define SC_INCLUDE_FX 49#include "systemc.h" 50 51 52#define SHOW(r, m) \ 53out << r.to_string(SC_BIN) << " " << flush; \ 54out << r.to_string(SC_HEX) << " " << flush; \ 55out << m.to_string(SC_BIN) << " " << flush; \ 56out << m.to_string(SC_HEX) << "\n" << flush 57 58 59#define BIG_ARROW(T_op) \ 60{ \ 61 out << "______________________ " #T_op " ______________________\n"; \ 62 out << "______________________ UP ______________________\n"; \ 63 sc_fxtype_params fooc(T_WL, T_IWL, SC_RND, SC_SAT); \ 64 T_op m(1); \ 65 T_op r(1); \ 66 int i; \ 67 for (i = 0; i < T_WL + 10; ++i) \ 68 { \ 69 r += r + (r >> 1); \ 70 SHOW(r, m); \ 71 m *= 16; \ 72 } \ 73 out << "______________________ DOWN ______________________\n"; \ 74 m = 1; \ 75 for (i = 0; i < T_WL + 10; ++i) \ 76 { \ 77 r -= m; \ 78 SHOW(r, m); \ 79 m *= 16; \ 80 } \ 81} 82 83#define T_FX_FLOAT sc_fxval 84#define T_FX_UFIX sc_ufix 85#define T_FX_FIX sc_fix 86#define T_FX_FIXED sc_fixed<T_WL, T_IWL> 87#define T_FX_UFIXED sc_ufixed<T_WL, T_IWL> 88 89#define THE_BIG_ARROW \ 90BIG_ARROW(T_FX_FLOAT) \ 91BIG_ARROW(T_FX_UFIX) \ 92BIG_ARROW(T_FX_FIX) \ 93BIG_ARROW(T_FX_FIXED) \ 94BIG_ARROW(T_FX_UFIXED) 95 96 97void add_big(ostream& out) 98{ 99 out.precision(15); 100 101#define T_WL 16 102#define T_IWL T_WL 103 out << "************* add_big " << T_WL << " ***************\n"; 104 THE_BIG_ARROW; 105#undef T_WL 106#undef T_IWL 107#define T_WL 67 108#define T_IWL T_WL 109 out << "************* add_big " << T_WL << " ***************\n"; 110 THE_BIG_ARROW; 111#undef T_WL 112#undef T_IWL 113#define T_WL 150 114#define T_IWL T_WL 115 out << "************* add_big " << T_WL << " ***************\n"; 116 THE_BIG_ARROW; 117} 118