⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sc_fxnum.h

📁 system C源码 一种替代verilog的语言
💻 H
📖 第 1 页 / 共 5 页
字号:
/*****************************************************************************  The following code is derived, directly or indirectly, from the SystemC  source code Copyright (c) 1996-2006 by all Contributors.  All Rights reserved.  The contents of this file are subject to the restrictions and limitations  set forth in the SystemC Open Source License Version 2.4 (the "License");  You may not use this file except in compliance with such restrictions and  limitations. You may obtain instructions on how to receive a copy of the  License at http://www.systemc.org/. Software distributed by Contributors  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or implied. See the License for the specific  language governing rights and limitations under the License. *****************************************************************************//*****************************************************************************  sc_fxnum.h -   Original Author: Martin Janssen, Synopsys, Inc. *****************************************************************************//*****************************************************************************  MODIFICATION LOG - modifiers, enter your name, affiliation, date and  changes you are making here.      Name, Affiliation, Date:  Description of Modification: *****************************************************************************/// $Log: sc_fxnum.h,v $// Revision 1.1.1.1  2006/12/15 20:31:36  acg// SystemC 2.2//// Revision 1.3  2006/01/13 18:53:58  acg// Andy Goodrich: added $Log command so that CVS comments are reproduced in// the source.//#ifndef SC_FXNUM_H#define SC_FXNUM_H#include "sysc/datatypes/bit/sc_lv_base.h"#include "sysc/datatypes/fx/sc_fxval.h"#include "sysc/datatypes/fx/scfx_params.h"#include "sysc/datatypes/fx/sc_fxnum_observer.h"namespace sc_core {	class vcd_sc_fxnum_trace;	class vcd_sc_fxnum_fast_trace;	class wif_sc_fxnum_trace;	class wif_sc_fxnum_fast_trace;};namespace sc_dt{// classes defined in this moduleclass sc_fxnum_bitref;class sc_fxnum_fast_bitref;class sc_fxnum_subref;class sc_fxnum_fast_subref;class sc_fxnum;class sc_fxnum_fast;// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_bitref////  Proxy class for bit-selection in class sc_fxnum, behaves like sc_bit.// ----------------------------------------------------------------------------class sc_fxnum_bitref{    friend class sc_fxnum;    friend class sc_fxnum_fast_bitref;    bool get() const;    void set( bool );    // constructor    sc_fxnum_bitref( sc_fxnum&, int );public:    // copy constructor    sc_fxnum_bitref( const sc_fxnum_bitref& );    // assignment operators#define DECL_ASN_OP_T(op,tp)                                                  \    sc_fxnum_bitref& operator op ( tp );#define DECL_ASN_OP(op)                                                       \    DECL_ASN_OP_T(op,const sc_fxnum_bitref&)                                  \    DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&)                             \    DECL_ASN_OP_T(op,const sc_bit&)                                           \    DECL_ASN_OP_T(op,bool)    DECL_ASN_OP(=)    DECL_ASN_OP(&=)    DECL_ASN_OP(|=)    DECL_ASN_OP(^=)#undef DECL_ASN_OP_T#undef DECL_ASN_OP    // implicit conversion    operator bool() const;    // print or dump content    void print( ::std::ostream& = ::std::cout ) const;    void scan( ::std::istream& = ::std::cin );    void dump( ::std::ostream& = ::std::cout ) const;private:    sc_fxnum& m_num;    int       m_idx;private:    // disabled    sc_fxnum_bitref();};// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_fast_bitref////  Proxy class for bit-selection in class sc_fxnum_fast, behaves like sc_bit.// ----------------------------------------------------------------------------class sc_fxnum_fast_bitref{    friend class sc_fxnum_fast;    friend class sc_fxnum_bitref;    bool get() const;    void set( bool );    // constructor    sc_fxnum_fast_bitref( sc_fxnum_fast&, int );public:    // copy constructor    sc_fxnum_fast_bitref( const sc_fxnum_fast_bitref& );    // assignment operators#define DECL_ASN_OP_T(op,tp)                                                  \    sc_fxnum_fast_bitref& operator op ( tp );#define DECL_ASN_OP(op)                                                       \    DECL_ASN_OP_T(op,const sc_fxnum_bitref&)                                  \    DECL_ASN_OP_T(op,const sc_fxnum_fast_bitref&)                             \    DECL_ASN_OP_T(op,const sc_bit&)                                           \    DECL_ASN_OP_T(op,bool)    DECL_ASN_OP(=)    DECL_ASN_OP(&=)    DECL_ASN_OP(|=)    DECL_ASN_OP(^=)#undef DECL_ASN_OP_T#undef DECL_ASN_OP    // implicit conversion    operator bool() const;    // print or dump content    void print( ::std::ostream& = ::std::cout ) const;    void scan( ::std::istream& = ::std::cin );    void dump( ::std::ostream& = ::std::cout ) const;private:    sc_fxnum_fast& m_num;    int            m_idx;private:    // disabled    sc_fxnum_fast_bitref();};// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_subref////  Proxy class for part-selection in class sc_fxnum,//  behaves like sc_bv_base.// ----------------------------------------------------------------------------class sc_fxnum_subref{    friend class sc_fxnum;    friend class sc_fxnum_fast_subref;    bool get() const;    bool set();    // constructor    sc_fxnum_subref( sc_fxnum&, int, int );public:    // copy constructor    sc_fxnum_subref( const sc_fxnum_subref& );    // destructor    ~sc_fxnum_subref();    // assignment operators#define DECL_ASN_OP_T(tp)                                                     \    sc_fxnum_subref& operator = ( tp );    DECL_ASN_OP_T(const sc_fxnum_subref&)    DECL_ASN_OP_T(const sc_fxnum_fast_subref&)    DECL_ASN_OP_T(const sc_bv_base&)    DECL_ASN_OP_T(const sc_lv_base&)    DECL_ASN_OP_T(const char*)    DECL_ASN_OP_T(const bool*)    DECL_ASN_OP_T(const sc_signed&)    DECL_ASN_OP_T(const sc_unsigned&)    DECL_ASN_OP_T(const sc_int_base&)    DECL_ASN_OP_T(const sc_uint_base&)    DECL_ASN_OP_T(int64)    DECL_ASN_OP_T(uint64)    DECL_ASN_OP_T(int)    DECL_ASN_OP_T(unsigned int)    DECL_ASN_OP_T(long)    DECL_ASN_OP_T(unsigned long)    DECL_ASN_OP_T(char)#undef DECL_ASN_OP_T#define DECL_ASN_OP_T_A(op,tp)                                                \    sc_fxnum_subref& operator op ## = ( tp );#define DECL_ASN_OP_A(op)                                                     \    DECL_ASN_OP_T_A(op,const sc_fxnum_subref&)                                \    DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&)                           \    DECL_ASN_OP_T_A(op,const sc_bv_base&)                                     \    DECL_ASN_OP_T_A(op,const sc_lv_base&)    DECL_ASN_OP_A(&)    DECL_ASN_OP_A(|)    DECL_ASN_OP_A(^)#undef DECL_ASN_OP_T_A#undef DECL_ASN_OP_A    // relational operators#define DECL_REL_OP_T(op,tp)                                                  \    friend bool operator op ( const sc_fxnum_subref&, tp );                   \    friend bool operator op ( tp, const sc_fxnum_subref& );#define DECL_REL_OP(op)                                                       \    friend bool operator op ( const sc_fxnum_subref&,                         \			      const sc_fxnum_subref& );                       \    friend bool operator op ( const sc_fxnum_subref&,                         \			      const sc_fxnum_fast_subref& );                  \    DECL_REL_OP_T(op,const sc_bv_base&)                                       \    DECL_REL_OP_T(op,const sc_lv_base&)                                       \    DECL_REL_OP_T(op,const char*)                                             \    DECL_REL_OP_T(op,const bool*)                                             \    DECL_REL_OP_T(op,const sc_signed&)                                        \    DECL_REL_OP_T(op,const sc_unsigned&)                                      \    DECL_REL_OP_T(op,int)                                                     \    DECL_REL_OP_T(op,unsigned int)                                            \    DECL_REL_OP_T(op,long)                                                    \    DECL_REL_OP_T(op,unsigned long)    DECL_REL_OP(==)    DECL_REL_OP(!=)#undef DECL_REL_OP_T#undef DECL_REL_OP    // reduce functions    bool and_reduce() const;    bool nand_reduce() const;    bool or_reduce() const;    bool nor_reduce() const;    bool xor_reduce() const;    bool xnor_reduce() const;    // query parameter    int length() const;    // explicit conversions    int           to_int() const;    unsigned int  to_uint() const;    long          to_long() const;    unsigned long to_ulong() const;    int64         to_int64() const;    uint64        to_uint64() const;#ifdef SC_DT_DEPRECATED    int           to_signed() const;    unsigned int  to_unsigned() const;#endif    const std::string to_string() const;    const std::string to_string( sc_numrep ) const;    const std::string to_string( sc_numrep, bool ) const;    // implicit conversion    operator sc_bv_base() const;    // print or dump content    void print( ::std::ostream& = ::std::cout ) const;    void scan( ::std::istream& = ::std::cin );    void dump( ::std::ostream& = ::std::cout ) const;private:    sc_fxnum& m_num;    int       m_from;    int       m_to;    sc_bv_base& m_bv;private:    // disabled    sc_fxnum_subref();};// ----------------------------------------------------------------------------//  CLASS : sc_fxnum_fast_subref////  Proxy class for part-selection in class sc_fxnum_fast,//  behaves like sc_bv_base.// ----------------------------------------------------------------------------class sc_fxnum_fast_subref{    friend class sc_fxnum_fast;    friend class sc_fxnum_subref;    bool get() const;    bool set();    // constructor    sc_fxnum_fast_subref( sc_fxnum_fast&, int, int );public:    // copy constructor    sc_fxnum_fast_subref( const sc_fxnum_fast_subref& );    // destructor    ~sc_fxnum_fast_subref();    // assignment operators#define DECL_ASN_OP_T(tp)                                                     \    sc_fxnum_fast_subref& operator = ( tp );    DECL_ASN_OP_T(const sc_fxnum_subref&)    DECL_ASN_OP_T(const sc_fxnum_fast_subref&)    DECL_ASN_OP_T(const sc_bv_base&)    DECL_ASN_OP_T(const sc_lv_base&)    DECL_ASN_OP_T(const char*)    DECL_ASN_OP_T(const bool*)    DECL_ASN_OP_T(const sc_signed&)    DECL_ASN_OP_T(const sc_unsigned&)    DECL_ASN_OP_T(const sc_int_base&)    DECL_ASN_OP_T(const sc_uint_base&)    DECL_ASN_OP_T(int64)    DECL_ASN_OP_T(uint64)    DECL_ASN_OP_T(int)    DECL_ASN_OP_T(unsigned int)    DECL_ASN_OP_T(long)    DECL_ASN_OP_T(unsigned long)    DECL_ASN_OP_T(char)#undef DECL_ASN_OP_T#define DECL_ASN_OP_T_A(op,tp)                                                \    sc_fxnum_fast_subref& operator op ## = ( tp );#define DECL_ASN_OP_A(op)                                                     \    DECL_ASN_OP_T_A(op,const sc_fxnum_subref&)                                \    DECL_ASN_OP_T_A(op,const sc_fxnum_fast_subref&)                           \    DECL_ASN_OP_T_A(op,const sc_bv_base&)                                     \    DECL_ASN_OP_T_A(op,const sc_lv_base&)    DECL_ASN_OP_A(&)    DECL_ASN_OP_A(|)    DECL_ASN_OP_A(^)#undef DECL_ASN_OP_T_A

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -