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

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

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

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

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

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

105sc_core::sc_vpool<sc_signed_bitref> sc_signed_bitref::m_pool(9);
106sc_core::sc_vpool<sc_signed_subref> sc_signed_subref::m_pool(9);
107
108void
109sc_signed::invalid_init(const char *type_name, int nb) const
110{
111 std::stringstream msg;
112 msg << "sc_signed("<< type_name << ") : nb = " << nb << " is not valid";
86#include "systemc/ext/dt/int/sc_int_base.hh"
87#include "systemc/ext/dt/int/sc_signed.hh"
88#include "systemc/ext/dt/int/sc_uint_base.hh"
89#include "systemc/ext/dt/int/sc_unsigned.hh"
90#include "systemc/ext/dt/misc/sc_concatref.hh"
91
92// explicit template instantiations
93namespace sc_core

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

106sc_core::sc_vpool<sc_signed_bitref> sc_signed_bitref::m_pool(9);
107sc_core::sc_vpool<sc_signed_subref> sc_signed_subref::m_pool(9);
108
109void
110sc_signed::invalid_init(const char *type_name, int nb) const
111{
112 std::stringstream msg;
113 msg << "sc_signed("<< type_name << ") : nb = " << nb << " is not valid";
113 SC_REPORT_ERROR("initialization failed", msg.str().c_str());
114 SC_REPORT_ERROR(sc_core::SC_ID_INIT_FAILED_, msg.str().c_str());
114}
115
116// ----------------------------------------------------------------------------
117// SECTION: Public members - Invalid selections.
118// ----------------------------------------------------------------------------
119
120void
121sc_signed::invalid_index(int i) const

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

435// ----------------------------------------------------------------------------
436
437// assignment operators
438
439const sc_signed &
440sc_signed::operator = (const char *a)
441{
442 if (a == 0) {
115}
116
117// ----------------------------------------------------------------------------
118// SECTION: Public members - Invalid selections.
119// ----------------------------------------------------------------------------
120
121void
122sc_signed::invalid_index(int i) const

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

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

--- 3519 unchanged lines hidden ---
457 }
458 return *this;
459}
460
461const sc_signed &
462sc_signed::operator=(int64 v)
463{
464 sgn = get_sign(v);

--- 3519 unchanged lines hidden ---