sc_nbutils.hh (13160:1e959d3afc64) sc_nbutils.hh (13325:86323e6cc8ec)
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

--- 55 unchanged lines hidden (view full) ---

64#define __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
65
66#include <cmath>
67#include <ios>
68#include <limits>
69#include <ostream>
70
71#include "../../utils/sc_report_handler.hh"
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

--- 55 unchanged lines hidden (view full) ---

64#define __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
65
66#include <cmath>
67#include <ios>
68#include <limits>
69#include <ostream>
70
71#include "../../utils/sc_report_handler.hh"
72#include "../bit/messages.hh"
73#include "messages.hh"
72#include "sc_nbdefs.hh"
73
74namespace sc_dt
75{
76
77//-----------------------------------------------------------------------------
78//"sc_io_base"
79//

--- 435 unchanged lines hidden (view full) ---

515
516#endif
517
518template<class Type>
519inline void
520div_by_zero(Type s)
521{
522 if (s == 0) {
74#include "sc_nbdefs.hh"
75
76namespace sc_dt
77{
78
79//-----------------------------------------------------------------------------
80//"sc_io_base"
81//

--- 435 unchanged lines hidden (view full) ---

517
518#endif
519
520template<class Type>
521inline void
522div_by_zero(Type s)
523{
524 if (s == 0) {
523 SC_REPORT_ERROR("operation failed",
525 SC_REPORT_ERROR(sc_core::SC_ID_OPERATION_FAILED_,
524 "div_by_zero<Type>(Type) : division by zero");
525 sc_core::sc_abort(); // can't recover from here
526 }
527}
528
529
530// ----------------------------------------------------------------------------
531// Functions to check if a given vector is zero or make one.

--- 285 unchanged lines hidden (view full) ---

817 v == -std::numeric_limits<double>::infinity();
818}
819
820inline void
821is_bad_double(double v)
822{
823 // Windows throws exception.
824 if (is_nan(v) || is_inf(v))
526 "div_by_zero<Type>(Type) : division by zero");
527 sc_core::sc_abort(); // can't recover from here
528 }
529}
530
531
532// ----------------------------------------------------------------------------
533// Functions to check if a given vector is zero or make one.

--- 285 unchanged lines hidden (view full) ---

819 v == -std::numeric_limits<double>::infinity();
820}
821
822inline void
823is_bad_double(double v)
824{
825 // Windows throws exception.
826 if (is_nan(v) || is_inf(v))
825 SC_REPORT_ERROR("(E204) value is not valid",
827 SC_REPORT_ERROR(sc_core::SC_ID_VALUE_NOT_VALID_,
826 "is_bad_double(double v) : "
827 "v is not finite - NaN or Inf");
828}
829
830} // namespace sc_dt
831
832#endif // __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__
828 "is_bad_double(double v) : "
829 "v is not finite - NaN or Inf");
830}
831
832} // namespace sc_dt
833
834#endif // __SYSTEMC_EXT_DT_INT_SC_NBUTILS_HH__