fx_fixed_limits.cpp revision 12855:588919e0e4aa
12SN/A/*****************************************************************************
21762SN/A
32SN/A  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
42SN/A  more contributor license agreements.  See the NOTICE file distributed
52SN/A  with this work for additional information regarding copyright ownership.
62SN/A  Accellera licenses this file to you under the Apache License, Version 2.0
72SN/A  (the "License"); you may not use this file except in compliance with the
82SN/A  License.  You may obtain a copy of the License at
92SN/A
102SN/A    http://www.apache.org/licenses/LICENSE-2.0
112SN/A
122SN/A  Unless required by applicable law or agreed to in writing, software
132SN/A  distributed under the License is distributed on an "AS IS" BASIS,
142SN/A  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152SN/A  implied.  See the License for the specific language governing
162SN/A  permissions and limitations under the License.
172SN/A
182SN/A *****************************************************************************/
192SN/A
202SN/A/*****************************************************************************
212SN/A
222SN/A  fx_fixed_limits.cpp --
232SN/A
242SN/A  Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
252SN/A
262SN/A *****************************************************************************/
272665Ssaidi@eecs.umich.edu
282665Ssaidi@eecs.umich.edu/*****************************************************************************
292665Ssaidi@eecs.umich.edu
302SN/A  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
312SN/A  changes you are making here.
325569Snate@binkert.org
335569Snate@binkert.org      Name, Affiliation, Date:
342SN/A  Description of Modification:
355569Snate@binkert.org
367678Sgblack@eecs.umich.edu *****************************************************************************/
373614Sgblack@eecs.umich.edu
383614Sgblack@eecs.umich.edu// This may look like C code, but it is really -*- C++ -*-
392166SN/A//
402147SN/A// fx_fixed<8, 5>_limits.cxx --
415569Snate@binkert.org// Copyright Synopsys 1998
422167SN/A// Author          : Ric Hilderink
4311294Sandreas.hansson@arm.com// Created On      : Fri Jan  8 14:30:41 1999
442090SN/A// Status          : none
452222SN/A//
462090SN/A
472201SN/A
482201SN/A#include <limits.h>
492201SN/A#include <math.h>
502112SN/A#define SC_INCLUDE_FX
5110474Sandreas.hansson@arm.com#include "systemc.h"
5210417Sandreas.hansson@arm.com
5310417Sandreas.hansson@arm.com#define SHOW(a) out << #a << " : " << a.to_string(SC_HEX) << "\n"
542175SN/A#define SHOW_EXP(a) { res = a; out << #a << " : " << res.to_string(SC_HEX) << "\n"; }
552222SN/A
562SN/A
572SN/A#define SHOW_EXPRS(a, b) \
582203SN/A  SHOW_EXP(a b zero_min);   \
592166SN/A  SHOW_EXP(a b zero_plus);  \
602166SN/A  SHOW_EXP(a b zero);       \
612203SN/A  SHOW_EXP(a b long_max);   \
622166SN/A  SHOW_EXP(a b long_min);   \
632222SN/A  SHOW_EXP(a b int_max);    \
645569Snate@binkert.org  SHOW_EXP(a b int_min);    \
652166SN/A  SHOW_EXP(a b uint_max);   \
664695Sgblack@eecs.umich.edu  SHOW_EXP(a b ulong_max);  \
672166SN/A  SHOW_EXP(a b double_min); \
682222SN/A  SHOW_EXP(a b double_max); \
692166SN/A  SHOW_EXP(a b float_min);  \
702166SN/A  SHOW_EXP(a b float_max);
712203SN/A
722166SN/A#define SHOW_EXPS(a) \
732166SN/A  SHOW_EXPRS(a, /) \
742203SN/A  SHOW_EXPRS(a, *) \
752166SN/A  SHOW_EXPRS(a, +) \
762222SN/A  SHOW_EXPRS(a, -) \
775569Snate@binkert.org  SHOW_EXPRS(a, * a *)
782166SN/A
794695Sgblack@eecs.umich.edu
802166SN/A  extern void test_fx_fixed_limits_zero(ostream&);
812222SN/A  extern void test_fx_fixed_limits_inf(ostream&);
824695Sgblack@eecs.umich.edu  extern void test_fx_fixed_limits_long(ostream&);
832166SN/A  extern void test_fx_fixed_limits_double(ostream&);
842166SN/A
852147SN/Avoid test_fx_fixed_limits(ostream& out)
862090SN/A{
872147SN/A  out << "****************** limits fx_fixed<8, 5>\n";
882147SN/A
892147SN/A  test_fx_fixed_limits_zero(out);
902222SN/A  test_fx_fixed_limits_inf(out);
915569Snate@binkert.org  test_fx_fixed_limits_long(out);
922112SN/A  test_fx_fixed_limits_double(out);
934695Sgblack@eecs.umich.edu}
942147SN/A