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_unsigned.h -- Arbitrary precision unsigned arithmetic. 2312027Sjungma@eit.uni-kl.de 2412027Sjungma@eit.uni-kl.de This file includes the definitions of sc_unsigned_bitref, 2512027Sjungma@eit.uni-kl.de sc_unsigned_subref, and sc_unsigned classes. The first two classes 2612027Sjungma@eit.uni-kl.de are proxy classes to reference one bit and a range of bits of a 2712027Sjungma@eit.uni-kl.de sc_unsigned number, respectively. 2812027Sjungma@eit.uni-kl.de 2912027Sjungma@eit.uni-kl.de An sc_signed number has the sign-magnitude representation 3012027Sjungma@eit.uni-kl.de internally. However, its interface guarantees a 2's-complement 3112027Sjungma@eit.uni-kl.de representation. The sign-magnitude representation is chosen 3212027Sjungma@eit.uni-kl.de because of its efficiency: The sc_signed and sc_unsigned types are 3312027Sjungma@eit.uni-kl.de optimized for arithmetic rather than bitwise operations. For 3412027Sjungma@eit.uni-kl.de arithmetic operations, the sign-magnitude representation performs 3512027Sjungma@eit.uni-kl.de better. 3612027Sjungma@eit.uni-kl.de 3712027Sjungma@eit.uni-kl.de It is also important to note that an sc_unsigned number with n 3812027Sjungma@eit.uni-kl.de bits is equivalent to an sc_signed non-negative number with n + 1 3912027Sjungma@eit.uni-kl.de bits. 4012027Sjungma@eit.uni-kl.de 4112027Sjungma@eit.uni-kl.de The implementations of sc_signed and sc_unsigned classes are 4212027Sjungma@eit.uni-kl.de almost identical: Most of the member and friend functions are 4312027Sjungma@eit.uni-kl.de defined in sc_nbcommon.cpp and sc_nbfriends.cpp so that they can 4412027Sjungma@eit.uni-kl.de be shared by both of these classes. These functions are chosed by 4512027Sjungma@eit.uni-kl.de defining a few macros before including them such as IF_SC_SIGNED 4612027Sjungma@eit.uni-kl.de and CLASS_TYPE. Our implementation choices are mostly dictated by 4712027Sjungma@eit.uni-kl.de performance considerations in that we tried to provide the most 4812027Sjungma@eit.uni-kl.de efficient sc_signed and sc_unsigned types without compromising 4912027Sjungma@eit.uni-kl.de their interface. 5012027Sjungma@eit.uni-kl.de 5112027Sjungma@eit.uni-kl.de For the behavior of operators, we have two semantics: the old and 5212027Sjungma@eit.uni-kl.de new. The most important difference between these two semantics is 5312027Sjungma@eit.uni-kl.de that the old semantics is closer to C/C++ semantics in that the 5412027Sjungma@eit.uni-kl.de result type of a binary operator on unsigned and signed arguments 5512027Sjungma@eit.uni-kl.de is unsigned; the new semantics, on the other hand, requires the 5612027Sjungma@eit.uni-kl.de result type be signed. The new semantics is required by the VSIA 5712027Sjungma@eit.uni-kl.de C/C++ data types standard. We have implemented the new semantics. 5812027Sjungma@eit.uni-kl.de 5912027Sjungma@eit.uni-kl.de Original Author: Ali Dasdan, Synopsys, Inc. 6012027Sjungma@eit.uni-kl.de 6112027Sjungma@eit.uni-kl.de *****************************************************************************/ 6212027Sjungma@eit.uni-kl.de 6312027Sjungma@eit.uni-kl.de/***************************************************************************** 6412027Sjungma@eit.uni-kl.de 6512027Sjungma@eit.uni-kl.de MODIFICATION LOG - modifiers, enter your name, affiliation, date and 6612027Sjungma@eit.uni-kl.de changes you are making here. 6712027Sjungma@eit.uni-kl.de 6812027Sjungma@eit.uni-kl.de Name, Affiliation, Date: 6912027Sjungma@eit.uni-kl.de Description of Modification: 7012027Sjungma@eit.uni-kl.de 7112027Sjungma@eit.uni-kl.de *****************************************************************************/ 7212027Sjungma@eit.uni-kl.de 7312027Sjungma@eit.uni-kl.de// $Log: sc_unsigned.h,v $ 7412027Sjungma@eit.uni-kl.de// Revision 1.4 2011/08/24 22:05:46 acg 7512027Sjungma@eit.uni-kl.de// Torsten Maehne: initialization changes to remove warnings. 7612027Sjungma@eit.uni-kl.de// 7712027Sjungma@eit.uni-kl.de// Revision 1.3 2011/02/18 20:19:15 acg 7812027Sjungma@eit.uni-kl.de// Andy Goodrich: updating Copyright notice. 7912027Sjungma@eit.uni-kl.de// 8012027Sjungma@eit.uni-kl.de// Revision 1.2 2009/02/28 00:26:26 acg 8112027Sjungma@eit.uni-kl.de// Andy Goodrich: bug fixes. 8212027Sjungma@eit.uni-kl.de// 8312027Sjungma@eit.uni-kl.de// Revision 1.1.1.1 2006/12/15 20:20:05 acg 8412027Sjungma@eit.uni-kl.de// SystemC 2.3 8512027Sjungma@eit.uni-kl.de// 8612027Sjungma@eit.uni-kl.de// Revision 1.5 2006/05/08 17:50:02 acg 8712027Sjungma@eit.uni-kl.de// Andy Goodrich: Added David Long's declarations for friend operators, 8812027Sjungma@eit.uni-kl.de// functions, and methods, to keep the Microsoft compiler happy. 8912027Sjungma@eit.uni-kl.de// 9012027Sjungma@eit.uni-kl.de// Revision 1.4 2006/03/13 20:25:27 acg 9112027Sjungma@eit.uni-kl.de// Andy Goodrich: Addition of function declarations, e.g., xor_signed_friend() 9212027Sjungma@eit.uni-kl.de// to keep gcc 4.x happy. 9312027Sjungma@eit.uni-kl.de// 9412027Sjungma@eit.uni-kl.de// Revision 1.3 2006/01/13 18:49:32 acg 9512027Sjungma@eit.uni-kl.de// Added $Log command so that CVS check in comments are reproduced in the 9612027Sjungma@eit.uni-kl.de// source. 9712027Sjungma@eit.uni-kl.de// 9812027Sjungma@eit.uni-kl.de 9912027Sjungma@eit.uni-kl.de#ifndef SC_UNSIGNED_H 10012027Sjungma@eit.uni-kl.de#define SC_UNSIGNED_H 10112027Sjungma@eit.uni-kl.de 10212027Sjungma@eit.uni-kl.de 10312027Sjungma@eit.uni-kl.de#include "sysc/kernel/sc_object.h" 10412027Sjungma@eit.uni-kl.de#include "sysc/datatypes/misc/sc_value_base.h" 10512027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_iostream.h" 10612027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_temporary.h" 10712027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_length_param.h" 10812027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_nbdefs.h" 10912027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_nbutils.h" 11012027Sjungma@eit.uni-kl.de#include "sysc/datatypes/int/sc_nbexterns.h" 11112027Sjungma@eit.uni-kl.de#include "sysc/utils/sc_temporary.h" 11212027Sjungma@eit.uni-kl.de 11312027Sjungma@eit.uni-kl.de 11412027Sjungma@eit.uni-kl.denamespace sc_dt 11512027Sjungma@eit.uni-kl.de{ 11612027Sjungma@eit.uni-kl.de 11712027Sjungma@eit.uni-kl.de// classes defined in this module 11812027Sjungma@eit.uni-kl.declass sc_unsigned_bitref_r; 11912027Sjungma@eit.uni-kl.declass sc_unsigned_bitref; 12012027Sjungma@eit.uni-kl.declass sc_unsigned_subref_r; 12112027Sjungma@eit.uni-kl.declass sc_unsigned_subref; 12212027Sjungma@eit.uni-kl.declass sc_concatref; 12312027Sjungma@eit.uni-kl.declass sc_unsigned; 12412027Sjungma@eit.uni-kl.de 12512027Sjungma@eit.uni-kl.de// forward class declarations 12612027Sjungma@eit.uni-kl.declass sc_bv_base; 12712027Sjungma@eit.uni-kl.declass sc_lv_base; 12812027Sjungma@eit.uni-kl.declass sc_int_base; 12912027Sjungma@eit.uni-kl.declass sc_uint_base; 13012027Sjungma@eit.uni-kl.declass sc_int_subref_r; 13112027Sjungma@eit.uni-kl.declass sc_uint_subref_r; 13212027Sjungma@eit.uni-kl.declass sc_signed; 13312027Sjungma@eit.uni-kl.declass sc_signed_subref_r; 13412027Sjungma@eit.uni-kl.declass sc_fxval; 13512027Sjungma@eit.uni-kl.declass sc_fxval_fast; 13612027Sjungma@eit.uni-kl.declass sc_fxnum; 13712027Sjungma@eit.uni-kl.declass sc_fxnum_fast; 13812027Sjungma@eit.uni-kl.de 13912027Sjungma@eit.uni-kl.de// Helper function declarions 14012027Sjungma@eit.uni-kl.deint compare_unsigned(small_type us, 14112027Sjungma@eit.uni-kl.de int unb, 14212027Sjungma@eit.uni-kl.de int und, 14312027Sjungma@eit.uni-kl.de const sc_digit *ud, 14412027Sjungma@eit.uni-kl.de small_type vs, 14512027Sjungma@eit.uni-kl.de int vnb, 14612027Sjungma@eit.uni-kl.de int vnd, 14712027Sjungma@eit.uni-kl.de const sc_digit *vd, 14812027Sjungma@eit.uni-kl.de small_type if_u_signed=0, 14912027Sjungma@eit.uni-kl.de small_type if_v_signed=0); 15012027Sjungma@eit.uni-kl.de 15112027Sjungma@eit.uni-kl.desc_unsigned add_unsigned_friend(small_type us, 15212027Sjungma@eit.uni-kl.de int unb, 15312027Sjungma@eit.uni-kl.de int und, 15412027Sjungma@eit.uni-kl.de const sc_digit *ud, 15512027Sjungma@eit.uni-kl.de small_type vs, 15612027Sjungma@eit.uni-kl.de int vnb, 15712027Sjungma@eit.uni-kl.de int vnd, 15812027Sjungma@eit.uni-kl.de const sc_digit *vd); 15912027Sjungma@eit.uni-kl.de 16012027Sjungma@eit.uni-kl.desc_unsigned sub_unsigned_friend(small_type us, 16112027Sjungma@eit.uni-kl.de int unb, 16212027Sjungma@eit.uni-kl.de int und, 16312027Sjungma@eit.uni-kl.de const sc_digit *ud, 16412027Sjungma@eit.uni-kl.de small_type vs, 16512027Sjungma@eit.uni-kl.de int vnb, 16612027Sjungma@eit.uni-kl.de int vnd, 16712027Sjungma@eit.uni-kl.de const sc_digit *vd); 16812027Sjungma@eit.uni-kl.de 16912027Sjungma@eit.uni-kl.desc_unsigned mul_unsigned_friend(small_type s, 17012027Sjungma@eit.uni-kl.de int unb, 17112027Sjungma@eit.uni-kl.de int und, 17212027Sjungma@eit.uni-kl.de const sc_digit *ud, 17312027Sjungma@eit.uni-kl.de int vnb, 17412027Sjungma@eit.uni-kl.de int vnd, 17512027Sjungma@eit.uni-kl.de const sc_digit *vd); 17612027Sjungma@eit.uni-kl.de 17712027Sjungma@eit.uni-kl.desc_unsigned div_unsigned_friend(small_type s, 17812027Sjungma@eit.uni-kl.de int unb, 17912027Sjungma@eit.uni-kl.de int und, 18012027Sjungma@eit.uni-kl.de const sc_digit *ud, 18112027Sjungma@eit.uni-kl.de int vnb, 18212027Sjungma@eit.uni-kl.de int vnd, 18312027Sjungma@eit.uni-kl.de const sc_digit *vd); 18412027Sjungma@eit.uni-kl.de 18512027Sjungma@eit.uni-kl.desc_unsigned mod_unsigned_friend(small_type us, 18612027Sjungma@eit.uni-kl.de int unb, 18712027Sjungma@eit.uni-kl.de int und, 18812027Sjungma@eit.uni-kl.de const sc_digit *ud, 18912027Sjungma@eit.uni-kl.de int vnb, 19012027Sjungma@eit.uni-kl.de int vnd, 19112027Sjungma@eit.uni-kl.de const sc_digit *vd); 19212027Sjungma@eit.uni-kl.de 19312027Sjungma@eit.uni-kl.desc_unsigned and_unsigned_friend(small_type us, 19412027Sjungma@eit.uni-kl.de int unb, 19512027Sjungma@eit.uni-kl.de int und, 19612027Sjungma@eit.uni-kl.de const sc_digit *ud, 19712027Sjungma@eit.uni-kl.de small_type vs, 19812027Sjungma@eit.uni-kl.de int vnb, 19912027Sjungma@eit.uni-kl.de int vnd, 20012027Sjungma@eit.uni-kl.de const sc_digit *vd); 20112027Sjungma@eit.uni-kl.de 20212027Sjungma@eit.uni-kl.de 20312027Sjungma@eit.uni-kl.desc_unsigned or_unsigned_friend(small_type us, 20412027Sjungma@eit.uni-kl.de int unb, 20512027Sjungma@eit.uni-kl.de int und, 20612027Sjungma@eit.uni-kl.de const sc_digit *ud, 20712027Sjungma@eit.uni-kl.de small_type vs, 20812027Sjungma@eit.uni-kl.de int vnb, 20912027Sjungma@eit.uni-kl.de int vnd, 21012027Sjungma@eit.uni-kl.de const sc_digit *vd); 21112027Sjungma@eit.uni-kl.de 21212027Sjungma@eit.uni-kl.desc_unsigned xor_unsigned_friend(small_type us, 21312027Sjungma@eit.uni-kl.de int unb, 21412027Sjungma@eit.uni-kl.de int und, 21512027Sjungma@eit.uni-kl.de const sc_digit *ud, 21612027Sjungma@eit.uni-kl.de small_type vs, 21712027Sjungma@eit.uni-kl.de int vnb, 21812027Sjungma@eit.uni-kl.de int vnd, 21912027Sjungma@eit.uni-kl.de const sc_digit *vd); 22012027Sjungma@eit.uni-kl.de 22112027Sjungma@eit.uni-kl.de// friend operator declarations 22212027Sjungma@eit.uni-kl.de // ARITHMETIC OPERATORS: 22312027Sjungma@eit.uni-kl.de 22412027Sjungma@eit.uni-kl.de // ADDition operators: 22512027Sjungma@eit.uni-kl.de 22612027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_unsigned& u, const sc_signed& v); 22712027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_signed& u, const sc_unsigned& v); 22812027Sjungma@eit.uni-kl.de 22912027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_unsigned& u, const sc_unsigned& v); 23012027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_unsigned& u, int64 v); 23112027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_unsigned& u, uint64 v); 23212027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_unsigned& u, long v); 23312027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_unsigned& u, unsigned long v); 23412027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_unsigned& u, int v); 23512027Sjungma@eit.uni-kl.de inline sc_unsigned operator + (const sc_unsigned& u, unsigned int v); 23612027Sjungma@eit.uni-kl.de 23712027Sjungma@eit.uni-kl.de sc_signed operator + (int64 u, const sc_unsigned& v); 23812027Sjungma@eit.uni-kl.de sc_unsigned operator + (uint64 u, const sc_unsigned& v); 23912027Sjungma@eit.uni-kl.de sc_signed operator + (long u, const sc_unsigned& v); 24012027Sjungma@eit.uni-kl.de sc_unsigned operator + (unsigned long u, const sc_unsigned& v); 24112027Sjungma@eit.uni-kl.de sc_signed operator + (int u, const sc_unsigned& v); 24212027Sjungma@eit.uni-kl.de inline sc_unsigned operator + (unsigned int u, const sc_unsigned& v); 24312027Sjungma@eit.uni-kl.de 24412027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_unsigned& u, const sc_uint_base& v); 24512027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_unsigned& u, const sc_int_base& v); 24612027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_uint_base& u, const sc_unsigned& v); 24712027Sjungma@eit.uni-kl.de sc_signed operator + (const sc_int_base& u, const sc_unsigned& v); 24812027Sjungma@eit.uni-kl.de 24912027Sjungma@eit.uni-kl.de // SUBtraction operators: 25012027Sjungma@eit.uni-kl.de 25112027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, const sc_signed& v); 25212027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_signed& u, const sc_unsigned& v); 25312027Sjungma@eit.uni-kl.de 25412027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, const sc_unsigned& v); 25512027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, int64 v); 25612027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, uint64 v); 25712027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, long v); 25812027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, unsigned long v); 25912027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, int v); 26012027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, unsigned int v); 26112027Sjungma@eit.uni-kl.de 26212027Sjungma@eit.uni-kl.de sc_signed operator - (int64 u, const sc_unsigned& v); 26312027Sjungma@eit.uni-kl.de sc_signed operator - (uint64 u, const sc_unsigned& v); 26412027Sjungma@eit.uni-kl.de sc_signed operator - (long u, const sc_unsigned& v); 26512027Sjungma@eit.uni-kl.de sc_signed operator - (unsigned long u, const sc_unsigned& v); 26612027Sjungma@eit.uni-kl.de sc_signed operator - (int u, const sc_unsigned& v); 26712027Sjungma@eit.uni-kl.de sc_signed operator - (unsigned int u, const sc_unsigned& v); 26812027Sjungma@eit.uni-kl.de 26912027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, const sc_uint_base& v); 27012027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u, const sc_int_base& v); 27112027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_uint_base& u, const sc_unsigned& v); 27212027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_int_base& u, const sc_unsigned& v); 27312027Sjungma@eit.uni-kl.de 27412027Sjungma@eit.uni-kl.de // MULtiplication operators: 27512027Sjungma@eit.uni-kl.de 27612027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_unsigned& u, const sc_signed& v); 27712027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_signed& u, const sc_unsigned& v); 27812027Sjungma@eit.uni-kl.de 27912027Sjungma@eit.uni-kl.de sc_unsigned operator * (const sc_unsigned& u, const sc_unsigned& v); 28012027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_unsigned& u, int64 v); 28112027Sjungma@eit.uni-kl.de sc_unsigned operator * (const sc_unsigned& u, uint64 v); 28212027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_unsigned& u, long v); 28312027Sjungma@eit.uni-kl.de sc_unsigned operator * (const sc_unsigned& u, unsigned long v); 28412027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_unsigned& u, int v); 28512027Sjungma@eit.uni-kl.de inline sc_unsigned operator * (const sc_unsigned& u, unsigned int v); 28612027Sjungma@eit.uni-kl.de 28712027Sjungma@eit.uni-kl.de sc_signed operator * (int64 u, const sc_unsigned& v); 28812027Sjungma@eit.uni-kl.de sc_unsigned operator * (uint64 u, const sc_unsigned& v); 28912027Sjungma@eit.uni-kl.de sc_signed operator * (long u, const sc_unsigned& v); 29012027Sjungma@eit.uni-kl.de sc_unsigned operator * (unsigned long u, const sc_unsigned& v); 29112027Sjungma@eit.uni-kl.de sc_signed operator * (int u, const sc_unsigned& v); 29212027Sjungma@eit.uni-kl.de inline sc_unsigned operator * (unsigned int u, const sc_unsigned& v); 29312027Sjungma@eit.uni-kl.de 29412027Sjungma@eit.uni-kl.de sc_unsigned operator * (const sc_unsigned& u, const sc_uint_base& v); 29512027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_unsigned& u, const sc_int_base& v); 29612027Sjungma@eit.uni-kl.de sc_unsigned operator * (const sc_uint_base& u, const sc_unsigned& v); 29712027Sjungma@eit.uni-kl.de sc_signed operator * (const sc_int_base& u, const sc_unsigned& v); 29812027Sjungma@eit.uni-kl.de 29912027Sjungma@eit.uni-kl.de // DIVision operators: 30012027Sjungma@eit.uni-kl.de 30112027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_unsigned& u, const sc_signed& v); 30212027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_signed& u, const sc_unsigned& v); 30312027Sjungma@eit.uni-kl.de 30412027Sjungma@eit.uni-kl.de sc_unsigned operator / (const sc_unsigned& u, const sc_unsigned& v); 30512027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_unsigned& u, int64 v); 30612027Sjungma@eit.uni-kl.de sc_unsigned operator / (const sc_unsigned& u, uint64 v); 30712027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_unsigned& u, long v); 30812027Sjungma@eit.uni-kl.de sc_unsigned operator / (const sc_unsigned& u, unsigned long v); 30912027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_unsigned& u, int v); 31012027Sjungma@eit.uni-kl.de inline sc_unsigned operator / (const sc_unsigned& u, unsigned int v); 31112027Sjungma@eit.uni-kl.de 31212027Sjungma@eit.uni-kl.de sc_signed operator / (int64 u, const sc_unsigned& v); 31312027Sjungma@eit.uni-kl.de sc_unsigned operator / (uint64 u, const sc_unsigned& v); 31412027Sjungma@eit.uni-kl.de sc_signed operator / (long u, const sc_unsigned& v); 31512027Sjungma@eit.uni-kl.de sc_unsigned operator / (unsigned long u, const sc_unsigned& v); 31612027Sjungma@eit.uni-kl.de sc_signed operator / (int u, const sc_unsigned& v); 31712027Sjungma@eit.uni-kl.de inline sc_unsigned operator / (unsigned int u, const sc_unsigned& v); 31812027Sjungma@eit.uni-kl.de 31912027Sjungma@eit.uni-kl.de sc_unsigned operator / (const sc_unsigned& u, const sc_uint_base& v); 32012027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_unsigned& u, const sc_int_base& v); 32112027Sjungma@eit.uni-kl.de sc_unsigned operator / (const sc_uint_base& u, const sc_unsigned& v); 32212027Sjungma@eit.uni-kl.de sc_signed operator / (const sc_int_base& u, const sc_unsigned& v); 32312027Sjungma@eit.uni-kl.de 32412027Sjungma@eit.uni-kl.de // MODulo operators: 32512027Sjungma@eit.uni-kl.de 32612027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_unsigned& u, const sc_signed& v); 32712027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_signed& u, const sc_unsigned& v); 32812027Sjungma@eit.uni-kl.de 32912027Sjungma@eit.uni-kl.de sc_unsigned operator % (const sc_unsigned& u, const sc_unsigned& v); 33012027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_unsigned& u, int64 v); 33112027Sjungma@eit.uni-kl.de sc_unsigned operator % (const sc_unsigned& u, uint64 v); 33212027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_unsigned& u, long v); 33312027Sjungma@eit.uni-kl.de sc_unsigned operator % (const sc_unsigned& u, unsigned long v); 33412027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_unsigned& u, int v); 33512027Sjungma@eit.uni-kl.de inline sc_unsigned operator % (const sc_unsigned& u, unsigned int v); 33612027Sjungma@eit.uni-kl.de 33712027Sjungma@eit.uni-kl.de sc_signed operator % (int64 u, const sc_unsigned& v); 33812027Sjungma@eit.uni-kl.de sc_unsigned operator % (uint64 u, const sc_unsigned& v); 33912027Sjungma@eit.uni-kl.de sc_signed operator % (long u, const sc_unsigned& v); 34012027Sjungma@eit.uni-kl.de sc_unsigned operator % (unsigned long u, const sc_unsigned& v); 34112027Sjungma@eit.uni-kl.de sc_signed operator % (int u, const sc_unsigned& v); 34212027Sjungma@eit.uni-kl.de inline sc_unsigned operator % (unsigned int u, const sc_unsigned& v); 34312027Sjungma@eit.uni-kl.de 34412027Sjungma@eit.uni-kl.de sc_unsigned operator % (const sc_unsigned& u, const sc_uint_base& v); 34512027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_unsigned& u, const sc_int_base& v); 34612027Sjungma@eit.uni-kl.de sc_unsigned operator % (const sc_uint_base& u, const sc_unsigned& v); 34712027Sjungma@eit.uni-kl.de sc_signed operator % (const sc_int_base& u, const sc_unsigned& v); 34812027Sjungma@eit.uni-kl.de 34912027Sjungma@eit.uni-kl.de // BITWISE OPERATORS: 35012027Sjungma@eit.uni-kl.de 35112027Sjungma@eit.uni-kl.de // Bitwise AND operators: 35212027Sjungma@eit.uni-kl.de 35312027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_unsigned& u, const sc_signed& v); 35412027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_signed& u, const sc_unsigned& v); 35512027Sjungma@eit.uni-kl.de 35612027Sjungma@eit.uni-kl.de sc_unsigned operator & (const sc_unsigned& u, const sc_unsigned& v); 35712027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_unsigned& u, int64 v); 35812027Sjungma@eit.uni-kl.de sc_unsigned operator & (const sc_unsigned& u, uint64 v); 35912027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_unsigned& u, long v); 36012027Sjungma@eit.uni-kl.de sc_unsigned operator & (const sc_unsigned& u, unsigned long v); 36112027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_unsigned& u, int v); 36212027Sjungma@eit.uni-kl.de inline sc_unsigned operator & (const sc_unsigned& u, unsigned int v); 36312027Sjungma@eit.uni-kl.de 36412027Sjungma@eit.uni-kl.de sc_signed operator & (int64 u, const sc_unsigned& v); 36512027Sjungma@eit.uni-kl.de sc_unsigned operator & (uint64 u, const sc_unsigned& v); 36612027Sjungma@eit.uni-kl.de sc_signed operator & (long u, const sc_unsigned& v); 36712027Sjungma@eit.uni-kl.de sc_unsigned operator & (unsigned long u, const sc_unsigned& v); 36812027Sjungma@eit.uni-kl.de sc_signed operator & (int u, const sc_unsigned& v); 36912027Sjungma@eit.uni-kl.de inline sc_unsigned operator & (unsigned int u, const sc_unsigned& v); 37012027Sjungma@eit.uni-kl.de 37112027Sjungma@eit.uni-kl.de sc_unsigned operator & (const sc_unsigned& u, const sc_uint_base& v); 37212027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_unsigned& u, const sc_int_base& v); 37312027Sjungma@eit.uni-kl.de sc_unsigned operator & (const sc_uint_base& u, const sc_unsigned& v); 37412027Sjungma@eit.uni-kl.de sc_signed operator & (const sc_int_base& u, const sc_unsigned& v); 37512027Sjungma@eit.uni-kl.de 37612027Sjungma@eit.uni-kl.de // Bitwise OR operators: 37712027Sjungma@eit.uni-kl.de 37812027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_unsigned& u, const sc_signed& v); 37912027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_signed& u, const sc_unsigned& v); 38012027Sjungma@eit.uni-kl.de 38112027Sjungma@eit.uni-kl.de sc_unsigned operator | (const sc_unsigned& u, const sc_unsigned& v); 38212027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_unsigned& u, int64 v); 38312027Sjungma@eit.uni-kl.de sc_unsigned operator | (const sc_unsigned& u, uint64 v); 38412027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_unsigned& u, long v); 38512027Sjungma@eit.uni-kl.de sc_unsigned operator | (const sc_unsigned& u, unsigned long v); 38612027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_unsigned& u, int v); 38712027Sjungma@eit.uni-kl.de inline sc_unsigned operator | (const sc_unsigned& u, unsigned int v); 38812027Sjungma@eit.uni-kl.de 38912027Sjungma@eit.uni-kl.de sc_signed operator | (int64 u, const sc_unsigned& v); 39012027Sjungma@eit.uni-kl.de sc_unsigned operator | (uint64 u, const sc_unsigned& v); 39112027Sjungma@eit.uni-kl.de sc_signed operator | (long u, const sc_unsigned& v); 39212027Sjungma@eit.uni-kl.de sc_unsigned operator | (unsigned long u, const sc_unsigned& v); 39312027Sjungma@eit.uni-kl.de sc_signed operator | (int u, const sc_unsigned& v); 39412027Sjungma@eit.uni-kl.de inline sc_unsigned operator | (unsigned int u, const sc_unsigned& v); 39512027Sjungma@eit.uni-kl.de 39612027Sjungma@eit.uni-kl.de sc_unsigned operator | (const sc_unsigned& u, const sc_uint_base& v); 39712027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_unsigned& u, const sc_int_base& v); 39812027Sjungma@eit.uni-kl.de sc_unsigned operator | (const sc_uint_base& u, const sc_unsigned& v); 39912027Sjungma@eit.uni-kl.de sc_signed operator | (const sc_int_base& u, const sc_unsigned& v); 40012027Sjungma@eit.uni-kl.de 40112027Sjungma@eit.uni-kl.de // Bitwise XOR operators: 40212027Sjungma@eit.uni-kl.de 40312027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_unsigned& u, const sc_signed& v); 40412027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_signed& u, const sc_unsigned& v); 40512027Sjungma@eit.uni-kl.de 40612027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (const sc_unsigned& u, const sc_unsigned& v); 40712027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_unsigned& u, int64 v); 40812027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (const sc_unsigned& u, uint64 v); 40912027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_unsigned& u, long v); 41012027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (const sc_unsigned& u, unsigned long v); 41112027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_unsigned& u, int v); 41212027Sjungma@eit.uni-kl.de inline sc_unsigned operator ^ (const sc_unsigned& u, unsigned int v); 41312027Sjungma@eit.uni-kl.de 41412027Sjungma@eit.uni-kl.de sc_signed operator ^ (int64 u, const sc_unsigned& v); 41512027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (uint64 u, const sc_unsigned& v); 41612027Sjungma@eit.uni-kl.de sc_signed operator ^ (long u, const sc_unsigned& v); 41712027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (unsigned long u, const sc_unsigned& v); 41812027Sjungma@eit.uni-kl.de sc_signed operator ^ (int u, const sc_unsigned& v); 41912027Sjungma@eit.uni-kl.de inline sc_unsigned operator ^ (unsigned int u, const sc_unsigned& v); 42012027Sjungma@eit.uni-kl.de 42112027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (const sc_unsigned& u, const sc_uint_base& v); 42212027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_unsigned& u, const sc_int_base& v); 42312027Sjungma@eit.uni-kl.de sc_unsigned operator ^ (const sc_uint_base& u, const sc_unsigned& v); 42412027Sjungma@eit.uni-kl.de sc_signed operator ^ (const sc_int_base& u, const sc_unsigned& v); 42512027Sjungma@eit.uni-kl.de 42612027Sjungma@eit.uni-kl.de // SHIFT OPERATORS: 42712027Sjungma@eit.uni-kl.de 42812027Sjungma@eit.uni-kl.de // LEFT SHIFT operators: 42912027Sjungma@eit.uni-kl.de 43012027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, const sc_signed& v); 43112027Sjungma@eit.uni-kl.de sc_signed operator << (const sc_signed& u, const sc_unsigned& v); 43212027Sjungma@eit.uni-kl.de 43312027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, const sc_unsigned& v); 43412027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, int64 v); 43512027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, uint64 v); 43612027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, long v); 43712027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, unsigned long v); 43812027Sjungma@eit.uni-kl.de inline sc_unsigned operator << (const sc_unsigned& u, int v); 43912027Sjungma@eit.uni-kl.de inline sc_unsigned operator << (const sc_unsigned& u, unsigned int v); 44012027Sjungma@eit.uni-kl.de 44112027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, const sc_uint_base& v); 44212027Sjungma@eit.uni-kl.de sc_unsigned operator << (const sc_unsigned& u, const sc_int_base& v); 44312027Sjungma@eit.uni-kl.de 44412027Sjungma@eit.uni-kl.de // RIGHT SHIFT operators: 44512027Sjungma@eit.uni-kl.de 44612027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, const sc_signed& v); 44712027Sjungma@eit.uni-kl.de sc_signed operator >> (const sc_signed& u, const sc_unsigned& v); 44812027Sjungma@eit.uni-kl.de 44912027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, const sc_unsigned& v); 45012027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, int64 v); 45112027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, uint64 v); 45212027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, long v); 45312027Sjungma@eit.uni-kl.de sc_unsigned operator >> (const sc_unsigned& u, unsigned long v); 45412027Sjungma@eit.uni-kl.de inline sc_unsigned operator >> (const sc_unsigned& u, int v); 45512027Sjungma@eit.uni-kl.de inline sc_unsigned operator >> (const sc_unsigned& u, unsigned int v); 45612027Sjungma@eit.uni-kl.de 45712027Sjungma@eit.uni-kl.de sc_unsigned operator >> ( const sc_unsigned& , const sc_uint_base& ); 45812027Sjungma@eit.uni-kl.de sc_unsigned operator >> ( const sc_unsigned&, const sc_int_base& ); 45912027Sjungma@eit.uni-kl.de 46012027Sjungma@eit.uni-kl.de // Unary arithmetic operators 46112027Sjungma@eit.uni-kl.de sc_unsigned operator + (const sc_unsigned& u); 46212027Sjungma@eit.uni-kl.de sc_signed operator - (const sc_unsigned& u); 46312027Sjungma@eit.uni-kl.de 46412027Sjungma@eit.uni-kl.de // LOGICAL OPERATORS: 46512027Sjungma@eit.uni-kl.de 46612027Sjungma@eit.uni-kl.de // Logical EQUAL operators: 46712027Sjungma@eit.uni-kl.de 46812027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, const sc_signed& v); 46912027Sjungma@eit.uni-kl.de bool operator == (const sc_signed& u, const sc_unsigned& v); 47012027Sjungma@eit.uni-kl.de 47112027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, const sc_unsigned& v); 47212027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, int64 v); 47312027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, uint64 v); 47412027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, long v); 47512027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, unsigned long v); 47612027Sjungma@eit.uni-kl.de inline bool operator == (const sc_unsigned& u, int v); 47712027Sjungma@eit.uni-kl.de inline bool operator == (const sc_unsigned& u, unsigned int v); 47812027Sjungma@eit.uni-kl.de 47912027Sjungma@eit.uni-kl.de bool operator == (int64 u, const sc_unsigned& v); 48012027Sjungma@eit.uni-kl.de bool operator == (uint64 u, const sc_unsigned& v); 48112027Sjungma@eit.uni-kl.de bool operator == (long u, const sc_unsigned& v); 48212027Sjungma@eit.uni-kl.de bool operator == (unsigned long u, const sc_unsigned& v); 48312027Sjungma@eit.uni-kl.de inline bool operator == (int u, const sc_unsigned& v); 48412027Sjungma@eit.uni-kl.de inline bool operator == (unsigned int u, const sc_unsigned& v) ; 48512027Sjungma@eit.uni-kl.de 48612027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, const sc_uint_base& v); 48712027Sjungma@eit.uni-kl.de bool operator == (const sc_unsigned& u, const sc_int_base& v); 48812027Sjungma@eit.uni-kl.de bool operator == (const sc_uint_base& u, const sc_unsigned& v); 48912027Sjungma@eit.uni-kl.de bool operator == (const sc_int_base& u, const sc_unsigned& v); 49012027Sjungma@eit.uni-kl.de 49112027Sjungma@eit.uni-kl.de // Logical NOT_EQUAL operators: 49212027Sjungma@eit.uni-kl.de 49312027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, const sc_signed& v); 49412027Sjungma@eit.uni-kl.de bool operator != (const sc_signed& u, const sc_unsigned& v); 49512027Sjungma@eit.uni-kl.de 49612027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, const sc_unsigned& v); 49712027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, int64 v); 49812027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, uint64 v); 49912027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, long v); 50012027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, unsigned long v); 50112027Sjungma@eit.uni-kl.de inline bool operator != (const sc_unsigned& u, int v); 50212027Sjungma@eit.uni-kl.de inline bool operator != (const sc_unsigned& u, unsigned int v); 50312027Sjungma@eit.uni-kl.de 50412027Sjungma@eit.uni-kl.de bool operator != (int64 u, const sc_unsigned& v); 50512027Sjungma@eit.uni-kl.de bool operator != (uint64 u, const sc_unsigned& v); 50612027Sjungma@eit.uni-kl.de bool operator != (long u, const sc_unsigned& v); 50712027Sjungma@eit.uni-kl.de bool operator != (unsigned long u, const sc_unsigned& v); 50812027Sjungma@eit.uni-kl.de inline bool operator != (int u, const sc_unsigned& v); 50912027Sjungma@eit.uni-kl.de inline bool operator != (unsigned int u, const sc_unsigned& v); 51012027Sjungma@eit.uni-kl.de 51112027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, const sc_uint_base& v); 51212027Sjungma@eit.uni-kl.de bool operator != (const sc_unsigned& u, const sc_int_base& v); 51312027Sjungma@eit.uni-kl.de bool operator != (const sc_uint_base& u, const sc_unsigned& v); 51412027Sjungma@eit.uni-kl.de bool operator != (const sc_int_base& u, const sc_unsigned& v); 51512027Sjungma@eit.uni-kl.de 51612027Sjungma@eit.uni-kl.de // Logical LESS_THAN operators: 51712027Sjungma@eit.uni-kl.de 51812027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, const sc_signed& v); 51912027Sjungma@eit.uni-kl.de bool operator < (const sc_signed& u, const sc_unsigned& v); 52012027Sjungma@eit.uni-kl.de 52112027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, const sc_unsigned& v); 52212027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, int64 v); 52312027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, uint64 v); 52412027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, long v); 52512027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, unsigned long v); 52612027Sjungma@eit.uni-kl.de inline bool operator < (const sc_unsigned& u, int v); 52712027Sjungma@eit.uni-kl.de inline bool operator < (const sc_unsigned& u, unsigned int v); 52812027Sjungma@eit.uni-kl.de 52912027Sjungma@eit.uni-kl.de bool operator < (int64 u, const sc_unsigned& v); 53012027Sjungma@eit.uni-kl.de bool operator < (uint64 u, const sc_unsigned& v); 53112027Sjungma@eit.uni-kl.de bool operator < (long u, const sc_unsigned& v); 53212027Sjungma@eit.uni-kl.de bool operator < (unsigned long u, const sc_unsigned& v); 53312027Sjungma@eit.uni-kl.de inline bool operator < (int u, const sc_unsigned& v); 53412027Sjungma@eit.uni-kl.de inline bool operator < (unsigned int u, const sc_unsigned& v); 53512027Sjungma@eit.uni-kl.de 53612027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, const sc_uint_base& v); 53712027Sjungma@eit.uni-kl.de bool operator < (const sc_unsigned& u, const sc_int_base& v); 53812027Sjungma@eit.uni-kl.de bool operator < (const sc_uint_base& u, const sc_unsigned& v); 53912027Sjungma@eit.uni-kl.de bool operator < (const sc_int_base& u, const sc_unsigned& v); 54012027Sjungma@eit.uni-kl.de 54112027Sjungma@eit.uni-kl.de // Logical LESS_THAN_AND_EQUAL operators: 54212027Sjungma@eit.uni-kl.de 54312027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, const sc_signed& v); 54412027Sjungma@eit.uni-kl.de bool operator <= (const sc_signed& u, const sc_unsigned& v); 54512027Sjungma@eit.uni-kl.de 54612027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, const sc_unsigned& v); 54712027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, int64 v); 54812027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, uint64 v); 54912027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, long v); 55012027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, unsigned long v); 55112027Sjungma@eit.uni-kl.de inline bool operator <= (const sc_unsigned& u, int v); 55212027Sjungma@eit.uni-kl.de inline bool operator <= (const sc_unsigned& u, unsigned int v); 55312027Sjungma@eit.uni-kl.de 55412027Sjungma@eit.uni-kl.de bool operator <= (int64 u, const sc_unsigned& v); 55512027Sjungma@eit.uni-kl.de bool operator <= (uint64 u, const sc_unsigned& v); 55612027Sjungma@eit.uni-kl.de bool operator <= (long u, const sc_unsigned& v); 55712027Sjungma@eit.uni-kl.de bool operator <= (unsigned long u, const sc_unsigned& v); 55812027Sjungma@eit.uni-kl.de inline bool operator <= (int u, const sc_unsigned& v); 55912027Sjungma@eit.uni-kl.de inline bool operator <= (unsigned int u, const sc_unsigned& v); 56012027Sjungma@eit.uni-kl.de 56112027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, const sc_uint_base& v); 56212027Sjungma@eit.uni-kl.de bool operator <= (const sc_unsigned& u, const sc_int_base& v); 56312027Sjungma@eit.uni-kl.de bool operator <= (const sc_uint_base& u, const sc_unsigned& v); 56412027Sjungma@eit.uni-kl.de bool operator <= (const sc_int_base& u, const sc_unsigned& v); 56512027Sjungma@eit.uni-kl.de 56612027Sjungma@eit.uni-kl.de // Logical GREATER_THAN operators: 56712027Sjungma@eit.uni-kl.de 56812027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, const sc_signed& v); 56912027Sjungma@eit.uni-kl.de bool operator > (const sc_signed& u, const sc_unsigned& v); 57012027Sjungma@eit.uni-kl.de 57112027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, const sc_unsigned& v); 57212027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, int64 v); 57312027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, uint64 v); 57412027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, long v); 57512027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, unsigned long v); 57612027Sjungma@eit.uni-kl.de inline bool operator > (const sc_unsigned& u, int v); 57712027Sjungma@eit.uni-kl.de inline bool operator > (const sc_unsigned& u, unsigned int v); 57812027Sjungma@eit.uni-kl.de 57912027Sjungma@eit.uni-kl.de bool operator > (int64 u, const sc_unsigned& v); 58012027Sjungma@eit.uni-kl.de bool operator > (uint64 u, const sc_unsigned& v); 58112027Sjungma@eit.uni-kl.de bool operator > (long u, const sc_unsigned& v); 58212027Sjungma@eit.uni-kl.de bool operator > (unsigned long u, const sc_unsigned& v); 58312027Sjungma@eit.uni-kl.de inline bool operator > (int u, const sc_unsigned& v); 58412027Sjungma@eit.uni-kl.de inline bool operator > (unsigned int u, const sc_unsigned& v); 58512027Sjungma@eit.uni-kl.de 58612027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, const sc_uint_base& v); 58712027Sjungma@eit.uni-kl.de bool operator > (const sc_unsigned& u, const sc_int_base& v); 58812027Sjungma@eit.uni-kl.de bool operator > (const sc_uint_base& u, const sc_unsigned& v); 58912027Sjungma@eit.uni-kl.de bool operator > (const sc_int_base& u, const sc_unsigned& v); 59012027Sjungma@eit.uni-kl.de 59112027Sjungma@eit.uni-kl.de // Logical GREATER_THAN_AND_EQUAL operators: 59212027Sjungma@eit.uni-kl.de 59312027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, const sc_signed& v); 59412027Sjungma@eit.uni-kl.de bool operator >= (const sc_signed& u, const sc_unsigned& v); 59512027Sjungma@eit.uni-kl.de 59612027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, const sc_unsigned& v); 59712027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, int64 v); 59812027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, uint64 v); 59912027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, long v); 60012027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, unsigned long v); 60112027Sjungma@eit.uni-kl.de inline bool operator >= (const sc_unsigned& u, int v); 60212027Sjungma@eit.uni-kl.de inline bool operator >= (const sc_unsigned& u, unsigned int v); 60312027Sjungma@eit.uni-kl.de 60412027Sjungma@eit.uni-kl.de bool operator >= (int64 u, const sc_unsigned& v); 60512027Sjungma@eit.uni-kl.de bool operator >= (uint64 u, const sc_unsigned& v); 60612027Sjungma@eit.uni-kl.de bool operator >= (long u, const sc_unsigned& v); 60712027Sjungma@eit.uni-kl.de bool operator >= (unsigned long u, const sc_unsigned& v); 60812027Sjungma@eit.uni-kl.de inline bool operator >= (int u, const sc_unsigned& v); 60912027Sjungma@eit.uni-kl.de inline bool operator >= (unsigned int u, const sc_unsigned& v); 61012027Sjungma@eit.uni-kl.de 61112027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, const sc_uint_base& v); 61212027Sjungma@eit.uni-kl.de bool operator >= (const sc_unsigned& u, const sc_int_base& v); 61312027Sjungma@eit.uni-kl.de bool operator >= (const sc_uint_base& u, const sc_unsigned& v); 61412027Sjungma@eit.uni-kl.de bool operator >= (const sc_int_base& u, const sc_unsigned& v); 61512027Sjungma@eit.uni-kl.de 61612027Sjungma@eit.uni-kl.de // Bitwise NOT operator (unary). 61712027Sjungma@eit.uni-kl.de sc_unsigned operator ~ (const sc_unsigned& u); 61812027Sjungma@eit.uni-kl.de 61912027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 62012027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_bitref_r 62112027Sjungma@eit.uni-kl.de// 62212027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned bit selection (r-value only). 62312027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 62412027Sjungma@eit.uni-kl.de 62512027Sjungma@eit.uni-kl.declass sc_unsigned_bitref_r : public sc_value_base 62612027Sjungma@eit.uni-kl.de{ 62712027Sjungma@eit.uni-kl.de friend class sc_unsigned; 62812027Sjungma@eit.uni-kl.de 62912027Sjungma@eit.uni-kl.deprotected: 63012027Sjungma@eit.uni-kl.de 63112027Sjungma@eit.uni-kl.de // construction and initialization: 63212027Sjungma@eit.uni-kl.de 63312027Sjungma@eit.uni-kl.de sc_unsigned_bitref_r() : sc_value_base(), m_index(0), m_obj_p(0) 63412027Sjungma@eit.uni-kl.de {} 63512027Sjungma@eit.uni-kl.de 63612027Sjungma@eit.uni-kl.de void initialize( const sc_unsigned* obj_p, int index_ ) 63712027Sjungma@eit.uni-kl.de { 63812027Sjungma@eit.uni-kl.de m_obj_p = CCAST<sc_unsigned*>( obj_p ); 63912027Sjungma@eit.uni-kl.de m_index = index_; 64012027Sjungma@eit.uni-kl.de } 64112027Sjungma@eit.uni-kl.de 64212027Sjungma@eit.uni-kl.depublic: 64312027Sjungma@eit.uni-kl.de 64412027Sjungma@eit.uni-kl.de // destructor 64512027Sjungma@eit.uni-kl.de 64612027Sjungma@eit.uni-kl.de virtual ~sc_unsigned_bitref_r() 64712027Sjungma@eit.uni-kl.de {} 64812027Sjungma@eit.uni-kl.de 64912027Sjungma@eit.uni-kl.de // copy constructor 65012027Sjungma@eit.uni-kl.de 65112027Sjungma@eit.uni-kl.de sc_unsigned_bitref_r( const sc_unsigned_bitref_r& a ) 65212027Sjungma@eit.uni-kl.de : sc_value_base(a), m_index( a.m_index ), m_obj_p( a.m_obj_p ) 65312027Sjungma@eit.uni-kl.de {} 65412027Sjungma@eit.uni-kl.de 65512027Sjungma@eit.uni-kl.de // capacity 65612027Sjungma@eit.uni-kl.de 65712027Sjungma@eit.uni-kl.de int length() const 65812027Sjungma@eit.uni-kl.de { return 1; } 65912027Sjungma@eit.uni-kl.de 66012027Sjungma@eit.uni-kl.de 66112027Sjungma@eit.uni-kl.de // implicit conversion to bool 66212027Sjungma@eit.uni-kl.de 66312027Sjungma@eit.uni-kl.de operator uint64 () const; 66412027Sjungma@eit.uni-kl.de bool operator ! () const; 66512027Sjungma@eit.uni-kl.de bool operator ~ () const; 66612027Sjungma@eit.uni-kl.de 66712027Sjungma@eit.uni-kl.de 66812027Sjungma@eit.uni-kl.de // explicit conversions 66912027Sjungma@eit.uni-kl.de 67012027Sjungma@eit.uni-kl.de uint64 value() const 67112027Sjungma@eit.uni-kl.de { return operator uint64(); } 67212027Sjungma@eit.uni-kl.de 67312027Sjungma@eit.uni-kl.de bool to_bool() const 67412027Sjungma@eit.uni-kl.de { return operator uint64(); } 67512027Sjungma@eit.uni-kl.de 67612027Sjungma@eit.uni-kl.de 67712027Sjungma@eit.uni-kl.de // concatenation support 67812027Sjungma@eit.uni-kl.de 67912027Sjungma@eit.uni-kl.de virtual int concat_length(bool* xz_present_p) const 68012027Sjungma@eit.uni-kl.de { if ( xz_present_p ) *xz_present_p = false; return 1; } 68112027Sjungma@eit.uni-kl.de virtual uint64 concat_get_uint64() const 68212027Sjungma@eit.uni-kl.de { return (uint64)operator uint64(); } 68312027Sjungma@eit.uni-kl.de virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const 68412027Sjungma@eit.uni-kl.de { 68512027Sjungma@eit.uni-kl.de int bit_mask = 1 << (low_i % BITS_PER_DIGIT); 68612027Sjungma@eit.uni-kl.de int word_i = low_i / BITS_PER_DIGIT; 68712027Sjungma@eit.uni-kl.de dst_p[word_i] &= ~bit_mask; 68812027Sjungma@eit.uni-kl.de return false; 68912027Sjungma@eit.uni-kl.de } 69012027Sjungma@eit.uni-kl.de virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const 69112027Sjungma@eit.uni-kl.de { 69212027Sjungma@eit.uni-kl.de int bit_mask = 1 << (low_i % BITS_PER_DIGIT); 69312027Sjungma@eit.uni-kl.de bool result; // True if non-zero. 69412027Sjungma@eit.uni-kl.de int word_i = low_i / BITS_PER_DIGIT; 69512027Sjungma@eit.uni-kl.de if ( operator uint64() ) 69612027Sjungma@eit.uni-kl.de { 69712027Sjungma@eit.uni-kl.de dst_p[word_i] |= bit_mask; 69812027Sjungma@eit.uni-kl.de result = true; 69912027Sjungma@eit.uni-kl.de } 70012027Sjungma@eit.uni-kl.de else 70112027Sjungma@eit.uni-kl.de { 70212027Sjungma@eit.uni-kl.de dst_p[word_i] &= ~bit_mask; 70312027Sjungma@eit.uni-kl.de result = false; 70412027Sjungma@eit.uni-kl.de } 70512027Sjungma@eit.uni-kl.de return result; 70612027Sjungma@eit.uni-kl.de } 70712027Sjungma@eit.uni-kl.de 70812027Sjungma@eit.uni-kl.de // other methods 70912027Sjungma@eit.uni-kl.de 71012027Sjungma@eit.uni-kl.de void print( ::std::ostream& os = ::std::cout ) const 71112027Sjungma@eit.uni-kl.de { os << to_bool(); } 71212027Sjungma@eit.uni-kl.de 71312027Sjungma@eit.uni-kl.deprotected: 71412027Sjungma@eit.uni-kl.de 71512027Sjungma@eit.uni-kl.de int m_index; 71612027Sjungma@eit.uni-kl.de sc_unsigned* m_obj_p; 71712027Sjungma@eit.uni-kl.de 71812027Sjungma@eit.uni-kl.deprivate: 71912027Sjungma@eit.uni-kl.de 72012027Sjungma@eit.uni-kl.de // disabled 72112027Sjungma@eit.uni-kl.de const sc_unsigned_bitref_r& operator = ( const sc_unsigned_bitref_r& ); 72212027Sjungma@eit.uni-kl.de}; 72312027Sjungma@eit.uni-kl.de 72412027Sjungma@eit.uni-kl.de 72512027Sjungma@eit.uni-kl.de 72612027Sjungma@eit.uni-kl.deinline 72712027Sjungma@eit.uni-kl.de::std::ostream& 72812027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream&, const sc_unsigned_bitref_r& ); 72912027Sjungma@eit.uni-kl.de 73012027Sjungma@eit.uni-kl.de 73112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 73212027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_bitref 73312027Sjungma@eit.uni-kl.de// 73412027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned bit selection (r-value and l-value). 73512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 73612027Sjungma@eit.uni-kl.de 73712027Sjungma@eit.uni-kl.declass sc_unsigned_bitref 73812027Sjungma@eit.uni-kl.de : public sc_unsigned_bitref_r 73912027Sjungma@eit.uni-kl.de{ 74012027Sjungma@eit.uni-kl.de friend class sc_unsigned; 74112027Sjungma@eit.uni-kl.de friend class sc_core::sc_vpool<sc_unsigned_bitref>; 74212027Sjungma@eit.uni-kl.de 74312027Sjungma@eit.uni-kl.de 74412027Sjungma@eit.uni-kl.deprotected: // construction 74512027Sjungma@eit.uni-kl.de 74612027Sjungma@eit.uni-kl.de sc_unsigned_bitref() : sc_unsigned_bitref_r() 74712027Sjungma@eit.uni-kl.de {} 74812027Sjungma@eit.uni-kl.de 74912027Sjungma@eit.uni-kl.depublic: 75012027Sjungma@eit.uni-kl.de 75112027Sjungma@eit.uni-kl.de // copy constructor 75212027Sjungma@eit.uni-kl.de 75312027Sjungma@eit.uni-kl.de sc_unsigned_bitref( const sc_unsigned_bitref& a ) 75412027Sjungma@eit.uni-kl.de : sc_unsigned_bitref_r( a ) 75512027Sjungma@eit.uni-kl.de {} 75612027Sjungma@eit.uni-kl.de 75712027Sjungma@eit.uni-kl.de 75812027Sjungma@eit.uni-kl.de // assignment operators 75912027Sjungma@eit.uni-kl.de 76012027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref_r& ); 76112027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator = ( const sc_unsigned_bitref& ); 76212027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator = ( bool ); 76312027Sjungma@eit.uni-kl.de 76412027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator &= ( bool ); 76512027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator |= ( bool ); 76612027Sjungma@eit.uni-kl.de const sc_unsigned_bitref& operator ^= ( bool ); 76712027Sjungma@eit.uni-kl.de 76812027Sjungma@eit.uni-kl.de // concatenation methods 76912027Sjungma@eit.uni-kl.de 77012027Sjungma@eit.uni-kl.de virtual void concat_set(int64 src, int low_i); 77112027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_signed& src, int low_i); 77212027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_unsigned& src, int low_i); 77312027Sjungma@eit.uni-kl.de virtual void concat_set(uint64 src, int low_i); 77412027Sjungma@eit.uni-kl.de 77512027Sjungma@eit.uni-kl.de 77612027Sjungma@eit.uni-kl.de // other methods 77712027Sjungma@eit.uni-kl.de 77812027Sjungma@eit.uni-kl.de void scan( ::std::istream& is = ::std::cin ); 77912027Sjungma@eit.uni-kl.de 78012027Sjungma@eit.uni-kl.deprotected: 78112027Sjungma@eit.uni-kl.de static sc_core::sc_vpool<sc_unsigned_bitref> m_pool; 78212027Sjungma@eit.uni-kl.de}; 78312027Sjungma@eit.uni-kl.de 78412027Sjungma@eit.uni-kl.de 78512027Sjungma@eit.uni-kl.de 78612027Sjungma@eit.uni-kl.deinline 78712027Sjungma@eit.uni-kl.de::std::istream& 78812027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream&, sc_unsigned_bitref& ); 78912027Sjungma@eit.uni-kl.de 79012027Sjungma@eit.uni-kl.de 79112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 79212027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_subref_r 79312027Sjungma@eit.uni-kl.de// 79412027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned part selection (r-value only). 79512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 79612027Sjungma@eit.uni-kl.de 79712027Sjungma@eit.uni-kl.declass sc_unsigned_subref_r : public sc_value_base 79812027Sjungma@eit.uni-kl.de{ 79912027Sjungma@eit.uni-kl.de friend class sc_signed; 80012027Sjungma@eit.uni-kl.de friend class sc_unsigned; 80112027Sjungma@eit.uni-kl.de friend class sc_unsigned_signal; 80212027Sjungma@eit.uni-kl.de 80312027Sjungma@eit.uni-kl.deprotected: 80412027Sjungma@eit.uni-kl.de 80512027Sjungma@eit.uni-kl.de // constructor 80612027Sjungma@eit.uni-kl.de 80712027Sjungma@eit.uni-kl.de sc_unsigned_subref_r() : sc_value_base(), m_left(0), m_obj_p(0), m_right(0) 80812027Sjungma@eit.uni-kl.de {} 80912027Sjungma@eit.uni-kl.de 81012027Sjungma@eit.uni-kl.de void initialize( const sc_unsigned* obj_p, int left_, int right_ ) 81112027Sjungma@eit.uni-kl.de { 81212027Sjungma@eit.uni-kl.de m_obj_p = CCAST<sc_unsigned*>( obj_p ); 81312027Sjungma@eit.uni-kl.de m_left = left_; 81412027Sjungma@eit.uni-kl.de m_right = right_; 81512027Sjungma@eit.uni-kl.de } 81612027Sjungma@eit.uni-kl.de 81712027Sjungma@eit.uni-kl.depublic: 81812027Sjungma@eit.uni-kl.de 81912027Sjungma@eit.uni-kl.de // destructor 82012027Sjungma@eit.uni-kl.de 82112027Sjungma@eit.uni-kl.de virtual ~sc_unsigned_subref_r() 82212027Sjungma@eit.uni-kl.de {} 82312027Sjungma@eit.uni-kl.de 82412027Sjungma@eit.uni-kl.de 82512027Sjungma@eit.uni-kl.de // copy constructor 82612027Sjungma@eit.uni-kl.de 82712027Sjungma@eit.uni-kl.de sc_unsigned_subref_r( const sc_unsigned_subref_r& a ) 82812027Sjungma@eit.uni-kl.de : sc_value_base(a), m_left( a.m_left ), m_obj_p( a.m_obj_p ), 82912027Sjungma@eit.uni-kl.de m_right( a.m_right ) 83012027Sjungma@eit.uni-kl.de {} 83112027Sjungma@eit.uni-kl.de 83212027Sjungma@eit.uni-kl.de 83312027Sjungma@eit.uni-kl.de // capacity 83412027Sjungma@eit.uni-kl.de 83512027Sjungma@eit.uni-kl.de int length() const 83612027Sjungma@eit.uni-kl.de { return m_left >= m_right ? (m_left-m_right+1) : (m_right-m_left+1 ); } 83712027Sjungma@eit.uni-kl.de 83812027Sjungma@eit.uni-kl.de 83912027Sjungma@eit.uni-kl.de // implicit conversion to sc_unsigned 84012027Sjungma@eit.uni-kl.de 84112027Sjungma@eit.uni-kl.de operator sc_unsigned () const; 84212027Sjungma@eit.uni-kl.de 84312027Sjungma@eit.uni-kl.de 84412027Sjungma@eit.uni-kl.de // explicit conversions 84512027Sjungma@eit.uni-kl.de 84612027Sjungma@eit.uni-kl.de int to_int() const; 84712027Sjungma@eit.uni-kl.de unsigned int to_uint() const; 84812027Sjungma@eit.uni-kl.de long to_long() const; 84912027Sjungma@eit.uni-kl.de unsigned long to_ulong() const; 85012027Sjungma@eit.uni-kl.de int64 to_int64() const; 85112027Sjungma@eit.uni-kl.de uint64 to_uint64() const; 85212027Sjungma@eit.uni-kl.de double to_double() const; 85312027Sjungma@eit.uni-kl.de 85412027Sjungma@eit.uni-kl.de 85512027Sjungma@eit.uni-kl.de // explicit conversion to character string 85612027Sjungma@eit.uni-kl.de 85712027Sjungma@eit.uni-kl.de const std::string to_string( sc_numrep numrep = SC_DEC ) const; 85812027Sjungma@eit.uni-kl.de const std::string to_string( sc_numrep numrep, bool w_prefix ) const; 85912027Sjungma@eit.uni-kl.de 86012027Sjungma@eit.uni-kl.de 86112027Sjungma@eit.uni-kl.de // concatenation support 86212027Sjungma@eit.uni-kl.de 86312027Sjungma@eit.uni-kl.de virtual int concat_length(bool* xz_present_p) const 86412027Sjungma@eit.uni-kl.de { 86512027Sjungma@eit.uni-kl.de if ( xz_present_p ) *xz_present_p = false; 86612027Sjungma@eit.uni-kl.de return m_left - m_right + 1; 86712027Sjungma@eit.uni-kl.de } 86812027Sjungma@eit.uni-kl.de virtual uint64 concat_get_uint64() const; 86912027Sjungma@eit.uni-kl.de virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const; 87012027Sjungma@eit.uni-kl.de virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const; 87112027Sjungma@eit.uni-kl.de 87212027Sjungma@eit.uni-kl.de // reduce methods 87312027Sjungma@eit.uni-kl.de 87412027Sjungma@eit.uni-kl.de bool and_reduce() const; 87512027Sjungma@eit.uni-kl.de bool nand_reduce() const; 87612027Sjungma@eit.uni-kl.de bool or_reduce() const; 87712027Sjungma@eit.uni-kl.de bool nor_reduce() const; 87812027Sjungma@eit.uni-kl.de bool xor_reduce() const ; 87912027Sjungma@eit.uni-kl.de bool xnor_reduce() const; 88012027Sjungma@eit.uni-kl.de 88112027Sjungma@eit.uni-kl.de // other methods 88212027Sjungma@eit.uni-kl.de 88312027Sjungma@eit.uni-kl.de void print( ::std::ostream& os = ::std::cout ) const 88412027Sjungma@eit.uni-kl.de { os << to_string(sc_io_base(os,SC_DEC),sc_io_show_base(os)); } 88512027Sjungma@eit.uni-kl.de 88612027Sjungma@eit.uni-kl.deprotected: 88712027Sjungma@eit.uni-kl.de 88812027Sjungma@eit.uni-kl.de int m_left; // Left-most bit in this part selection. 88912027Sjungma@eit.uni-kl.de sc_unsigned* m_obj_p; // Target of this part selection. 89012027Sjungma@eit.uni-kl.de int m_right; // Right-most bit in this part selection. 89112027Sjungma@eit.uni-kl.de 89212027Sjungma@eit.uni-kl.deprivate: 89312027Sjungma@eit.uni-kl.de 89412027Sjungma@eit.uni-kl.de // disabled 89512027Sjungma@eit.uni-kl.de const sc_unsigned_subref_r& operator = ( const sc_unsigned_subref_r& ); 89612027Sjungma@eit.uni-kl.de}; 89712027Sjungma@eit.uni-kl.de 89812027Sjungma@eit.uni-kl.de 89912027Sjungma@eit.uni-kl.de 90012027Sjungma@eit.uni-kl.deinline 90112027Sjungma@eit.uni-kl.de::std::ostream& 90212027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream&, const sc_unsigned_subref_r& ); 90312027Sjungma@eit.uni-kl.de 90412027Sjungma@eit.uni-kl.de 90512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 90612027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_subref 90712027Sjungma@eit.uni-kl.de// 90812027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned part selection (r-value and l-value). 90912027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 91012027Sjungma@eit.uni-kl.de 91112027Sjungma@eit.uni-kl.declass sc_unsigned_subref 91212027Sjungma@eit.uni-kl.de : public sc_unsigned_subref_r 91312027Sjungma@eit.uni-kl.de{ 91412027Sjungma@eit.uni-kl.de friend class sc_unsigned; 91512027Sjungma@eit.uni-kl.de friend class sc_core::sc_vpool<sc_unsigned_subref>; 91612027Sjungma@eit.uni-kl.de 91712027Sjungma@eit.uni-kl.de 91812027Sjungma@eit.uni-kl.de // constructor 91912027Sjungma@eit.uni-kl.de 92012027Sjungma@eit.uni-kl.deprotected: 92112027Sjungma@eit.uni-kl.de sc_unsigned_subref() : sc_unsigned_subref_r() 92212027Sjungma@eit.uni-kl.de {} 92312027Sjungma@eit.uni-kl.de 92412027Sjungma@eit.uni-kl.depublic: 92512027Sjungma@eit.uni-kl.de 92612027Sjungma@eit.uni-kl.de // copy constructor 92712027Sjungma@eit.uni-kl.de 92812027Sjungma@eit.uni-kl.de sc_unsigned_subref( const sc_unsigned_subref& a ) 92912027Sjungma@eit.uni-kl.de : sc_unsigned_subref_r( a ) 93012027Sjungma@eit.uni-kl.de {} 93112027Sjungma@eit.uni-kl.de 93212027Sjungma@eit.uni-kl.de // assignment operators 93312027Sjungma@eit.uni-kl.de 93412027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_unsigned_subref_r& a ); 93512027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_unsigned_subref& a ); 93612027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_unsigned& a ); 93712027Sjungma@eit.uni-kl.de 93812027Sjungma@eit.uni-kl.de template<class T> 93912027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_generic_base<T>& a ); 94012027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_signed_subref_r& a ); 94112027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_signed& a ); 94212027Sjungma@eit.uni-kl.de 94312027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const char* a ); 94412027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( unsigned long a ); 94512027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( long a ); 94612027Sjungma@eit.uni-kl.de 94712027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( unsigned int a ) 94812027Sjungma@eit.uni-kl.de { return operator = ( (unsigned long) a ); } 94912027Sjungma@eit.uni-kl.de 95012027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( int a ) 95112027Sjungma@eit.uni-kl.de { return operator = ( (long) a ); } 95212027Sjungma@eit.uni-kl.de 95312027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( uint64 a ); 95412027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( int64 a ); 95512027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( double a ); 95612027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_int_base& a ); 95712027Sjungma@eit.uni-kl.de const sc_unsigned_subref& operator = ( const sc_uint_base& a ); 95812027Sjungma@eit.uni-kl.de 95912027Sjungma@eit.uni-kl.de // concatenation methods 96012027Sjungma@eit.uni-kl.de 96112027Sjungma@eit.uni-kl.de virtual void concat_set(int64 src, int low_i); 96212027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_signed& src, int low_i); 96312027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_unsigned& src, int low_i); 96412027Sjungma@eit.uni-kl.de virtual void concat_set(uint64 src, int low_i); 96512027Sjungma@eit.uni-kl.de 96612027Sjungma@eit.uni-kl.de // other methods 96712027Sjungma@eit.uni-kl.de 96812027Sjungma@eit.uni-kl.de void scan( ::std::istream& is = ::std::cin ); 96912027Sjungma@eit.uni-kl.de 97012027Sjungma@eit.uni-kl.deprotected: 97112027Sjungma@eit.uni-kl.de static sc_core::sc_vpool<sc_unsigned_subref> m_pool; 97212027Sjungma@eit.uni-kl.de}; 97312027Sjungma@eit.uni-kl.de 97412027Sjungma@eit.uni-kl.de 97512027Sjungma@eit.uni-kl.de 97612027Sjungma@eit.uni-kl.deinline 97712027Sjungma@eit.uni-kl.de::std::istream& 97812027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream&, sc_unsigned_subref& ); 97912027Sjungma@eit.uni-kl.de 98012027Sjungma@eit.uni-kl.de 98112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 98212027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned 98312027Sjungma@eit.uni-kl.de// 98412027Sjungma@eit.uni-kl.de// Arbitrary precision unsigned number. 98512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 98612027Sjungma@eit.uni-kl.de 98712027Sjungma@eit.uni-kl.declass sc_unsigned : public sc_value_base 98812027Sjungma@eit.uni-kl.de{ 98912027Sjungma@eit.uni-kl.de friend class sc_concatref; 99012027Sjungma@eit.uni-kl.de friend class sc_unsigned_bitref_r; 99112027Sjungma@eit.uni-kl.de friend class sc_unsigned_bitref; 99212027Sjungma@eit.uni-kl.de friend class sc_unsigned_subref_r; 99312027Sjungma@eit.uni-kl.de friend class sc_unsigned_subref; 99412027Sjungma@eit.uni-kl.de friend class sc_signed; 99512027Sjungma@eit.uni-kl.de friend class sc_signed_subref; 99612027Sjungma@eit.uni-kl.de friend class sc_signed_subref_r; 99712027Sjungma@eit.uni-kl.de 99812027Sjungma@eit.uni-kl.de // Needed for types using sc_unsigned. 99912027Sjungma@eit.uni-kl.de typedef bool elemtype; 100012027Sjungma@eit.uni-kl.de 100112027Sjungma@eit.uni-kl.depublic: 100212027Sjungma@eit.uni-kl.de 100312027Sjungma@eit.uni-kl.de // constructors 100412027Sjungma@eit.uni-kl.de 100512027Sjungma@eit.uni-kl.de explicit sc_unsigned( int nb = sc_length_param().len() ); 100612027Sjungma@eit.uni-kl.de sc_unsigned( const sc_unsigned& v ); 100712027Sjungma@eit.uni-kl.de sc_unsigned( const sc_signed& v ); 100812027Sjungma@eit.uni-kl.de template<class T> 100912027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_generic_base<T>& v ); 101012027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_bv_base& v ); 101112027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_lv_base& v ); 101212027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_int_subref_r& v ); 101312027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_uint_subref_r& v ); 101412027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_signed_subref_r& v ); 101512027Sjungma@eit.uni-kl.de explicit sc_unsigned( const sc_unsigned_subref_r& v ); 101612027Sjungma@eit.uni-kl.de 101712027Sjungma@eit.uni-kl.de 101812027Sjungma@eit.uni-kl.de 101912027Sjungma@eit.uni-kl.de // assignment operators 102012027Sjungma@eit.uni-kl.de 102112027Sjungma@eit.uni-kl.de const sc_unsigned& operator = (const sc_unsigned& v); 102212027Sjungma@eit.uni-kl.de const sc_unsigned& operator = (const sc_unsigned_subref_r& a ); 102312027Sjungma@eit.uni-kl.de 102412027Sjungma@eit.uni-kl.de template<class T> 102512027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_generic_base<T>& a ) 102612027Sjungma@eit.uni-kl.de { a->to_sc_unsigned(*this); return *this; } 102712027Sjungma@eit.uni-kl.de 102812027Sjungma@eit.uni-kl.de const sc_unsigned& operator = (const sc_signed& v); 102912027Sjungma@eit.uni-kl.de const sc_unsigned& operator = (const sc_signed_subref_r& a ); 103012027Sjungma@eit.uni-kl.de 103112027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const char* v); 103212027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( int64 v); 103312027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( uint64 v); 103412027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( long v); 103512027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( unsigned long v); 103612027Sjungma@eit.uni-kl.de 103712027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( int v) 103812027Sjungma@eit.uni-kl.de { return operator=((long) v); } 103912027Sjungma@eit.uni-kl.de 104012027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( unsigned int v) 104112027Sjungma@eit.uni-kl.de { return operator=((unsigned long) v); } 104212027Sjungma@eit.uni-kl.de 104312027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( double v); 104412027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_int_base& v); 104512027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_uint_base& v); 104612027Sjungma@eit.uni-kl.de 104712027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_bv_base& ); 104812027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_lv_base& ); 104912027Sjungma@eit.uni-kl.de 105012027Sjungma@eit.uni-kl.de#ifdef SC_INCLUDE_FX 105112027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_fxval& ); 105212027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_fxval_fast& ); 105312027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_fxnum& ); 105412027Sjungma@eit.uni-kl.de const sc_unsigned& operator = ( const sc_fxnum_fast& ); 105512027Sjungma@eit.uni-kl.de#endif 105612027Sjungma@eit.uni-kl.de 105712027Sjungma@eit.uni-kl.de 105812027Sjungma@eit.uni-kl.de // destructor 105912027Sjungma@eit.uni-kl.de 106012027Sjungma@eit.uni-kl.de virtual ~sc_unsigned() 106112027Sjungma@eit.uni-kl.de { 106212027Sjungma@eit.uni-kl.de# ifndef SC_MAX_NBITS 106312027Sjungma@eit.uni-kl.de delete [] digit; 106412027Sjungma@eit.uni-kl.de# endif 106512027Sjungma@eit.uni-kl.de } 106612027Sjungma@eit.uni-kl.de 106712027Sjungma@eit.uni-kl.de // Concatenation support: 106812027Sjungma@eit.uni-kl.de 106912027Sjungma@eit.uni-kl.de sc_digit* get_raw() const { return digit; } 107012027Sjungma@eit.uni-kl.de virtual int concat_length(bool* xz_present_p) const 107112027Sjungma@eit.uni-kl.de { if ( xz_present_p ) *xz_present_p = false; return nbits-1; } 107212027Sjungma@eit.uni-kl.de virtual bool concat_get_ctrl( sc_digit* dst_p, int low_i ) const; 107312027Sjungma@eit.uni-kl.de virtual bool concat_get_data( sc_digit* dst_p, int low_i ) const; 107412027Sjungma@eit.uni-kl.de virtual uint64 concat_get_uint64() const; 107512027Sjungma@eit.uni-kl.de virtual void concat_set(int64 src, int low_i); 107612027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_signed& src, int low_i); 107712027Sjungma@eit.uni-kl.de virtual void concat_set(const sc_unsigned& src, int low_i); 107812027Sjungma@eit.uni-kl.de virtual void concat_set(uint64 src, int low_i); 107912027Sjungma@eit.uni-kl.de 108012027Sjungma@eit.uni-kl.de // Increment operators. 108112027Sjungma@eit.uni-kl.de 108212027Sjungma@eit.uni-kl.de sc_unsigned& operator ++ (); 108312027Sjungma@eit.uni-kl.de const sc_unsigned operator ++ (int); 108412027Sjungma@eit.uni-kl.de 108512027Sjungma@eit.uni-kl.de // Decrement operators. 108612027Sjungma@eit.uni-kl.de 108712027Sjungma@eit.uni-kl.de sc_unsigned& operator -- (); 108812027Sjungma@eit.uni-kl.de const sc_unsigned operator -- (int); 108912027Sjungma@eit.uni-kl.de 109012027Sjungma@eit.uni-kl.de 109112027Sjungma@eit.uni-kl.de // bit selection 109212027Sjungma@eit.uni-kl.de 109312027Sjungma@eit.uni-kl.de inline void check_index( int i ) const 109412027Sjungma@eit.uni-kl.de { if ( (i < 0) || (i >= nbits-1) ) invalid_index(i); } 109512027Sjungma@eit.uni-kl.de 109612027Sjungma@eit.uni-kl.de void invalid_index( int i ) const; 109712027Sjungma@eit.uni-kl.de 109812027Sjungma@eit.uni-kl.de sc_unsigned_bitref& operator [] ( int i ) 109912027Sjungma@eit.uni-kl.de { 110012027Sjungma@eit.uni-kl.de check_index(i); 110112027Sjungma@eit.uni-kl.de sc_unsigned_bitref* result_p = 110212027Sjungma@eit.uni-kl.de sc_unsigned_bitref::m_pool.allocate(); 110312027Sjungma@eit.uni-kl.de result_p->initialize( this, i ); 110412027Sjungma@eit.uni-kl.de return *result_p; 110512027Sjungma@eit.uni-kl.de } 110612027Sjungma@eit.uni-kl.de 110712027Sjungma@eit.uni-kl.de const sc_unsigned_bitref_r& operator [] ( int i ) const 110812027Sjungma@eit.uni-kl.de { 110912027Sjungma@eit.uni-kl.de check_index(i); 111012027Sjungma@eit.uni-kl.de sc_unsigned_bitref* result_p = 111112027Sjungma@eit.uni-kl.de sc_unsigned_bitref::m_pool.allocate(); 111212027Sjungma@eit.uni-kl.de result_p->initialize( this, i ); 111312027Sjungma@eit.uni-kl.de return *result_p; 111412027Sjungma@eit.uni-kl.de } 111512027Sjungma@eit.uni-kl.de 111612027Sjungma@eit.uni-kl.de sc_unsigned_bitref& bit( int i ) 111712027Sjungma@eit.uni-kl.de { 111812027Sjungma@eit.uni-kl.de check_index(i); 111912027Sjungma@eit.uni-kl.de sc_unsigned_bitref* result_p = 112012027Sjungma@eit.uni-kl.de sc_unsigned_bitref::m_pool.allocate(); 112112027Sjungma@eit.uni-kl.de result_p->initialize( this, i ); 112212027Sjungma@eit.uni-kl.de return *result_p; 112312027Sjungma@eit.uni-kl.de } 112412027Sjungma@eit.uni-kl.de 112512027Sjungma@eit.uni-kl.de const sc_unsigned_bitref_r& bit( int i ) const 112612027Sjungma@eit.uni-kl.de { 112712027Sjungma@eit.uni-kl.de check_index(i); 112812027Sjungma@eit.uni-kl.de sc_unsigned_bitref* result_p = 112912027Sjungma@eit.uni-kl.de sc_unsigned_bitref::m_pool.allocate(); 113012027Sjungma@eit.uni-kl.de result_p->initialize( this, i ); 113112027Sjungma@eit.uni-kl.de return *result_p; 113212027Sjungma@eit.uni-kl.de } 113312027Sjungma@eit.uni-kl.de 113412027Sjungma@eit.uni-kl.de 113512027Sjungma@eit.uni-kl.de // part selection 113612027Sjungma@eit.uni-kl.de 113712027Sjungma@eit.uni-kl.de // Subref operators. Help access the range of bits from the ith to 113812027Sjungma@eit.uni-kl.de // jth. These indices have arbitrary precedence with respect to each 113912027Sjungma@eit.uni-kl.de // other, i.e., we can have i <= j or i > j. Note the equivalence 114012027Sjungma@eit.uni-kl.de // between range(i, j) and operator (i, j). Also note that 114112027Sjungma@eit.uni-kl.de // operator (i, i) returns an unsigned number that corresponds to the 114212027Sjungma@eit.uni-kl.de // bit operator [i], so these two forms are not the same. 114312027Sjungma@eit.uni-kl.de 114412027Sjungma@eit.uni-kl.de inline void check_range( int l, int r ) const 114512027Sjungma@eit.uni-kl.de { 114612027Sjungma@eit.uni-kl.de if ( l < r ) 114712027Sjungma@eit.uni-kl.de { 114812027Sjungma@eit.uni-kl.de if ( (l < 0) || (r >= nbits-1) ) invalid_range(l,r); 114912027Sjungma@eit.uni-kl.de } 115012027Sjungma@eit.uni-kl.de else 115112027Sjungma@eit.uni-kl.de { 115212027Sjungma@eit.uni-kl.de if ( (r < 0) || (l >= nbits-1) ) invalid_range(l,r); 115312027Sjungma@eit.uni-kl.de } 115412027Sjungma@eit.uni-kl.de } 115512027Sjungma@eit.uni-kl.de 115612027Sjungma@eit.uni-kl.de void invalid_range( int l, int r ) const; 115712027Sjungma@eit.uni-kl.de 115812027Sjungma@eit.uni-kl.de sc_unsigned_subref& range( int i, int j ) 115912027Sjungma@eit.uni-kl.de { 116012027Sjungma@eit.uni-kl.de check_range(i,j); 116112027Sjungma@eit.uni-kl.de sc_unsigned_subref* result_p = 116212027Sjungma@eit.uni-kl.de sc_unsigned_subref::m_pool.allocate(); 116312027Sjungma@eit.uni-kl.de result_p->initialize( this, i, j ); 116412027Sjungma@eit.uni-kl.de return *result_p; 116512027Sjungma@eit.uni-kl.de } 116612027Sjungma@eit.uni-kl.de 116712027Sjungma@eit.uni-kl.de const sc_unsigned_subref_r& range( int i, int j ) const 116812027Sjungma@eit.uni-kl.de { 116912027Sjungma@eit.uni-kl.de check_range(i,j); 117012027Sjungma@eit.uni-kl.de sc_unsigned_subref* result_p = 117112027Sjungma@eit.uni-kl.de sc_unsigned_subref::m_pool.allocate(); 117212027Sjungma@eit.uni-kl.de result_p->initialize( this, i, j ); 117312027Sjungma@eit.uni-kl.de return *result_p; 117412027Sjungma@eit.uni-kl.de } 117512027Sjungma@eit.uni-kl.de 117612027Sjungma@eit.uni-kl.de sc_unsigned_subref& operator () ( int i, int j ) 117712027Sjungma@eit.uni-kl.de { 117812027Sjungma@eit.uni-kl.de check_range(i,j); 117912027Sjungma@eit.uni-kl.de sc_unsigned_subref* result_p = 118012027Sjungma@eit.uni-kl.de sc_unsigned_subref::m_pool.allocate(); 118112027Sjungma@eit.uni-kl.de result_p->initialize( this, i, j ); 118212027Sjungma@eit.uni-kl.de return *result_p; 118312027Sjungma@eit.uni-kl.de } 118412027Sjungma@eit.uni-kl.de 118512027Sjungma@eit.uni-kl.de const sc_unsigned_subref_r& operator () ( int i, int j ) const 118612027Sjungma@eit.uni-kl.de { 118712027Sjungma@eit.uni-kl.de check_range(i,j); 118812027Sjungma@eit.uni-kl.de sc_unsigned_subref* result_p = 118912027Sjungma@eit.uni-kl.de sc_unsigned_subref::m_pool.allocate(); 119012027Sjungma@eit.uni-kl.de result_p->initialize( this, i, j ); 119112027Sjungma@eit.uni-kl.de return *result_p; 119212027Sjungma@eit.uni-kl.de } 119312027Sjungma@eit.uni-kl.de 119412027Sjungma@eit.uni-kl.de // explicit conversions 119512027Sjungma@eit.uni-kl.de 119612027Sjungma@eit.uni-kl.de int to_int() const; 119712027Sjungma@eit.uni-kl.de unsigned int to_uint() const; 119812027Sjungma@eit.uni-kl.de long to_long() const; 119912027Sjungma@eit.uni-kl.de unsigned long to_ulong() const; 120012027Sjungma@eit.uni-kl.de int64 to_int64() const; 120112027Sjungma@eit.uni-kl.de uint64 to_uint64() const; 120212027Sjungma@eit.uni-kl.de double to_double() const; 120312027Sjungma@eit.uni-kl.de 120412027Sjungma@eit.uni-kl.de#ifdef SC_DT_DEPRECATED 120512027Sjungma@eit.uni-kl.de int to_signed() const 120612027Sjungma@eit.uni-kl.de { return to_int(); } 120712027Sjungma@eit.uni-kl.de 120812027Sjungma@eit.uni-kl.de unsigned int to_unsigned() const 120912027Sjungma@eit.uni-kl.de { return to_uint(); } 121012027Sjungma@eit.uni-kl.de#endif 121112027Sjungma@eit.uni-kl.de 121212027Sjungma@eit.uni-kl.de // explicit conversion to character string 121312027Sjungma@eit.uni-kl.de 121412027Sjungma@eit.uni-kl.de const std::string to_string( sc_numrep numrep = SC_DEC ) const; 121512027Sjungma@eit.uni-kl.de const std::string to_string( sc_numrep numrep, bool w_prefix ) const; 121612027Sjungma@eit.uni-kl.de 121712027Sjungma@eit.uni-kl.de // Print functions. dump prints the internals of the class. 121812027Sjungma@eit.uni-kl.de 121912027Sjungma@eit.uni-kl.de void print( ::std::ostream& os = ::std::cout ) const 122012027Sjungma@eit.uni-kl.de { os << to_string(sc_io_base(os,SC_DEC),sc_io_show_base(os)); } 122112027Sjungma@eit.uni-kl.de 122212027Sjungma@eit.uni-kl.de void scan( ::std::istream& is = ::std::cin ); 122312027Sjungma@eit.uni-kl.de 122412027Sjungma@eit.uni-kl.de void dump( ::std::ostream& os = ::std::cout ) const; 122512027Sjungma@eit.uni-kl.de 122612027Sjungma@eit.uni-kl.de 122712027Sjungma@eit.uni-kl.de // Functions to find various properties. 122812027Sjungma@eit.uni-kl.de int length() const { return nbits - 1; } // Bit width. 122912027Sjungma@eit.uni-kl.de bool iszero() const; // Is the number zero? 123012027Sjungma@eit.uni-kl.de bool sign() const { return 0; } // Sign. 123112027Sjungma@eit.uni-kl.de 123212027Sjungma@eit.uni-kl.de // reduce methods 123312027Sjungma@eit.uni-kl.de 123412027Sjungma@eit.uni-kl.de bool and_reduce() const; 123512027Sjungma@eit.uni-kl.de 123612027Sjungma@eit.uni-kl.de bool nand_reduce() const 123712027Sjungma@eit.uni-kl.de { return ( ! and_reduce() ); } 123812027Sjungma@eit.uni-kl.de 123912027Sjungma@eit.uni-kl.de bool or_reduce() const; 124012027Sjungma@eit.uni-kl.de 124112027Sjungma@eit.uni-kl.de bool nor_reduce() const 124212027Sjungma@eit.uni-kl.de { return ( ! or_reduce() ); } 124312027Sjungma@eit.uni-kl.de 124412027Sjungma@eit.uni-kl.de bool xor_reduce() const; 124512027Sjungma@eit.uni-kl.de 124612027Sjungma@eit.uni-kl.de bool xnor_reduce() const 124712027Sjungma@eit.uni-kl.de { return ( ! xor_reduce() ); } 124812027Sjungma@eit.uni-kl.de 124912027Sjungma@eit.uni-kl.de 125012027Sjungma@eit.uni-kl.de // Functions to access individual bits. 125112027Sjungma@eit.uni-kl.de bool test(int i) const; // Is the ith bit 0 or 1? 125212027Sjungma@eit.uni-kl.de void set(int i); // Set the ith bit to 1. 125312027Sjungma@eit.uni-kl.de void clear(int i); // Set the ith bit to 0. 125412027Sjungma@eit.uni-kl.de void set(int i, bool v) // Set the ith bit to v. 125512027Sjungma@eit.uni-kl.de { if (v) set(i); else clear(i); } 125612027Sjungma@eit.uni-kl.de void invert(int i) // Negate the ith bit. 125712027Sjungma@eit.uni-kl.de { if (test(i)) clear(i); else set(i); } 125812027Sjungma@eit.uni-kl.de 125912027Sjungma@eit.uni-kl.de // Make the number equal to its mirror image. 126012027Sjungma@eit.uni-kl.de void reverse(); 126112027Sjungma@eit.uni-kl.de 126212027Sjungma@eit.uni-kl.de // Get/set a packed bit representation of the number. 126312027Sjungma@eit.uni-kl.de void get_packed_rep(sc_digit *buf) const; 126412027Sjungma@eit.uni-kl.de void set_packed_rep(sc_digit *buf); 126512027Sjungma@eit.uni-kl.de 126612027Sjungma@eit.uni-kl.de /* 126712027Sjungma@eit.uni-kl.de The comparison of the old and new semantics are as follows: 126812027Sjungma@eit.uni-kl.de 126912027Sjungma@eit.uni-kl.de Let s = sc_signed, 127012027Sjungma@eit.uni-kl.de u = sc_unsigned, 127112027Sjungma@eit.uni-kl.de un = { uint64, unsigned long, unsigned int }, 127212027Sjungma@eit.uni-kl.de sn = { int64, long, int, char* }, and 127312027Sjungma@eit.uni-kl.de OP = { +, -, *, /, % }. 127412027Sjungma@eit.uni-kl.de 127512027Sjungma@eit.uni-kl.de Old semantics: New semantics: 127612027Sjungma@eit.uni-kl.de u OP u -> u u OP u -> u 127712027Sjungma@eit.uni-kl.de s OP u -> u s OP u -> s 127812027Sjungma@eit.uni-kl.de u OP s -> u u OP s -> s 127912027Sjungma@eit.uni-kl.de s OP s -> s s OP s -> s 128012027Sjungma@eit.uni-kl.de 128112027Sjungma@eit.uni-kl.de u OP un = un OP u -> u u OP un = un OP u -> u 128212027Sjungma@eit.uni-kl.de u OP sn = sn OP u -> u u OP sn = sn OP u -> s 128312027Sjungma@eit.uni-kl.de 128412027Sjungma@eit.uni-kl.de s OP un = un OP s -> s s OP un = un OP s -> s 128512027Sjungma@eit.uni-kl.de s OP sn = sn OP s -> s s OP sn = sn OP s -> s 128612027Sjungma@eit.uni-kl.de 128712027Sjungma@eit.uni-kl.de In the new semantics, the result is u if both operands are u; the 128812027Sjungma@eit.uni-kl.de result is s otherwise. The only exception is subtraction. The result 128912027Sjungma@eit.uni-kl.de of a subtraction is always s. 129012027Sjungma@eit.uni-kl.de 129112027Sjungma@eit.uni-kl.de The old semantics is like C/C++ semantics on integer types; the 129212027Sjungma@eit.uni-kl.de new semantics is due to the VSIA C/C++ data types standard. 129312027Sjungma@eit.uni-kl.de */ 129412027Sjungma@eit.uni-kl.de 129512027Sjungma@eit.uni-kl.de // ARITHMETIC OPERATORS: 129612027Sjungma@eit.uni-kl.de 129712027Sjungma@eit.uni-kl.de // ADDition operators: 129812027Sjungma@eit.uni-kl.de 129912027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_unsigned& u, const sc_signed& v); 130012027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_signed& u, const sc_unsigned& v); 130112027Sjungma@eit.uni-kl.de 130212027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u, const sc_unsigned& v); 130312027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_unsigned& u, int64 v); 130412027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u, uint64 v); 130512027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_unsigned& u, long v); 130612027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u, unsigned long v); 130712027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_unsigned& u, int v); 130812027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u, unsigned int v) 130912027Sjungma@eit.uni-kl.de { return operator+(u, (unsigned long) v); } 131012027Sjungma@eit.uni-kl.de 131112027Sjungma@eit.uni-kl.de friend sc_signed operator + (int64 u, const sc_unsigned& v); 131212027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (uint64 u, const sc_unsigned& v); 131312027Sjungma@eit.uni-kl.de friend sc_signed operator + (long u, const sc_unsigned& v); 131412027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (unsigned long u, const sc_unsigned& v); 131512027Sjungma@eit.uni-kl.de friend sc_signed operator + (int u, const sc_unsigned& v); 131612027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (unsigned int u, const sc_unsigned& v) 131712027Sjungma@eit.uni-kl.de { return operator+((unsigned long) u, v); } 131812027Sjungma@eit.uni-kl.de 131912027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (const sc_signed& v); 132012027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (const sc_unsigned& v); 132112027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (int64 v); 132212027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (uint64 v); 132312027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (long v); 132412027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (unsigned long v); 132512027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (int v) 132612027Sjungma@eit.uni-kl.de { return operator+=((long) v); } 132712027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (unsigned int v) 132812027Sjungma@eit.uni-kl.de { return operator+=((unsigned long) v); } 132912027Sjungma@eit.uni-kl.de 133012027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u, const sc_uint_base& v); 133112027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_unsigned& u, const sc_int_base& v); 133212027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_uint_base& u, const sc_unsigned& v); 133312027Sjungma@eit.uni-kl.de friend sc_signed operator + (const sc_int_base& u, const sc_unsigned& v); 133412027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (const sc_int_base& v); 133512027Sjungma@eit.uni-kl.de const sc_unsigned& operator += (const sc_uint_base& v); 133612027Sjungma@eit.uni-kl.de 133712027Sjungma@eit.uni-kl.de // SUBtraction operators: 133812027Sjungma@eit.uni-kl.de 133912027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, const sc_signed& v); 134012027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_signed& u, const sc_unsigned& v); 134112027Sjungma@eit.uni-kl.de 134212027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, const sc_unsigned& v); 134312027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, int64 v); 134412027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, uint64 v); 134512027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, long v); 134612027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, unsigned long v); 134712027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, int v); 134812027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, unsigned int v); 134912027Sjungma@eit.uni-kl.de 135012027Sjungma@eit.uni-kl.de friend sc_signed operator - (int64 u, const sc_unsigned& v); 135112027Sjungma@eit.uni-kl.de friend sc_signed operator - (uint64 u, const sc_unsigned& v); 135212027Sjungma@eit.uni-kl.de friend sc_signed operator - (long u, const sc_unsigned& v); 135312027Sjungma@eit.uni-kl.de friend sc_signed operator - (unsigned long u, const sc_unsigned& v); 135412027Sjungma@eit.uni-kl.de friend sc_signed operator - (int u, const sc_unsigned& v); 135512027Sjungma@eit.uni-kl.de friend sc_signed operator - (unsigned int u, const sc_unsigned& v); 135612027Sjungma@eit.uni-kl.de 135712027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (const sc_signed& v); 135812027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (const sc_unsigned& v); 135912027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (int64 v); 136012027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (uint64 v); 136112027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (long v); 136212027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (unsigned long v); 136312027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (int v) 136412027Sjungma@eit.uni-kl.de { return operator-=((long) v); } 136512027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (unsigned int v) 136612027Sjungma@eit.uni-kl.de { return operator-=((unsigned long) v); } 136712027Sjungma@eit.uni-kl.de 136812027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, const sc_uint_base& v); 136912027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u, const sc_int_base& v); 137012027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_uint_base& u, const sc_unsigned& v); 137112027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_int_base& u, const sc_unsigned& v); 137212027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (const sc_int_base& v); 137312027Sjungma@eit.uni-kl.de const sc_unsigned& operator -= (const sc_uint_base& v); 137412027Sjungma@eit.uni-kl.de 137512027Sjungma@eit.uni-kl.de // MULtiplication operators: 137612027Sjungma@eit.uni-kl.de 137712027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_unsigned& u, const sc_signed& v); 137812027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_signed& u, const sc_unsigned& v); 137912027Sjungma@eit.uni-kl.de 138012027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_unsigned& u, const sc_unsigned& v); 138112027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_unsigned& u, int64 v); 138212027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_unsigned& u, uint64 v); 138312027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_unsigned& u, long v); 138412027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_unsigned& u, unsigned long v); 138512027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_unsigned& u, int v); 138612027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_unsigned& u, unsigned int v) 138712027Sjungma@eit.uni-kl.de { return operator*(u, (unsigned long) v); } 138812027Sjungma@eit.uni-kl.de 138912027Sjungma@eit.uni-kl.de friend sc_signed operator * (int64 u, const sc_unsigned& v); 139012027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (uint64 u, const sc_unsigned& v); 139112027Sjungma@eit.uni-kl.de friend sc_signed operator * (long u, const sc_unsigned& v); 139212027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (unsigned long u, const sc_unsigned& v); 139312027Sjungma@eit.uni-kl.de friend sc_signed operator * (int u, const sc_unsigned& v); 139412027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (unsigned int u, const sc_unsigned& v) 139512027Sjungma@eit.uni-kl.de { return operator*((unsigned long) u, v); } 139612027Sjungma@eit.uni-kl.de 139712027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (const sc_signed& v); 139812027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (const sc_unsigned& v); 139912027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (int64 v); 140012027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (uint64 v); 140112027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (long v); 140212027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (unsigned long v); 140312027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (int v) 140412027Sjungma@eit.uni-kl.de { return operator*=((long) v); } 140512027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (unsigned int v) 140612027Sjungma@eit.uni-kl.de { return operator*=((unsigned long) v); } 140712027Sjungma@eit.uni-kl.de 140812027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_unsigned& u, const sc_uint_base& v); 140912027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_unsigned& u, const sc_int_base& v); 141012027Sjungma@eit.uni-kl.de friend sc_unsigned operator * (const sc_uint_base& u, const sc_unsigned& v); 141112027Sjungma@eit.uni-kl.de friend sc_signed operator * (const sc_int_base& u, const sc_unsigned& v); 141212027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (const sc_int_base& v); 141312027Sjungma@eit.uni-kl.de const sc_unsigned& operator *= (const sc_uint_base& v); 141412027Sjungma@eit.uni-kl.de 141512027Sjungma@eit.uni-kl.de // DIVision operators: 141612027Sjungma@eit.uni-kl.de 141712027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_unsigned& u, const sc_signed& v); 141812027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_signed& u, const sc_unsigned& v); 141912027Sjungma@eit.uni-kl.de 142012027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_unsigned& u, const sc_unsigned& v); 142112027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_unsigned& u, int64 v); 142212027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_unsigned& u, uint64 v); 142312027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_unsigned& u, long v); 142412027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_unsigned& u, unsigned long v); 142512027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_unsigned& u, int v); 142612027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_unsigned& u, unsigned int v) 142712027Sjungma@eit.uni-kl.de { return operator/(u, (unsigned long) v); } 142812027Sjungma@eit.uni-kl.de 142912027Sjungma@eit.uni-kl.de friend sc_signed operator / (int64 u, const sc_unsigned& v); 143012027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (uint64 u, const sc_unsigned& v); 143112027Sjungma@eit.uni-kl.de friend sc_signed operator / (long u, const sc_unsigned& v); 143212027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (unsigned long u, const sc_unsigned& v); 143312027Sjungma@eit.uni-kl.de friend sc_signed operator / (int u, const sc_unsigned& v); 143412027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (unsigned int u, const sc_unsigned& v) 143512027Sjungma@eit.uni-kl.de { return operator/((unsigned long) u, v); } 143612027Sjungma@eit.uni-kl.de 143712027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (const sc_signed& v); 143812027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (const sc_unsigned& v); 143912027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (int64 v); 144012027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (uint64 v); 144112027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (long v); 144212027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (unsigned long v); 144312027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (int v) 144412027Sjungma@eit.uni-kl.de { return operator/=((long) v); } 144512027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (unsigned int v) 144612027Sjungma@eit.uni-kl.de { return operator/=((unsigned long) v); } 144712027Sjungma@eit.uni-kl.de 144812027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_unsigned& u, const sc_uint_base& v); 144912027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_unsigned& u, const sc_int_base& v); 145012027Sjungma@eit.uni-kl.de friend sc_unsigned operator / (const sc_uint_base& u, const sc_unsigned& v); 145112027Sjungma@eit.uni-kl.de friend sc_signed operator / (const sc_int_base& u, const sc_unsigned& v); 145212027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (const sc_int_base& v); 145312027Sjungma@eit.uni-kl.de const sc_unsigned& operator /= (const sc_uint_base& v); 145412027Sjungma@eit.uni-kl.de 145512027Sjungma@eit.uni-kl.de // MODulo operators: 145612027Sjungma@eit.uni-kl.de 145712027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_unsigned& u, const sc_signed& v); 145812027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_signed& u, const sc_unsigned& v); 145912027Sjungma@eit.uni-kl.de 146012027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_unsigned& u, const sc_unsigned& v); 146112027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_unsigned& u, int64 v); 146212027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_unsigned& u, uint64 v); 146312027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_unsigned& u, long v); 146412027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_unsigned& u, unsigned long v); 146512027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_unsigned& u, int v); 146612027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_unsigned& u, unsigned int v) 146712027Sjungma@eit.uni-kl.de { return operator%(u, (unsigned long) v); } 146812027Sjungma@eit.uni-kl.de 146912027Sjungma@eit.uni-kl.de friend sc_signed operator % (int64 u, const sc_unsigned& v); 147012027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (uint64 u, const sc_unsigned& v); 147112027Sjungma@eit.uni-kl.de friend sc_signed operator % (long u, const sc_unsigned& v); 147212027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (unsigned long u, const sc_unsigned& v); 147312027Sjungma@eit.uni-kl.de friend sc_signed operator % (int u, const sc_unsigned& v); 147412027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (unsigned int u, const sc_unsigned& v) 147512027Sjungma@eit.uni-kl.de { return operator%((unsigned long) u, v); } 147612027Sjungma@eit.uni-kl.de 147712027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (const sc_signed& v); 147812027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (const sc_unsigned& v); 147912027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (int64 v); 148012027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (uint64 v); 148112027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (long v); 148212027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (unsigned long v); 148312027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (int v) 148412027Sjungma@eit.uni-kl.de { return operator%=((long) v); } 148512027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (unsigned int v) 148612027Sjungma@eit.uni-kl.de { return operator%=((unsigned long) v); } 148712027Sjungma@eit.uni-kl.de 148812027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_unsigned& u, const sc_uint_base& v); 148912027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_unsigned& u, const sc_int_base& v); 149012027Sjungma@eit.uni-kl.de friend sc_unsigned operator % (const sc_uint_base& u, const sc_unsigned& v); 149112027Sjungma@eit.uni-kl.de friend sc_signed operator % (const sc_int_base& u, const sc_unsigned& v); 149212027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (const sc_int_base& v); 149312027Sjungma@eit.uni-kl.de const sc_unsigned& operator %= (const sc_uint_base& v); 149412027Sjungma@eit.uni-kl.de 149512027Sjungma@eit.uni-kl.de // BITWISE OPERATORS: 149612027Sjungma@eit.uni-kl.de 149712027Sjungma@eit.uni-kl.de // Bitwise AND operators: 149812027Sjungma@eit.uni-kl.de 149912027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_unsigned& u, const sc_signed& v); 150012027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_signed& u, const sc_unsigned& v); 150112027Sjungma@eit.uni-kl.de 150212027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_unsigned& u, const sc_unsigned& v); 150312027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_unsigned& u, int64 v); 150412027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_unsigned& u, uint64 v); 150512027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_unsigned& u, long v); 150612027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_unsigned& u, unsigned long v); 150712027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_unsigned& u, int v); 150812027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_unsigned& u, unsigned int v) 150912027Sjungma@eit.uni-kl.de { return operator&(u, (unsigned long) v); } 151012027Sjungma@eit.uni-kl.de 151112027Sjungma@eit.uni-kl.de friend sc_signed operator & (int64 u, const sc_unsigned& v); 151212027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (uint64 u, const sc_unsigned& v); 151312027Sjungma@eit.uni-kl.de friend sc_signed operator & (long u, const sc_unsigned& v); 151412027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (unsigned long u, const sc_unsigned& v); 151512027Sjungma@eit.uni-kl.de friend sc_signed operator & (int u, const sc_unsigned& v); 151612027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (unsigned int u, const sc_unsigned& v) 151712027Sjungma@eit.uni-kl.de { return operator&((unsigned long) u, v); } 151812027Sjungma@eit.uni-kl.de 151912027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (const sc_signed& v); 152012027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (const sc_unsigned& v); 152112027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (int64 v); 152212027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (uint64 v); 152312027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (long v); 152412027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (unsigned long v); 152512027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (int v) 152612027Sjungma@eit.uni-kl.de { return operator&=((long) v); } 152712027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (unsigned int v) 152812027Sjungma@eit.uni-kl.de { return operator&=((unsigned long) v); } 152912027Sjungma@eit.uni-kl.de 153012027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_unsigned& u, const sc_uint_base& v); 153112027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_unsigned& u, const sc_int_base& v); 153212027Sjungma@eit.uni-kl.de friend sc_unsigned operator & (const sc_uint_base& u, const sc_unsigned& v); 153312027Sjungma@eit.uni-kl.de friend sc_signed operator & (const sc_int_base& u, const sc_unsigned& v); 153412027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (const sc_int_base& v); 153512027Sjungma@eit.uni-kl.de const sc_unsigned& operator &= (const sc_uint_base& v); 153612027Sjungma@eit.uni-kl.de 153712027Sjungma@eit.uni-kl.de // Bitwise OR operators: 153812027Sjungma@eit.uni-kl.de 153912027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_unsigned& u, const sc_signed& v); 154012027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_signed& u, const sc_unsigned& v); 154112027Sjungma@eit.uni-kl.de 154212027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_unsigned& u, const sc_unsigned& v); 154312027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_unsigned& u, int64 v); 154412027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_unsigned& u, uint64 v); 154512027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_unsigned& u, long v); 154612027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_unsigned& u, unsigned long v); 154712027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_unsigned& u, int v); 154812027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_unsigned& u, unsigned int v) 154912027Sjungma@eit.uni-kl.de { return operator|(u, (unsigned long) v); } 155012027Sjungma@eit.uni-kl.de 155112027Sjungma@eit.uni-kl.de friend sc_signed operator | (int64 u, const sc_unsigned& v); 155212027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (uint64 u, const sc_unsigned& v); 155312027Sjungma@eit.uni-kl.de friend sc_signed operator | (long u, const sc_unsigned& v); 155412027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (unsigned long u, const sc_unsigned& v); 155512027Sjungma@eit.uni-kl.de friend sc_signed operator | (int u, const sc_unsigned& v); 155612027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (unsigned int u, const sc_unsigned& v) 155712027Sjungma@eit.uni-kl.de { return operator|((unsigned long) u, v); } 155812027Sjungma@eit.uni-kl.de 155912027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (const sc_signed& v); 156012027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (const sc_unsigned& v); 156112027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (int64 v); 156212027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (uint64 v); 156312027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (long v); 156412027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (unsigned long v); 156512027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (int v) 156612027Sjungma@eit.uni-kl.de { return operator|=((long) v); } 156712027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (unsigned int v) 156812027Sjungma@eit.uni-kl.de { return operator|=((unsigned long) v); } 156912027Sjungma@eit.uni-kl.de 157012027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_unsigned& u, const sc_uint_base& v); 157112027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_unsigned& u, const sc_int_base& v); 157212027Sjungma@eit.uni-kl.de friend sc_unsigned operator | (const sc_uint_base& u, const sc_unsigned& v); 157312027Sjungma@eit.uni-kl.de friend sc_signed operator | (const sc_int_base& u, const sc_unsigned& v); 157412027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (const sc_int_base& v); 157512027Sjungma@eit.uni-kl.de const sc_unsigned& operator |= (const sc_uint_base& v); 157612027Sjungma@eit.uni-kl.de 157712027Sjungma@eit.uni-kl.de // Bitwise XOR operators: 157812027Sjungma@eit.uni-kl.de 157912027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_unsigned& u, const sc_signed& v); 158012027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_signed& u, const sc_unsigned& v); 158112027Sjungma@eit.uni-kl.de 158212027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_unsigned& u, const sc_unsigned& v); 158312027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_unsigned& u, int64 v); 158412027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_unsigned& u, uint64 v); 158512027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_unsigned& u, long v); 158612027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_unsigned& u, unsigned long v); 158712027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_unsigned& u, int v); 158812027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_unsigned& u, unsigned int v) 158912027Sjungma@eit.uni-kl.de { return operator^(u, (unsigned long) v); } 159012027Sjungma@eit.uni-kl.de 159112027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (int64 u, const sc_unsigned& v); 159212027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (uint64 u, const sc_unsigned& v); 159312027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (long u, const sc_unsigned& v); 159412027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (unsigned long u, const sc_unsigned& v); 159512027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (int u, const sc_unsigned& v); 159612027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (unsigned int u, const sc_unsigned& v) 159712027Sjungma@eit.uni-kl.de { return operator^((unsigned long) u, v); } 159812027Sjungma@eit.uni-kl.de 159912027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (const sc_signed& v); 160012027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (const sc_unsigned& v); 160112027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (int64 v); 160212027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (uint64 v); 160312027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (long v); 160412027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (unsigned long v); 160512027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (int v) 160612027Sjungma@eit.uni-kl.de { return operator^=((long) v); } 160712027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (unsigned int v) 160812027Sjungma@eit.uni-kl.de { return operator^=((unsigned long) v); } 160912027Sjungma@eit.uni-kl.de 161012027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_unsigned& u, const sc_uint_base& v); 161112027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_unsigned& u, const sc_int_base& v); 161212027Sjungma@eit.uni-kl.de friend sc_unsigned operator ^ (const sc_uint_base& u, const sc_unsigned& v); 161312027Sjungma@eit.uni-kl.de friend sc_signed operator ^ (const sc_int_base& u, const sc_unsigned& v); 161412027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (const sc_int_base& v); 161512027Sjungma@eit.uni-kl.de const sc_unsigned& operator ^= (const sc_uint_base& v); 161612027Sjungma@eit.uni-kl.de 161712027Sjungma@eit.uni-kl.de // SHIFT OPERATORS: 161812027Sjungma@eit.uni-kl.de 161912027Sjungma@eit.uni-kl.de // LEFT SHIFT operators: 162012027Sjungma@eit.uni-kl.de 162112027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, const sc_signed& v); 162212027Sjungma@eit.uni-kl.de friend sc_signed operator << (const sc_signed& u, const sc_unsigned& v); 162312027Sjungma@eit.uni-kl.de 162412027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, const sc_unsigned& v); 162512027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, int64 v); 162612027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, uint64 v); 162712027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, long v); 162812027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, unsigned long v); 162912027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, int v) 163012027Sjungma@eit.uni-kl.de { return operator<<(u, (long) v); } 163112027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, unsigned int v) 163212027Sjungma@eit.uni-kl.de { return operator<<(u, (unsigned long) v); } 163312027Sjungma@eit.uni-kl.de 163412027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (const sc_signed& v); 163512027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (const sc_unsigned& v); 163612027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (int64 v); 163712027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (uint64 v); 163812027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (long v); 163912027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (unsigned long v); 164012027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (int v) 164112027Sjungma@eit.uni-kl.de { return operator<<=((long) v); } 164212027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (unsigned int v) 164312027Sjungma@eit.uni-kl.de { return operator<<=((unsigned long) v); } 164412027Sjungma@eit.uni-kl.de 164512027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, const sc_uint_base& v); 164612027Sjungma@eit.uni-kl.de friend sc_unsigned operator << (const sc_unsigned& u, const sc_int_base& v); 164712027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (const sc_int_base& v); 164812027Sjungma@eit.uni-kl.de const sc_unsigned& operator <<= (const sc_uint_base& v); 164912027Sjungma@eit.uni-kl.de 165012027Sjungma@eit.uni-kl.de // RIGHT SHIFT operators: 165112027Sjungma@eit.uni-kl.de 165212027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, const sc_signed& v); 165312027Sjungma@eit.uni-kl.de friend sc_signed operator >> (const sc_signed& u, const sc_unsigned& v); 165412027Sjungma@eit.uni-kl.de 165512027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, const sc_unsigned& v); 165612027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, int64 v); 165712027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, uint64 v); 165812027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, long v); 165912027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, unsigned long v); 166012027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, int v) 166112027Sjungma@eit.uni-kl.de { return operator>>(u, (long) v); } 166212027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> (const sc_unsigned& u, unsigned int v) 166312027Sjungma@eit.uni-kl.de { return operator>>(u, (unsigned long) v); } 166412027Sjungma@eit.uni-kl.de 166512027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (const sc_signed& v); 166612027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (const sc_unsigned& v); 166712027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (int64 v); 166812027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (uint64 v); 166912027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (long v); 167012027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (unsigned long v); 167112027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (int v) 167212027Sjungma@eit.uni-kl.de { return operator>>=((long) v); } 167312027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (unsigned int v) 167412027Sjungma@eit.uni-kl.de { return operator>>=((unsigned long) v); } 167512027Sjungma@eit.uni-kl.de 167612027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> ( const sc_unsigned& , const sc_uint_base& ); 167712027Sjungma@eit.uni-kl.de friend sc_unsigned operator >> ( const sc_unsigned&, const sc_int_base& ); 167812027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (const sc_int_base& v); 167912027Sjungma@eit.uni-kl.de const sc_unsigned& operator >>= (const sc_uint_base& v); 168012027Sjungma@eit.uni-kl.de 168112027Sjungma@eit.uni-kl.de // Unary arithmetic operators 168212027Sjungma@eit.uni-kl.de friend sc_unsigned operator + (const sc_unsigned& u); 168312027Sjungma@eit.uni-kl.de friend sc_signed operator - (const sc_unsigned& u); 168412027Sjungma@eit.uni-kl.de 168512027Sjungma@eit.uni-kl.de // LOGICAL OPERATORS: 168612027Sjungma@eit.uni-kl.de 168712027Sjungma@eit.uni-kl.de // Logical EQUAL operators: 168812027Sjungma@eit.uni-kl.de 168912027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, const sc_signed& v); 169012027Sjungma@eit.uni-kl.de friend bool operator == (const sc_signed& u, const sc_unsigned& v); 169112027Sjungma@eit.uni-kl.de 169212027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, const sc_unsigned& v); 169312027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, int64 v); 169412027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, uint64 v); 169512027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, long v); 169612027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, unsigned long v); 169712027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, int v) 169812027Sjungma@eit.uni-kl.de { return operator==(u, (long) v); } 169912027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, unsigned int v) 170012027Sjungma@eit.uni-kl.de { return operator==(u, (unsigned long) v); } 170112027Sjungma@eit.uni-kl.de 170212027Sjungma@eit.uni-kl.de friend bool operator == (int64 u, const sc_unsigned& v); 170312027Sjungma@eit.uni-kl.de friend bool operator == (uint64 u, const sc_unsigned& v); 170412027Sjungma@eit.uni-kl.de friend bool operator == (long u, const sc_unsigned& v); 170512027Sjungma@eit.uni-kl.de friend bool operator == (unsigned long u, const sc_unsigned& v); 170612027Sjungma@eit.uni-kl.de friend bool operator == (int u, const sc_unsigned& v) 170712027Sjungma@eit.uni-kl.de { return operator==((long) u, v); } 170812027Sjungma@eit.uni-kl.de friend bool operator == (unsigned int u, const sc_unsigned& v) 170912027Sjungma@eit.uni-kl.de { return operator==((unsigned long) u, v); } 171012027Sjungma@eit.uni-kl.de 171112027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, const sc_uint_base& v); 171212027Sjungma@eit.uni-kl.de friend bool operator == (const sc_unsigned& u, const sc_int_base& v); 171312027Sjungma@eit.uni-kl.de friend bool operator == (const sc_uint_base& u, const sc_unsigned& v); 171412027Sjungma@eit.uni-kl.de friend bool operator == (const sc_int_base& u, const sc_unsigned& v); 171512027Sjungma@eit.uni-kl.de 171612027Sjungma@eit.uni-kl.de // Logical NOT_EQUAL operators: 171712027Sjungma@eit.uni-kl.de 171812027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, const sc_signed& v); 171912027Sjungma@eit.uni-kl.de friend bool operator != (const sc_signed& u, const sc_unsigned& v); 172012027Sjungma@eit.uni-kl.de 172112027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, const sc_unsigned& v); 172212027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, int64 v); 172312027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, uint64 v); 172412027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, long v); 172512027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, unsigned long v); 172612027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, int v) 172712027Sjungma@eit.uni-kl.de { return operator!=(u, (long) v); } 172812027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, unsigned int v) 172912027Sjungma@eit.uni-kl.de { return operator!=(u, (unsigned long) v); } 173012027Sjungma@eit.uni-kl.de 173112027Sjungma@eit.uni-kl.de friend bool operator != (int64 u, const sc_unsigned& v); 173212027Sjungma@eit.uni-kl.de friend bool operator != (uint64 u, const sc_unsigned& v); 173312027Sjungma@eit.uni-kl.de friend bool operator != (long u, const sc_unsigned& v); 173412027Sjungma@eit.uni-kl.de friend bool operator != (unsigned long u, const sc_unsigned& v); 173512027Sjungma@eit.uni-kl.de friend bool operator != (int u, const sc_unsigned& v) 173612027Sjungma@eit.uni-kl.de { return operator!=((long) u, v); } 173712027Sjungma@eit.uni-kl.de friend bool operator != (unsigned int u, const sc_unsigned& v) 173812027Sjungma@eit.uni-kl.de { return operator!=((unsigned long) u, v); } 173912027Sjungma@eit.uni-kl.de 174012027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, const sc_uint_base& v); 174112027Sjungma@eit.uni-kl.de friend bool operator != (const sc_unsigned& u, const sc_int_base& v); 174212027Sjungma@eit.uni-kl.de friend bool operator != (const sc_uint_base& u, const sc_unsigned& v); 174312027Sjungma@eit.uni-kl.de friend bool operator != (const sc_int_base& u, const sc_unsigned& v); 174412027Sjungma@eit.uni-kl.de 174512027Sjungma@eit.uni-kl.de // Logical LESS_THAN operators: 174612027Sjungma@eit.uni-kl.de 174712027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, const sc_signed& v); 174812027Sjungma@eit.uni-kl.de friend bool operator < (const sc_signed& u, const sc_unsigned& v); 174912027Sjungma@eit.uni-kl.de 175012027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, const sc_unsigned& v); 175112027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, int64 v); 175212027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, uint64 v); 175312027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, long v); 175412027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, unsigned long v); 175512027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, int v) 175612027Sjungma@eit.uni-kl.de { return operator<(u, (long) v); } 175712027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, unsigned int v) 175812027Sjungma@eit.uni-kl.de { return operator<(u, (unsigned long) v); } 175912027Sjungma@eit.uni-kl.de 176012027Sjungma@eit.uni-kl.de friend bool operator < (int64 u, const sc_unsigned& v); 176112027Sjungma@eit.uni-kl.de friend bool operator < (uint64 u, const sc_unsigned& v); 176212027Sjungma@eit.uni-kl.de friend bool operator < (long u, const sc_unsigned& v); 176312027Sjungma@eit.uni-kl.de friend bool operator < (unsigned long u, const sc_unsigned& v); 176412027Sjungma@eit.uni-kl.de friend bool operator < (int u, const sc_unsigned& v) 176512027Sjungma@eit.uni-kl.de { return operator<((long) u, v); } 176612027Sjungma@eit.uni-kl.de friend bool operator < (unsigned int u, const sc_unsigned& v) 176712027Sjungma@eit.uni-kl.de { return operator<((unsigned long) u, v); } 176812027Sjungma@eit.uni-kl.de 176912027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, const sc_uint_base& v); 177012027Sjungma@eit.uni-kl.de friend bool operator < (const sc_unsigned& u, const sc_int_base& v); 177112027Sjungma@eit.uni-kl.de friend bool operator < (const sc_uint_base& u, const sc_unsigned& v); 177212027Sjungma@eit.uni-kl.de friend bool operator < (const sc_int_base& u, const sc_unsigned& v); 177312027Sjungma@eit.uni-kl.de 177412027Sjungma@eit.uni-kl.de // Logical LESS_THAN_AND_EQUAL operators: 177512027Sjungma@eit.uni-kl.de 177612027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, const sc_signed& v); 177712027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_signed& u, const sc_unsigned& v); 177812027Sjungma@eit.uni-kl.de 177912027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, const sc_unsigned& v); 178012027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, int64 v); 178112027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, uint64 v); 178212027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, long v); 178312027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, unsigned long v); 178412027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, int v) 178512027Sjungma@eit.uni-kl.de { return operator<=(u, (long) v); } 178612027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, unsigned int v) 178712027Sjungma@eit.uni-kl.de { return operator<=(u, (unsigned long) v); } 178812027Sjungma@eit.uni-kl.de 178912027Sjungma@eit.uni-kl.de friend bool operator <= (int64 u, const sc_unsigned& v); 179012027Sjungma@eit.uni-kl.de friend bool operator <= (uint64 u, const sc_unsigned& v); 179112027Sjungma@eit.uni-kl.de friend bool operator <= (long u, const sc_unsigned& v); 179212027Sjungma@eit.uni-kl.de friend bool operator <= (unsigned long u, const sc_unsigned& v); 179312027Sjungma@eit.uni-kl.de friend bool operator <= (int u, const sc_unsigned& v) 179412027Sjungma@eit.uni-kl.de { return operator<=((long) u, v); } 179512027Sjungma@eit.uni-kl.de friend bool operator <= (unsigned int u, const sc_unsigned& v) 179612027Sjungma@eit.uni-kl.de { return operator<=((unsigned long) u, v); } 179712027Sjungma@eit.uni-kl.de 179812027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, const sc_uint_base& v); 179912027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_unsigned& u, const sc_int_base& v); 180012027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_uint_base& u, const sc_unsigned& v); 180112027Sjungma@eit.uni-kl.de friend bool operator <= (const sc_int_base& u, const sc_unsigned& v); 180212027Sjungma@eit.uni-kl.de 180312027Sjungma@eit.uni-kl.de // Logical GREATER_THAN operators: 180412027Sjungma@eit.uni-kl.de 180512027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, const sc_signed& v); 180612027Sjungma@eit.uni-kl.de friend bool operator > (const sc_signed& u, const sc_unsigned& v); 180712027Sjungma@eit.uni-kl.de 180812027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, const sc_unsigned& v); 180912027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, int64 v); 181012027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, uint64 v); 181112027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, long v); 181212027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, unsigned long v); 181312027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, int v) 181412027Sjungma@eit.uni-kl.de { return operator>(u, (long) v); } 181512027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, unsigned int v) 181612027Sjungma@eit.uni-kl.de { return operator>(u, (unsigned long) v); } 181712027Sjungma@eit.uni-kl.de 181812027Sjungma@eit.uni-kl.de friend bool operator > (int64 u, const sc_unsigned& v); 181912027Sjungma@eit.uni-kl.de friend bool operator > (uint64 u, const sc_unsigned& v); 182012027Sjungma@eit.uni-kl.de friend bool operator > (long u, const sc_unsigned& v); 182112027Sjungma@eit.uni-kl.de friend bool operator > (unsigned long u, const sc_unsigned& v); 182212027Sjungma@eit.uni-kl.de friend bool operator > (int u, const sc_unsigned& v) 182312027Sjungma@eit.uni-kl.de { return operator>((long) u, v); } 182412027Sjungma@eit.uni-kl.de friend bool operator > (unsigned int u, const sc_unsigned& v) 182512027Sjungma@eit.uni-kl.de { return operator>((unsigned long) u, v); } 182612027Sjungma@eit.uni-kl.de 182712027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, const sc_uint_base& v); 182812027Sjungma@eit.uni-kl.de friend bool operator > (const sc_unsigned& u, const sc_int_base& v); 182912027Sjungma@eit.uni-kl.de friend bool operator > (const sc_uint_base& u, const sc_unsigned& v); 183012027Sjungma@eit.uni-kl.de friend bool operator > (const sc_int_base& u, const sc_unsigned& v); 183112027Sjungma@eit.uni-kl.de 183212027Sjungma@eit.uni-kl.de // Logical GREATER_THAN_AND_EQUAL operators: 183312027Sjungma@eit.uni-kl.de 183412027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, const sc_signed& v); 183512027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_signed& u, const sc_unsigned& v); 183612027Sjungma@eit.uni-kl.de 183712027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, const sc_unsigned& v); 183812027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, int64 v); 183912027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, uint64 v); 184012027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, long v); 184112027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, unsigned long v); 184212027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, int v) 184312027Sjungma@eit.uni-kl.de { return operator>=(u, (long) v); } 184412027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, unsigned int v) 184512027Sjungma@eit.uni-kl.de { return operator>=(u, (unsigned long) v); } 184612027Sjungma@eit.uni-kl.de 184712027Sjungma@eit.uni-kl.de friend bool operator >= (int64 u, const sc_unsigned& v); 184812027Sjungma@eit.uni-kl.de friend bool operator >= (uint64 u, const sc_unsigned& v); 184912027Sjungma@eit.uni-kl.de friend bool operator >= (long u, const sc_unsigned& v); 185012027Sjungma@eit.uni-kl.de friend bool operator >= (unsigned long u, const sc_unsigned& v); 185112027Sjungma@eit.uni-kl.de friend bool operator >= (int u, const sc_unsigned& v) 185212027Sjungma@eit.uni-kl.de { return operator>=((long) u, v); } 185312027Sjungma@eit.uni-kl.de friend bool operator >= (unsigned int u, const sc_unsigned& v) 185412027Sjungma@eit.uni-kl.de { return operator>=((unsigned long) u, v); } 185512027Sjungma@eit.uni-kl.de 185612027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, const sc_uint_base& v); 185712027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_unsigned& u, const sc_int_base& v); 185812027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_uint_base& u, const sc_unsigned& v); 185912027Sjungma@eit.uni-kl.de friend bool operator >= (const sc_int_base& u, const sc_unsigned& v); 186012027Sjungma@eit.uni-kl.de 186112027Sjungma@eit.uni-kl.de // Bitwise NOT operator (unary). 186212027Sjungma@eit.uni-kl.de friend sc_unsigned operator ~ (const sc_unsigned& u); 186312027Sjungma@eit.uni-kl.de 186412027Sjungma@eit.uni-kl.de // Helper functions. 186512027Sjungma@eit.uni-kl.de friend int compare_unsigned(small_type us, 186612027Sjungma@eit.uni-kl.de int unb, 186712027Sjungma@eit.uni-kl.de int und, 186812027Sjungma@eit.uni-kl.de const sc_digit *ud, 186912027Sjungma@eit.uni-kl.de small_type vs, 187012027Sjungma@eit.uni-kl.de int vnb, 187112027Sjungma@eit.uni-kl.de int vnd, 187212027Sjungma@eit.uni-kl.de const sc_digit *vd, 187312027Sjungma@eit.uni-kl.de small_type if_u_signed, 187412027Sjungma@eit.uni-kl.de small_type if_v_signed); 187512027Sjungma@eit.uni-kl.de 187612027Sjungma@eit.uni-kl.de friend sc_unsigned add_unsigned_friend(small_type us, 187712027Sjungma@eit.uni-kl.de int unb, 187812027Sjungma@eit.uni-kl.de int und, 187912027Sjungma@eit.uni-kl.de const sc_digit *ud, 188012027Sjungma@eit.uni-kl.de small_type vs, 188112027Sjungma@eit.uni-kl.de int vnb, 188212027Sjungma@eit.uni-kl.de int vnd, 188312027Sjungma@eit.uni-kl.de const sc_digit *vd); 188412027Sjungma@eit.uni-kl.de 188512027Sjungma@eit.uni-kl.de friend sc_unsigned sub_unsigned_friend(small_type us, 188612027Sjungma@eit.uni-kl.de int unb, 188712027Sjungma@eit.uni-kl.de int und, 188812027Sjungma@eit.uni-kl.de const sc_digit *ud, 188912027Sjungma@eit.uni-kl.de small_type vs, 189012027Sjungma@eit.uni-kl.de int vnb, 189112027Sjungma@eit.uni-kl.de int vnd, 189212027Sjungma@eit.uni-kl.de const sc_digit *vd); 189312027Sjungma@eit.uni-kl.de 189412027Sjungma@eit.uni-kl.de friend sc_unsigned mul_unsigned_friend(small_type s, 189512027Sjungma@eit.uni-kl.de int unb, 189612027Sjungma@eit.uni-kl.de int und, 189712027Sjungma@eit.uni-kl.de const sc_digit *ud, 189812027Sjungma@eit.uni-kl.de int vnb, 189912027Sjungma@eit.uni-kl.de int vnd, 190012027Sjungma@eit.uni-kl.de const sc_digit *vd); 190112027Sjungma@eit.uni-kl.de 190212027Sjungma@eit.uni-kl.de friend sc_unsigned div_unsigned_friend(small_type s, 190312027Sjungma@eit.uni-kl.de int unb, 190412027Sjungma@eit.uni-kl.de int und, 190512027Sjungma@eit.uni-kl.de const sc_digit *ud, 190612027Sjungma@eit.uni-kl.de int vnb, 190712027Sjungma@eit.uni-kl.de int vnd, 190812027Sjungma@eit.uni-kl.de const sc_digit *vd); 190912027Sjungma@eit.uni-kl.de 191012027Sjungma@eit.uni-kl.de friend sc_unsigned mod_unsigned_friend(small_type us, 191112027Sjungma@eit.uni-kl.de int unb, 191212027Sjungma@eit.uni-kl.de int und, 191312027Sjungma@eit.uni-kl.de const sc_digit *ud, 191412027Sjungma@eit.uni-kl.de int vnb, 191512027Sjungma@eit.uni-kl.de int vnd, 191612027Sjungma@eit.uni-kl.de const sc_digit *vd); 191712027Sjungma@eit.uni-kl.de 191812027Sjungma@eit.uni-kl.de friend sc_unsigned and_unsigned_friend(small_type us, 191912027Sjungma@eit.uni-kl.de int unb, 192012027Sjungma@eit.uni-kl.de int und, 192112027Sjungma@eit.uni-kl.de const sc_digit *ud, 192212027Sjungma@eit.uni-kl.de small_type vs, 192312027Sjungma@eit.uni-kl.de int vnb, 192412027Sjungma@eit.uni-kl.de int vnd, 192512027Sjungma@eit.uni-kl.de const sc_digit *vd); 192612027Sjungma@eit.uni-kl.de 192712027Sjungma@eit.uni-kl.de friend sc_unsigned or_unsigned_friend(small_type us, 192812027Sjungma@eit.uni-kl.de int unb, 192912027Sjungma@eit.uni-kl.de int und, 193012027Sjungma@eit.uni-kl.de const sc_digit *ud, 193112027Sjungma@eit.uni-kl.de small_type vs, 193212027Sjungma@eit.uni-kl.de int vnb, 193312027Sjungma@eit.uni-kl.de int vnd, 193412027Sjungma@eit.uni-kl.de const sc_digit *vd); 193512027Sjungma@eit.uni-kl.de 193612027Sjungma@eit.uni-kl.de friend sc_unsigned xor_unsigned_friend(small_type us, 193712027Sjungma@eit.uni-kl.de int unb, 193812027Sjungma@eit.uni-kl.de int und, 193912027Sjungma@eit.uni-kl.de const sc_digit *ud, 194012027Sjungma@eit.uni-kl.de small_type vs, 194112027Sjungma@eit.uni-kl.de int vnb, 194212027Sjungma@eit.uni-kl.de int vnd, 194312027Sjungma@eit.uni-kl.de const sc_digit *vd); 194412027Sjungma@eit.uni-kl.de 194512027Sjungma@eit.uni-kl.depublic: 194612027Sjungma@eit.uni-kl.de static sc_core::sc_vpool<sc_unsigned> m_pool; 194712027Sjungma@eit.uni-kl.de 194812027Sjungma@eit.uni-kl.deprivate: 194912027Sjungma@eit.uni-kl.de 195012027Sjungma@eit.uni-kl.de small_type sgn; // Shortened as s. 195112027Sjungma@eit.uni-kl.de int nbits; // Shortened as nb. 195212027Sjungma@eit.uni-kl.de int ndigits; // Shortened as nd. 195312027Sjungma@eit.uni-kl.de 195412027Sjungma@eit.uni-kl.de#ifdef SC_MAX_NBITS 195512027Sjungma@eit.uni-kl.de sc_digit digit[DIV_CEIL(SC_MAX_NBITS)]; // Shortened as d. 195612027Sjungma@eit.uni-kl.de#else 195712027Sjungma@eit.uni-kl.de sc_digit *digit; // Shortened as d. 195812027Sjungma@eit.uni-kl.de#endif 195912027Sjungma@eit.uni-kl.de 196012027Sjungma@eit.uni-kl.de // Private constructors: 196112027Sjungma@eit.uni-kl.de 196212027Sjungma@eit.uni-kl.de // Create a copy of v with sign s. 196312027Sjungma@eit.uni-kl.de sc_unsigned(const sc_unsigned& v, small_type s); 196412027Sjungma@eit.uni-kl.de sc_unsigned(const sc_signed& v, small_type s); 196512027Sjungma@eit.uni-kl.de 196612027Sjungma@eit.uni-kl.de // Create an unsigned number with the given attributes. 196712027Sjungma@eit.uni-kl.de sc_unsigned(small_type s, int nb, int nd, 196812027Sjungma@eit.uni-kl.de sc_digit *d, bool alloc = true); 196912027Sjungma@eit.uni-kl.de 197012027Sjungma@eit.uni-kl.de // Create an unsigned number using the bits u[l..r]. 197112027Sjungma@eit.uni-kl.de sc_unsigned(const sc_signed* u, int l, int r); 197212027Sjungma@eit.uni-kl.de sc_unsigned(const sc_unsigned* u, int l, int r); 197312027Sjungma@eit.uni-kl.de 197412027Sjungma@eit.uni-kl.de // Private member functions. The called functions are inline functions. 197512027Sjungma@eit.uni-kl.de 197612027Sjungma@eit.uni-kl.de small_type default_sign() const 197712027Sjungma@eit.uni-kl.de { return SC_POS; } 197812027Sjungma@eit.uni-kl.de 197912027Sjungma@eit.uni-kl.de int num_bits(int nb) const { return nb + 1; } 198012027Sjungma@eit.uni-kl.de 198112027Sjungma@eit.uni-kl.de bool check_if_outside(int bit_num) const; 198212027Sjungma@eit.uni-kl.de 198312027Sjungma@eit.uni-kl.de void copy_digits(int nb, int nd, const sc_digit *d) 198412027Sjungma@eit.uni-kl.de { copy_digits_unsigned(sgn, nbits, ndigits, digit, nb, nd, d); } 198512027Sjungma@eit.uni-kl.de 198612027Sjungma@eit.uni-kl.de void makezero() 198712027Sjungma@eit.uni-kl.de { sgn = make_zero(ndigits, digit); } 198812027Sjungma@eit.uni-kl.de 198912027Sjungma@eit.uni-kl.de // Conversion functions between 2's complement (2C) and 199012027Sjungma@eit.uni-kl.de // sign-magnitude (SM): 199112027Sjungma@eit.uni-kl.de void convert_2C_to_SM() 199212027Sjungma@eit.uni-kl.de { sgn = convert_unsigned_2C_to_SM(nbits, ndigits, digit); } 199312027Sjungma@eit.uni-kl.de 199412027Sjungma@eit.uni-kl.de void convert_SM_to_2C_to_SM() 199512027Sjungma@eit.uni-kl.de { sgn = convert_unsigned_SM_to_2C_to_SM(sgn, nbits, ndigits, digit); } 199612027Sjungma@eit.uni-kl.de 199712027Sjungma@eit.uni-kl.de void convert_SM_to_2C() 199812027Sjungma@eit.uni-kl.de { convert_unsigned_SM_to_2C(sgn, ndigits, digit); } 199912027Sjungma@eit.uni-kl.de 200012027Sjungma@eit.uni-kl.de}; 200112027Sjungma@eit.uni-kl.de 200212027Sjungma@eit.uni-kl.de 200312027Sjungma@eit.uni-kl.de 200412027Sjungma@eit.uni-kl.deinline 200512027Sjungma@eit.uni-kl.de::std::ostream& 200612027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream&, const sc_unsigned& ); 200712027Sjungma@eit.uni-kl.de 200812027Sjungma@eit.uni-kl.deinline 200912027Sjungma@eit.uni-kl.de::std::istream& 201012027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream&, sc_unsigned& ); 201112027Sjungma@eit.uni-kl.de 201212027Sjungma@eit.uni-kl.de 201312027Sjungma@eit.uni-kl.de// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 201412027Sjungma@eit.uni-kl.de 201512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 201612027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_bitref_r 201712027Sjungma@eit.uni-kl.de// 201812027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned bit selection (r-value only). 201912027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 202012027Sjungma@eit.uni-kl.de 202112027Sjungma@eit.uni-kl.de 202212027Sjungma@eit.uni-kl.deinline 202312027Sjungma@eit.uni-kl.de::std::ostream& 202412027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream& os, const sc_unsigned_bitref_r& a ) 202512027Sjungma@eit.uni-kl.de{ 202612027Sjungma@eit.uni-kl.de a.print( os ); 202712027Sjungma@eit.uni-kl.de return os; 202812027Sjungma@eit.uni-kl.de} 202912027Sjungma@eit.uni-kl.de 203012027Sjungma@eit.uni-kl.de 203112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 203212027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_bitref 203312027Sjungma@eit.uni-kl.de// 203412027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned bit selection (r-value and l-value). 203512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 203612027Sjungma@eit.uni-kl.de 203712027Sjungma@eit.uni-kl.detemplate<class T> 203812027Sjungma@eit.uni-kl.deinline const sc_unsigned_subref& sc_unsigned_subref::operator = ( 203912027Sjungma@eit.uni-kl.de const sc_generic_base<T>& a ) 204012027Sjungma@eit.uni-kl.de{ 204112027Sjungma@eit.uni-kl.de sc_unsigned temp( length() ); 204212027Sjungma@eit.uni-kl.de a->to_sc_unsigned(temp); 204312027Sjungma@eit.uni-kl.de return *this = temp; 204412027Sjungma@eit.uni-kl.de} 204512027Sjungma@eit.uni-kl.de 204612027Sjungma@eit.uni-kl.deinline 204712027Sjungma@eit.uni-kl.de::std::istream& 204812027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream& is, sc_unsigned_bitref& a ) 204912027Sjungma@eit.uni-kl.de{ 205012027Sjungma@eit.uni-kl.de a.scan( is ); 205112027Sjungma@eit.uni-kl.de return is; 205212027Sjungma@eit.uni-kl.de} 205312027Sjungma@eit.uni-kl.de 205412027Sjungma@eit.uni-kl.de 205512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 205612027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_subref_r 205712027Sjungma@eit.uni-kl.de// 205812027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned part selection (r-value only). 205912027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 206012027Sjungma@eit.uni-kl.de 206112027Sjungma@eit.uni-kl.de// reduce methods 206212027Sjungma@eit.uni-kl.de 206312027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::and_reduce() const 206412027Sjungma@eit.uni-kl.de{ 206512027Sjungma@eit.uni-kl.de const sc_unsigned* target_p = m_obj_p; 206612027Sjungma@eit.uni-kl.de for ( int i = m_right; i <= m_left; i++ ) 206712027Sjungma@eit.uni-kl.de if ( !target_p->test(i) ) return false; 206812027Sjungma@eit.uni-kl.de return true; 206912027Sjungma@eit.uni-kl.de} 207012027Sjungma@eit.uni-kl.de 207112027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::nand_reduce() const 207212027Sjungma@eit.uni-kl.de{ 207312027Sjungma@eit.uni-kl.de return !and_reduce(); 207412027Sjungma@eit.uni-kl.de} 207512027Sjungma@eit.uni-kl.de 207612027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::or_reduce() const 207712027Sjungma@eit.uni-kl.de{ 207812027Sjungma@eit.uni-kl.de const sc_unsigned* target_p = m_obj_p; 207912027Sjungma@eit.uni-kl.de for ( int i = m_right; i <= m_left; i++ ) 208012027Sjungma@eit.uni-kl.de if ( target_p->test(i) ) return true; 208112027Sjungma@eit.uni-kl.de return false; 208212027Sjungma@eit.uni-kl.de} 208312027Sjungma@eit.uni-kl.de 208412027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::nor_reduce() const 208512027Sjungma@eit.uni-kl.de{ 208612027Sjungma@eit.uni-kl.de return !or_reduce(); 208712027Sjungma@eit.uni-kl.de} 208812027Sjungma@eit.uni-kl.de 208912027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::xor_reduce() const 209012027Sjungma@eit.uni-kl.de{ 209112027Sjungma@eit.uni-kl.de int odd; 209212027Sjungma@eit.uni-kl.de const sc_unsigned* target_p = m_obj_p; 209312027Sjungma@eit.uni-kl.de odd = 0; 209412027Sjungma@eit.uni-kl.de for ( int i = m_right; i <= m_left; i++ ) 209512027Sjungma@eit.uni-kl.de if ( target_p->test(i) ) odd = ~odd; 209612027Sjungma@eit.uni-kl.de return odd ? true : false; 209712027Sjungma@eit.uni-kl.de} 209812027Sjungma@eit.uni-kl.de 209912027Sjungma@eit.uni-kl.deinline bool sc_unsigned_subref_r::xnor_reduce() const 210012027Sjungma@eit.uni-kl.de{ 210112027Sjungma@eit.uni-kl.de return !xor_reduce(); 210212027Sjungma@eit.uni-kl.de} 210312027Sjungma@eit.uni-kl.de 210412027Sjungma@eit.uni-kl.de 210512027Sjungma@eit.uni-kl.deinline 210612027Sjungma@eit.uni-kl.de::std::ostream& 210712027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream& os, const sc_unsigned_subref_r& a ) 210812027Sjungma@eit.uni-kl.de{ 210912027Sjungma@eit.uni-kl.de a.print( os ); 211012027Sjungma@eit.uni-kl.de return os; 211112027Sjungma@eit.uni-kl.de} 211212027Sjungma@eit.uni-kl.de 211312027Sjungma@eit.uni-kl.de 211412027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 211512027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned_subref 211612027Sjungma@eit.uni-kl.de// 211712027Sjungma@eit.uni-kl.de// Proxy class for sc_unsigned part selection (r-value and l-value). 211812027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 211912027Sjungma@eit.uni-kl.de 212012027Sjungma@eit.uni-kl.de// assignment operators 212112027Sjungma@eit.uni-kl.de 212212027Sjungma@eit.uni-kl.deinline 212312027Sjungma@eit.uni-kl.deconst sc_unsigned_subref& 212412027Sjungma@eit.uni-kl.desc_unsigned_subref::operator = ( const char* a ) 212512027Sjungma@eit.uni-kl.de{ 212612027Sjungma@eit.uni-kl.de sc_unsigned aa( length() ); 212712027Sjungma@eit.uni-kl.de return ( *this = aa = a ); 212812027Sjungma@eit.uni-kl.de} 212912027Sjungma@eit.uni-kl.de 213012027Sjungma@eit.uni-kl.de 213112027Sjungma@eit.uni-kl.deinline 213212027Sjungma@eit.uni-kl.de::std::istream& 213312027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream& is, sc_unsigned_subref& a ) 213412027Sjungma@eit.uni-kl.de{ 213512027Sjungma@eit.uni-kl.de a.scan( is ); 213612027Sjungma@eit.uni-kl.de return is; 213712027Sjungma@eit.uni-kl.de} 213812027Sjungma@eit.uni-kl.de 213912027Sjungma@eit.uni-kl.de 214012027Sjungma@eit.uni-kl.de 214112027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 214212027Sjungma@eit.uni-kl.de// CLASS : sc_unsigned 214312027Sjungma@eit.uni-kl.de// 214412027Sjungma@eit.uni-kl.de// Arbitrary precision signed number. 214512027Sjungma@eit.uni-kl.de// ---------------------------------------------------------------------------- 214612027Sjungma@eit.uni-kl.de 214712027Sjungma@eit.uni-kl.detemplate<class T> 214812027Sjungma@eit.uni-kl.desc_unsigned::sc_unsigned( const sc_generic_base<T>& v ) 214912027Sjungma@eit.uni-kl.de{ 215012027Sjungma@eit.uni-kl.de int nb = v->length(); 215112027Sjungma@eit.uni-kl.de sgn = default_sign(); 215212027Sjungma@eit.uni-kl.de if( nb > 0 ) { 215312027Sjungma@eit.uni-kl.de nbits = num_bits( nb ); 215412027Sjungma@eit.uni-kl.de } else { 215512027Sjungma@eit.uni-kl.de char msg[BUFSIZ]; 215612027Sjungma@eit.uni-kl.de std::sprintf( msg, 215712027Sjungma@eit.uni-kl.de "sc_unsigned( sc_generic_base<T> ) : nb = %d is not valid", nb); 215812027Sjungma@eit.uni-kl.de SC_REPORT_ERROR( sc_core::SC_ID_INIT_FAILED_, msg ); 215912027Sjungma@eit.uni-kl.de } 216012027Sjungma@eit.uni-kl.de ndigits = DIV_CEIL(nbits); 216112027Sjungma@eit.uni-kl.de# ifdef SC_MAX_NBITS 216212027Sjungma@eit.uni-kl.de test_bound(nb); 216312027Sjungma@eit.uni-kl.de# else 216412027Sjungma@eit.uni-kl.de digit = new sc_digit[ndigits]; 216512027Sjungma@eit.uni-kl.de# endif 216612027Sjungma@eit.uni-kl.de makezero(); 216712027Sjungma@eit.uni-kl.de v->to_sc_unsigned(*this); 216812027Sjungma@eit.uni-kl.de} 216912027Sjungma@eit.uni-kl.de 217012027Sjungma@eit.uni-kl.de 217112027Sjungma@eit.uni-kl.deinline 217212027Sjungma@eit.uni-kl.de::std::ostream& 217312027Sjungma@eit.uni-kl.deoperator << ( ::std::ostream& os, const sc_unsigned& a ) 217412027Sjungma@eit.uni-kl.de{ 217512027Sjungma@eit.uni-kl.de a.print( os ); 217612027Sjungma@eit.uni-kl.de return os; 217712027Sjungma@eit.uni-kl.de} 217812027Sjungma@eit.uni-kl.de 217912027Sjungma@eit.uni-kl.deinline 218012027Sjungma@eit.uni-kl.de::std::istream& 218112027Sjungma@eit.uni-kl.deoperator >> ( ::std::istream& is, sc_unsigned& a ) 218212027Sjungma@eit.uni-kl.de{ 218312027Sjungma@eit.uni-kl.de a.scan( is ); 218412027Sjungma@eit.uni-kl.de return is; 218512027Sjungma@eit.uni-kl.de} 218612027Sjungma@eit.uni-kl.de 218712027Sjungma@eit.uni-kl.de 218812027Sjungma@eit.uni-kl.de} // namespace sc_dt 218912027Sjungma@eit.uni-kl.de 219012027Sjungma@eit.uni-kl.de 219112027Sjungma@eit.uni-kl.de#endif 2192