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 --- 78 unchanged lines hidden (view full) --- 87// to avoid code bloat in sc_int_concref<T1,T2> 88 89void 90sc_int_concref_invalid_length(int length) 91{ 92 std::stringstream msg; 93 msg << "sc_int_concref<T1,T2> initialization: length = " << length << 94 "violates 1 <= length <= " << SC_INTWIDTH; |
95 SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str()); |
96 sc_core::sc_abort(); // can't recover from here 97} 98 99 100// ---------------------------------------------------------------------------- 101// CLASS : sc_int_bitref 102// 103// Proxy class for sc_int bit selection (r-value and l-value). --- 252 unchanged lines hidden (view full) --- 356 357// support methods 358void 359sc_int_base::invalid_length() const 360{ 361 std::stringstream msg; 362 msg << "sc_int[_base] initialization: length = " << m_len << 363 " violates 1 <= length <= " << SC_INTWIDTH; |
364 SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str()); |
365 sc_core::sc_abort(); // can't recover from here 366} 367 368void 369sc_int_base::invalid_index(int i) const 370{ 371 std::stringstream msg; 372 msg << "sc_int[_base] bit selection: index = " << i << 373 " violates 0 <= index <= " << (m_len - 1); |
374 SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str()); |
375 sc_core::sc_abort(); // can't recover from here 376} 377 378void 379sc_int_base::invalid_range(int l, int r) const 380{ 381 std::stringstream msg; 382 msg << "sc_int[_base] part selection: " << 383 "left = " << l << ", right = " << r << " violates " << 384 (m_len-1) << " >= left >= right >= 0"; |
385 SC_REPORT_ERROR("(E5) out of bounds", msg.str().c_str()); |
386 sc_core::sc_abort(); // can't recover from here 387} 388 389void 390sc_int_base::check_value() const 391{ 392 int_type limit = (int_type)1 << (m_len - 1); 393 if (m_val < -limit || m_val >= limit) { 394 std::stringstream msg; 395 msg << "sc_int[_base]: value does not fit into a length of " << m_len; |
396 SC_REPORT_WARNING("(E5) out of bounds", msg.str().c_str()); |
397 } 398} 399 400 401// constructors 402sc_int_base::sc_int_base(const sc_bv_base &v) : 403 m_val(0), m_len(v.length()), m_ulen(SC_INTWIDTH - m_len) 404{ --- 302 unchanged lines hidden --- |