112027Sjungma@eit.uni-kl.de/*****************************************************************************
212027Sjungma@eit.uni-kl.de
312027Sjungma@eit.uni-kl.de  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
412027Sjungma@eit.uni-kl.de  more contributor license agreements.  See the NOTICE file distributed
512027Sjungma@eit.uni-kl.de  with this work for additional information regarding copyright ownership.
612027Sjungma@eit.uni-kl.de  Accellera licenses this file to you under the Apache License, Version 2.0
712027Sjungma@eit.uni-kl.de  (the "License"); you may not use this file except in compliance with the
812027Sjungma@eit.uni-kl.de  License.  You may obtain a copy of the License at
912027Sjungma@eit.uni-kl.de
1012027Sjungma@eit.uni-kl.de    http://www.apache.org/licenses/LICENSE-2.0
1112027Sjungma@eit.uni-kl.de
1212027Sjungma@eit.uni-kl.de  Unless required by applicable law or agreed to in writing, software
1312027Sjungma@eit.uni-kl.de  distributed under the License is distributed on an "AS IS" BASIS,
1412027Sjungma@eit.uni-kl.de  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1512027Sjungma@eit.uni-kl.de  implied.  See the License for the specific language governing
1612027Sjungma@eit.uni-kl.de  permissions and limitations under the License.
1712027Sjungma@eit.uni-kl.de
1812027Sjungma@eit.uni-kl.de *****************************************************************************/
1912027Sjungma@eit.uni-kl.de
2012027Sjungma@eit.uni-kl.de/*****************************************************************************
2112027Sjungma@eit.uni-kl.de
2212027Sjungma@eit.uni-kl.de  sc_nbdefs.h -- Top level header file for arbitrary precision signed/unsigned
2312027Sjungma@eit.uni-kl.de                 arithmetic. This file defines all the constants needed.
2412027Sjungma@eit.uni-kl.de
2512027Sjungma@eit.uni-kl.de  Original Author: Ali Dasdan, Synopsys, Inc.
2612027Sjungma@eit.uni-kl.de
2712027Sjungma@eit.uni-kl.de *****************************************************************************/
2812027Sjungma@eit.uni-kl.de
2912027Sjungma@eit.uni-kl.de/*****************************************************************************
3012027Sjungma@eit.uni-kl.de
3112027Sjungma@eit.uni-kl.de  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
3212027Sjungma@eit.uni-kl.de  changes you are making here.
3312027Sjungma@eit.uni-kl.de
3412027Sjungma@eit.uni-kl.de      Name, Affiliation, Date:
3512027Sjungma@eit.uni-kl.de  Description of Modification:
3612027Sjungma@eit.uni-kl.de
3712027Sjungma@eit.uni-kl.de *****************************************************************************/
3812027Sjungma@eit.uni-kl.de
3912027Sjungma@eit.uni-kl.de
4012027Sjungma@eit.uni-kl.de// $Log: sc_nbdefs.cpp,v $
4112027Sjungma@eit.uni-kl.de// Revision 1.3  2011/02/18 20:19:15  acg
4212027Sjungma@eit.uni-kl.de//  Andy Goodrich: updating Copyright notice.
4312027Sjungma@eit.uni-kl.de//
4412027Sjungma@eit.uni-kl.de// Revision 1.2  2009/05/22 16:06:29  acg
4512027Sjungma@eit.uni-kl.de//  Andy Goodrich: process control updates.
4612027Sjungma@eit.uni-kl.de//
4712027Sjungma@eit.uni-kl.de// Revision 1.1.1.1  2006/12/15 20:20:05  acg
4812027Sjungma@eit.uni-kl.de// SystemC 2.3
4912027Sjungma@eit.uni-kl.de//
5012027Sjungma@eit.uni-kl.de// Revision 1.3  2006/01/13 18:49:32  acg
5112027Sjungma@eit.uni-kl.de// Added $Log command so that CVS check in comments are reproduced in the
5212027Sjungma@eit.uni-kl.de// source.
5312027Sjungma@eit.uni-kl.de//
5412027Sjungma@eit.uni-kl.de
5512027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_nbdefs.h"
5612027Sjungma@eit.uni-kl.de
5712027Sjungma@eit.uni-kl.de
5812027Sjungma@eit.uni-kl.denamespace sc_dt
5912027Sjungma@eit.uni-kl.de{
6012027Sjungma@eit.uni-kl.de
6112027Sjungma@eit.uni-kl.de#ifdef SC_MAX_NBITS
6212027Sjungma@eit.uni-kl.deconst int MAX_NDIGITS      = DIV_CEIL(SC_MAX_NBITS) + 2;
6312027Sjungma@eit.uni-kl.de// Consider a number with x bits another with y bits. The maximum
6412027Sjungma@eit.uni-kl.de// number of bits happens when we multiply them. The result will have
6512027Sjungma@eit.uni-kl.de// (x + y) bits. Assume that x + y <= SC_MAX_NBITS. Then, DIV_CEIL(x) +
6612027Sjungma@eit.uni-kl.de// DIV_CEIL(y) <= DIV_CEIL(SC_MAX_NBITS) + 2. This is the reason for +2
6712027Sjungma@eit.uni-kl.de// above. With this change, MAX_NDIGITS must be enough to hold the
6812027Sjungma@eit.uni-kl.de// result of any operation.
6912027Sjungma@eit.uni-kl.de#endif
7012027Sjungma@eit.uni-kl.de
7112027Sjungma@eit.uni-kl.de// Support for the long long type. This type is not in the standard
7212027Sjungma@eit.uni-kl.de// but is usually supported by compilers.
7312027Sjungma@eit.uni-kl.de#if !defined(_WIN32) || defined(__MINGW32__)
7412027Sjungma@eit.uni-kl.deconst uint64 UINT64_ZERO   = 0ULL;
7512027Sjungma@eit.uni-kl.deconst uint64 UINT64_ONE    = 1ULL;
7612027Sjungma@eit.uni-kl.deconst uint64 UINT64_32ONES = 0x00000000ffffffffULL;
7712027Sjungma@eit.uni-kl.de#else
7812027Sjungma@eit.uni-kl.deconst uint64 UINT64_ZERO   = 0i64;
7912027Sjungma@eit.uni-kl.deconst uint64 UINT64_ONE    = 1i64;
8012027Sjungma@eit.uni-kl.deconst uint64 UINT64_32ONES = 0x00000000ffffffffi64;
8112027Sjungma@eit.uni-kl.de#endif
8212027Sjungma@eit.uni-kl.de
8312027Sjungma@eit.uni-kl.deconst small_type NB_DEFAULT_BASE = SC_DEC;
8412027Sjungma@eit.uni-kl.de
8512027Sjungma@eit.uni-kl.de#ifndef _32BIT_
8612027Sjungma@eit.uni-kl.deconst uint64 UINT_ZERO = UINT64_ZERO;
8712027Sjungma@eit.uni-kl.deconst uint64 UINT_ONE  = UINT64_ONE;
8812027Sjungma@eit.uni-kl.de#else
8912027Sjungma@eit.uni-kl.deconst unsigned int UINT_ZERO = 0U;
9012027Sjungma@eit.uni-kl.deconst unsigned int UINT_ONE  = 1U;
9112027Sjungma@eit.uni-kl.de#endif
9212027Sjungma@eit.uni-kl.de
9312027Sjungma@eit.uni-kl.de} // namespace sc_dt
94