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 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 15 implied. See the License for the specific language governing 16 permissions and limitations under the License. 17 18 *****************************************************************************/ 19 20/***************************************************************************** 21 22 sc_nbdefs.h -- Top level header file for arbitrary precision signed/unsigned 23 arithmetic. This file defines all the constants needed. 24 25 Original Author: Ali Dasdan, Synopsys, Inc. 26 27 *****************************************************************************/ 28 29/***************************************************************************** 30 31 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 32 changes you are making here. 33 34 Name, Affiliation, Date: 35 Description of Modification: 36 37 *****************************************************************************/ 38 39 40// $Log: sc_nbdefs.cpp,v $ 41// Revision 1.3 2011/02/18 20:19:15 acg 42// Andy Goodrich: updating Copyright notice. 43// 44// Revision 1.2 2009/05/22 16:06:29 acg 45// Andy Goodrich: process control updates. 46// 47// Revision 1.1.1.1 2006/12/15 20:20:05 acg 48// SystemC 2.3 49// 50// Revision 1.3 2006/01/13 18:49:32 acg 51// Added $Log command so that CVS check in comments are reproduced in the 52// source. 53// 54 55#include "sysc/datatypes/int/sc_nbdefs.h" 56 57 58namespace sc_dt 59{ 60 61#ifdef SC_MAX_NBITS 62const int MAX_NDIGITS = DIV_CEIL(SC_MAX_NBITS) + 2; 63// Consider a number with x bits another with y bits. The maximum 64// number of bits happens when we multiply them. The result will have 65// (x + y) bits. Assume that x + y <= SC_MAX_NBITS. Then, DIV_CEIL(x) + 66// DIV_CEIL(y) <= DIV_CEIL(SC_MAX_NBITS) + 2. This is the reason for +2 67// above. With this change, MAX_NDIGITS must be enough to hold the 68// result of any operation. 69#endif 70 71// Support for the long long type. This type is not in the standard 72// but is usually supported by compilers. 73#if !defined(_WIN32) || defined(__MINGW32__) 74const uint64 UINT64_ZERO = 0ULL; 75const uint64 UINT64_ONE = 1ULL; 76const uint64 UINT64_32ONES = 0x00000000ffffffffULL; 77#else 78const uint64 UINT64_ZERO = 0i64; 79const uint64 UINT64_ONE = 1i64; 80const uint64 UINT64_32ONES = 0x00000000ffffffffi64; 81#endif 82 83const small_type NB_DEFAULT_BASE = SC_DEC; 84 85#ifndef _32BIT_ 86const uint64 UINT_ZERO = UINT64_ZERO; 87const uint64 UINT_ONE = UINT64_ONE; 88#else 89const unsigned int UINT_ZERO = 0U; 90const unsigned int UINT_ONE = 1U; 91#endif 92 93} // namespace sc_dt 94