Deleted Added
sdiff udiff text old ( 13245:c666c5d4996b ) new ( 13325:86323e6cc8ec )
full compact
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at

--- 48 unchanged lines hidden (view full) ---

57//
58
59#ifndef __SYSTEMC_EXT_DT_FX_SC_FXNUM_HH__
60#define __SYSTEMC_EXT_DT_FX_SC_FXNUM_HH__
61
62#include <iostream>
63
64#include "../bit/sc_lv_base.hh"
65#include "sc_fxnum_observer.hh"
66#include "sc_fxval.hh"
67#include "scfx_params.hh"
68
69namespace sc_gem5
70{
71
72template <typename T, typename B>

--- 2096 unchanged lines hidden (view full) ---

2169sc_fxnum::observer() const
2170{
2171 return m_observer;
2172}
2173
2174inline void
2175sc_fxnum::cast()
2176{
2177 SC_ERROR_IF_(!m_rep->is_normal(), "invalid fixed-point value");
2178
2179 if (m_params.cast_switch() == SC_ON)
2180 m_rep->cast(m_params, m_q_flag, m_o_flag);
2181}
2182
2183// constructors
2184inline sc_fxnum::sc_fxnum(const sc_fxtype_params &type_params_,
2185 sc_enc enc_, const sc_fxcast_switch &cast_sw,

--- 627 unchanged lines hidden (view full) ---

2813 (*this) -= 1;
2814 return *this;
2815}
2816
2817// bit selection
2818inline const sc_fxnum_bitref
2819sc_fxnum::operator [] (int i) const
2820{
2821 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2822 return sc_fxnum_bitref(const_cast<sc_fxnum &>(*this),
2823 i - m_params.fwl());
2824}
2825
2826inline sc_fxnum_bitref
2827sc_fxnum::operator [] (int i)
2828{
2829 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2830 return sc_fxnum_bitref(*this, i - m_params.fwl());
2831}
2832
2833inline const sc_fxnum_bitref
2834sc_fxnum::bit(int i) const
2835{
2836 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2837 return sc_fxnum_bitref(const_cast<sc_fxnum &>(*this),
2838 i - m_params.fwl());
2839}
2840
2841inline sc_fxnum_bitref
2842sc_fxnum::bit(int i)
2843{
2844 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2845 return sc_fxnum_bitref(*this, i - m_params.fwl());
2846}
2847
2848// part selection
2849
2850inline const sc_fxnum_subref
2851sc_fxnum::operator () (int i, int j) const
2852{
2853 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2854 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
2855
2856 return sc_fxnum_subref(const_cast<sc_fxnum &>(*this),
2857 i - m_params.fwl(), j - m_params.fwl());
2858}
2859
2860inline sc_fxnum_subref
2861sc_fxnum::operator () (int i, int j)
2862{
2863 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2864 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
2865
2866 return sc_fxnum_subref(*this, i - m_params.fwl(), j - m_params.fwl());
2867}
2868
2869inline const sc_fxnum_subref
2870sc_fxnum::range(int i, int j) const
2871{
2872 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2873 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
2874
2875 return sc_fxnum_subref(const_cast<sc_fxnum &>(*this),
2876 i - m_params.fwl(), j - m_params.fwl());
2877}
2878
2879inline sc_fxnum_subref
2880sc_fxnum::range(int i, int j)
2881{
2882 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
2883 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
2884
2885 return sc_fxnum_subref(*this, i - m_params.fwl(), j - m_params.fwl());
2886}
2887
2888
2889inline const sc_fxnum_subref
2890sc_fxnum::operator () () const
2891{

--- 876 unchanged lines hidden (view full) ---

3768 SC_FXNUM_FAST_OBSERVER_WRITE_(*this)
3769 return *this;
3770}
3771
3772// bit selection
3773inline const sc_fxnum_fast_bitref
3774sc_fxnum_fast::operator [] (int i) const
3775{
3776 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3777 return sc_fxnum_fast_bitref(const_cast<sc_fxnum_fast &>(*this),
3778 i - m_params.fwl());
3779}
3780
3781inline sc_fxnum_fast_bitref
3782sc_fxnum_fast::operator [] (int i)
3783{
3784 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3785 return sc_fxnum_fast_bitref(*this, i - m_params.fwl());
3786}
3787
3788inline const sc_fxnum_fast_bitref
3789sc_fxnum_fast::bit(int i) const
3790{
3791 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3792 return sc_fxnum_fast_bitref(const_cast<sc_fxnum_fast &>(*this),
3793 i - m_params.fwl());
3794}
3795
3796inline sc_fxnum_fast_bitref
3797sc_fxnum_fast::bit(int i)
3798{
3799 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3800 return sc_fxnum_fast_bitref(*this, i - m_params.fwl());
3801}
3802
3803// part selection
3804inline const sc_fxnum_fast_subref
3805sc_fxnum_fast::operator () (int i, int j) const
3806{
3807 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3808 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
3809
3810 return sc_fxnum_fast_subref(const_cast<sc_fxnum_fast &>(*this),
3811 i - m_params.fwl(), j - m_params.fwl());
3812}
3813
3814inline sc_fxnum_fast_subref
3815sc_fxnum_fast::operator () (int i, int j)
3816{
3817 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3818 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
3819
3820 return sc_fxnum_fast_subref(*this, i - m_params.fwl(), j - m_params.fwl());
3821}
3822
3823inline const sc_fxnum_fast_subref
3824sc_fxnum_fast::range(int i, int j) const
3825{
3826 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3827 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
3828
3829 return sc_fxnum_fast_subref(const_cast<sc_fxnum_fast &>(*this),
3830 i - m_params.fwl(), j - m_params.fwl());
3831}
3832
3833inline sc_fxnum_fast_subref
3834sc_fxnum_fast::range(int i, int j)
3835{
3836 SC_ERROR_IF_(i < 0 || i >= m_params.wl(), "index out of range");
3837 SC_ERROR_IF_(j < 0 || j >= m_params.wl(), "index out of range");
3838
3839 return sc_fxnum_fast_subref(*this, i - m_params.fwl(), j - m_params.fwl());
3840}
3841
3842inline const sc_fxnum_fast_subref
3843sc_fxnum_fast::operator () () const
3844{
3845 return this->operator () (m_params.wl() - 1, 0);

--- 523 unchanged lines hidden ---