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 --- 57 unchanged lines hidden (view full) --- 66#include "systemc/ext/dt/bit/sc_lv_base.hh" 67#include "systemc/ext/dt/fx/sc_fix.hh" 68#include "systemc/ext/dt/fx/scfx_other_defs.hh" 69#include "systemc/ext/dt/int/sc_int_base.hh" 70#include "systemc/ext/dt/int/sc_signed.hh" 71#include "systemc/ext/dt/int/sc_uint_base.hh" 72#include "systemc/ext/dt/int/sc_unsigned.hh" 73#include "systemc/ext/dt/misc/sc_concatref.hh" |
74#include "systemc/ext/utils/messages.hh" |
75 76// explicit template instantiations 77namespace sc_core 78{ 79 80template class sc_vpool<sc_dt::sc_int_bitref>; 81template class sc_vpool<sc_dt::sc_int_subref>; 82 --- 5 unchanged lines hidden (view full) --- 88// to avoid code bloat in sc_int_concref<T1,T2> 89 90void 91sc_int_concref_invalid_length(int length) 92{ 93 std::stringstream msg; 94 msg << "sc_int_concref<T1,T2> initialization: length = " << length << 95 "violates 1 <= length <= " << SC_INTWIDTH; |
96 SC_REPORT_ERROR(sc_core::SC_ID_OUT_OF_BOUNDS_, msg.str().c_str()); |
97 sc_core::sc_abort(); // can't recover from here 98} 99 100 101// ---------------------------------------------------------------------------- 102// CLASS : sc_int_bitref 103// 104// Proxy class for sc_int bit selection (r-value and l-value). --- 252 unchanged lines hidden (view full) --- 357 358// support methods 359void 360sc_int_base::invalid_length() const 361{ 362 std::stringstream msg; 363 msg << "sc_int[_base] initialization: length = " << m_len << 364 " violates 1 <= length <= " << SC_INTWIDTH; |
365 SC_REPORT_ERROR(sc_core::SC_ID_OUT_OF_BOUNDS_, msg.str().c_str()); |
366 sc_core::sc_abort(); // can't recover from here 367} 368 369void 370sc_int_base::invalid_index(int i) const 371{ 372 std::stringstream msg; 373 msg << "sc_int[_base] bit selection: index = " << i << 374 " violates 0 <= index <= " << (m_len - 1); |
375 SC_REPORT_ERROR(sc_core::SC_ID_OUT_OF_BOUNDS_, msg.str().c_str()); |
376 sc_core::sc_abort(); // can't recover from here 377} 378 379void 380sc_int_base::invalid_range(int l, int r) const 381{ 382 std::stringstream msg; 383 msg << "sc_int[_base] part selection: " << 384 "left = " << l << ", right = " << r << " violates " << 385 (m_len-1) << " >= left >= right >= 0"; |
386 SC_REPORT_ERROR(sc_core::SC_ID_OUT_OF_BOUNDS_, msg.str().c_str()); |
387 sc_core::sc_abort(); // can't recover from here 388} 389 390void 391sc_int_base::check_value() const 392{ 393 int_type limit = (int_type)1 << (m_len - 1); 394 if (m_val < -limit || m_val >= limit) { 395 std::stringstream msg; 396 msg << "sc_int[_base]: value does not fit into a length of " << m_len; |
397 SC_REPORT_WARNING(sc_core::SC_ID_OUT_OF_BOUNDS_, msg.str().c_str()); |
398 } 399} 400 401 402// constructors 403sc_int_base::sc_int_base(const sc_bv_base &v) : 404 m_val(0), m_len(v.length()), m_ulen(SC_INTWIDTH - m_len) 405{ --- 302 unchanged lines hidden --- |