sc_unsigned.cc (13322:7391057615bd) sc_unsigned.cc (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

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

79#include <cctype>
80#include <cmath>
81#include <sstream>
82
83#include "systemc/ext/dt/bit/sc_bv_base.hh"
84#include "systemc/ext/dt/bit/sc_lv_base.hh"
85#include "systemc/ext/dt/fx/sc_ufix.hh"
86#include "systemc/ext/dt/fx/scfx_other_defs.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

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

79#include <cctype>
80#include <cmath>
81#include <sstream>
82
83#include "systemc/ext/dt/bit/sc_bv_base.hh"
84#include "systemc/ext/dt/bit/sc_lv_base.hh"
85#include "systemc/ext/dt/fx/sc_ufix.hh"
86#include "systemc/ext/dt/fx/scfx_other_defs.hh"
87#include "systemc/ext/dt/int/messages.hh"
87#include "systemc/ext/dt/int/sc_int_base.hh"
88#include "systemc/ext/dt/int/sc_signed.hh"
89#include "systemc/ext/dt/int/sc_uint_base.hh"
90#include "systemc/ext/dt/int/sc_unsigned.hh"
91#include "systemc/ext/dt/misc/sc_concatref.hh"
92#include "systemc/ext/utils/messages.hh"
93
94// explicit template instantiations

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

113sc_core::sc_vpool<sc_unsigned_subref> sc_unsigned_subref::m_pool(9);
114
115
116void
117sc_unsigned::invalid_init(const char *type_name, int nb) const
118{
119 std::stringstream msg;
120 msg << "sc_unsigned("<< type_name << ") : nb = " << nb << " is not valid";
88#include "systemc/ext/dt/int/sc_int_base.hh"
89#include "systemc/ext/dt/int/sc_signed.hh"
90#include "systemc/ext/dt/int/sc_uint_base.hh"
91#include "systemc/ext/dt/int/sc_unsigned.hh"
92#include "systemc/ext/dt/misc/sc_concatref.hh"
93#include "systemc/ext/utils/messages.hh"
94
95// explicit template instantiations

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

114sc_core::sc_vpool<sc_unsigned_subref> sc_unsigned_subref::m_pool(9);
115
116
117void
118sc_unsigned::invalid_init(const char *type_name, int nb) const
119{
120 std::stringstream msg;
121 msg << "sc_unsigned("<< type_name << ") : nb = " << nb << " is not valid";
121 SC_REPORT_ERROR("initialization failed", msg.str().c_str());
122 SC_REPORT_ERROR(sc_core::SC_ID_INIT_FAILED_, msg.str().c_str());
122}
123
124
125// ----------------------------------------------------------------------------
126// SECTION: Public members - Invalid selections.
127// ----------------------------------------------------------------------------
128
129void

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

433// SECTION: Public members - Assignment operators.
434// ----------------------------------------------------------------------------
435
436// assignment operators
437const sc_unsigned &
438sc_unsigned::operator = (const char *a)
439{
440 if (a == 0) {
123}
124
125
126// ----------------------------------------------------------------------------
127// SECTION: Public members - Invalid selections.
128// ----------------------------------------------------------------------------
129
130void

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

434// SECTION: Public members - Assignment operators.
435// ----------------------------------------------------------------------------
436
437// assignment operators
438const sc_unsigned &
439sc_unsigned::operator = (const char *a)
440{
441 if (a == 0) {
441 SC_REPORT_ERROR("conversion failed",
442 SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
442 "character string is zero");
443 } else if (*a == 0) {
443 "character string is zero");
444 } else if (*a == 0) {
444 SC_REPORT_ERROR("conversion failed",
445 SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_,
445 "character string is empty");
446 } else try {
447 int len = length();
448 sc_ufix aa(a, len, len, SC_TRN, SC_WRAP, 0, SC_ON);
449 return this->operator = (aa);
450 } catch(const sc_core::sc_report &) {
451 std::stringstream msg;
452 msg << "character string '" << a << "' is not valid";
446 "character string is empty");
447 } else try {
448 int len = length();
449 sc_ufix aa(a, len, len, SC_TRN, SC_WRAP, 0, SC_ON);
450 return this->operator = (aa);
451 } catch(const sc_core::sc_report &) {
452 std::stringstream msg;
453 msg << "character string '" << a << "' is not valid";
453 SC_REPORT_ERROR("conversion failed", msg.str().c_str());
454 SC_REPORT_ERROR(sc_core::SC_ID_CONVERSION_FAILED_, msg.str().c_str());
454 }
455 return *this;
456}
457
458const sc_unsigned &
459sc_unsigned::operator = (int64 v)
460{
461 sgn = get_sign(v);

--- 1799 unchanged lines hidden ---
455 }
456 return *this;
457}
458
459const sc_unsigned &
460sc_unsigned::operator = (int64 v)
461{
462 sgn = get_sign(v);

--- 1799 unchanged lines hidden ---