1// This may look like C code, but it is really -*- C++ -*- 2// 3// test_all.hh<2> -- 4// Copyright Synopsys 1998 5// Author : Ric Hilderink 6// Created On : Thu Jan 21 10:32:46 1999 7// Status : none 8// 9 10#ifndef _test_all_hh_ 11#define _test_all_hh_ 12 13 14 15#define TEST_BIT_T(T_op) \ 16{ \ 17 out << #T_op << " " << T_WL << " " << T_IWL << "\n"; \ 18 sc_fxtype_context fooc(sc_fxtype_params(T_WL, T_IWL)); \ 19 T_op a = 0; \ 20 int i; \ 21 for (i = 0; i < T_WL; ++i) \ 22 { \ 23 if (a[i]) \ 24 out << "|"; \ 25 else \ 26 out << "."; \ 27 } \ 28 out << "\t"; \ 29 for (i = 0; i < T_WL; i += 3) \ 30 a[i] = 1; \ 31 for (i = 0; i < T_WL; ++i) \ 32 { \ 33 if (a[i]) \ 34 out << "|"; \ 35 else \ 36 out << "."; \ 37 } \ 38 out << "\n"; \ 39 a = 0; \ 40 a = ~a; \ 41 for (i = 0; i < T_WL; ++i) \ 42 { \ 43 if (a[i]) \ 44 out << "|"; \ 45 else \ 46 out << "."; \ 47 } \ 48 out << "\t"; \ 49 for (i = 0; i < T_WL; i += 3) \ 50 a[i] = 0; \ 51 for (i = 0; i < T_WL; ++i) \ 52 { \ 53 if (a[i]) \ 54 out << "|"; \ 55 else \ 56 out << "."; \ 57 } \ 58 out << "\n"; \ 59 out << "a = " << a.to_string(SC_BIN) << "\n"; \ 60 a = "0b01010"; \ 61 out << "a = " << a.to_string(SC_BIN) << "\n"; \ 62} 63 64 65#define TEST_BIT \ 66TEST_BIT_T(T_FX_FIX); \ 67TEST_BIT_T(T_FX_FIXED); \ 68TEST_BIT_T(T_FX_UFIX); \ 69TEST_BIT_T(T_FX_UFIXED); 70 71 72#define T_FX_UFIX sc_ufix 73#define T_FX_FIX sc_fix 74#define T_FX_FIXED sc_fixed<T_WL, T_IWL> 75#define T_FX_UFIXED sc_ufixed<T_WL, T_IWL> 76 77#define T_WL 4 78#define T_IWL 4 79 80#endif 81