gem5 v24.0.0.0
Loading...
Searching...
No Matches
sc_dt::scfx_rep Class Reference

#include <scfx_rep.hh>

Public Member Functions

 scfx_rep ()
 
 scfx_rep (int)
 
 scfx_rep (unsigned int)
 
 scfx_rep (long)
 
 scfx_rep (unsigned long)
 
 scfx_rep (double)
 
 scfx_rep (const char *)
 
 scfx_rep (int64)
 
 scfx_rep (uint64)
 
 scfx_rep (const sc_signed &)
 
 scfx_rep (const sc_unsigned &)
 
 scfx_rep (const scfx_rep &)
 
 ~scfx_rep ()
 
void * operator new (std::size_t)
 
void operator delete (void *, std::size_t)
 
void from_string (const char *, int)
 
double to_double () const
 
uint64 to_uint64 () const
 
const char * to_string (sc_numrep, int, sc_fmt, const scfx_params *=0) const
 
void operator= (const scfx_rep &)
 
void lshift (int)
 
void rshift (int)
 
void cast (const scfx_params &, bool &, bool &)
 
bool is_neg () const
 
bool is_zero () const
 
bool is_nan () const
 
bool is_inf () const
 
bool is_normal () const
 
void set_zero (int=1)
 
void set_nan ()
 
void set_inf (int)
 
bool get_bit (int) const
 
bool set (int, const scfx_params &)
 
bool clear (int, const scfx_params &)
 
bool get_slice (int, int, const scfx_params &, sc_bv_base &) const
 
bool set_slice (int, int, const scfx_params &, const sc_bv_base &)
 
void print (::std::ostream &) const
 
void dump (::std::ostream &) const
 
void get_type (int &, int &, sc_enc &) const
 
bool rounding_flag () const
 

Private Types

enum  state { normal , infinity , not_a_number }
 

Private Member Functions

unsigned int divide_by_ten ()
 
int find_lsw () const
 
int find_msw () const
 
void find_sw ()
 
void multiply_by_ten ()
 
void normalize (int)
 
scfx_mantresize (int, int) const
 
void set_bin (int)
 
void set_oct (int, int)
 
void set_hex (int, int)
 
void shift_left (int)
 
void shift_right (int)
 
const scfx_index calc_indices (int) const
 
void o_extend (const scfx_index &, sc_enc)
 
bool o_bit_at (const scfx_index &) const
 
bool o_zero_left (const scfx_index &) const
 
bool o_zero_right (const scfx_index &) const
 
void o_set_low (const scfx_index &, sc_enc)
 
void o_set_high (const scfx_index &, const scfx_index &, sc_enc, int=1)
 
void o_set (const scfx_index &, const scfx_index &, sc_enc, bool)
 
void o_invert (const scfx_index &)
 
bool q_bit (const scfx_index &) const
 
void q_clear (const scfx_index &)
 
void q_incr (const scfx_index &)
 
bool q_odd (const scfx_index &) const
 
bool q_zero (const scfx_index &) const
 
void resize_to (int, int=0)
 
int size () const
 
void toggle_tc ()
 
void quantization (const scfx_params &, bool &)
 
void overflow (const scfx_params &, bool &)
 
void round (int)
 

Private Attributes

scfx_mant m_mant
 
int m_wp
 
int m_sign
 
state m_state
 
int m_msw
 
int m_lsw
 
bool m_r_flag
 

Friends

void multiply (scfx_rep &result, const scfx_rep &lhs, const scfx_rep &rhs, int max_wl=SC_DEFAULT_MAX_WL_)
 
scfx_repneg_scfx_rep (const scfx_rep &a)
 
scfx_repmult_scfx_rep (const scfx_rep &a, const scfx_rep &b, int max_wl=SC_DEFAULT_MAX_WL_)
 
scfx_repdiv_scfx_rep (const scfx_rep &lhs, const scfx_rep &rhs, int div_wl=SC_DEFAULT_DIV_WL_)
 
scfx_repadd_scfx_rep (const scfx_rep &lhs, const scfx_rep &rhs, int max_wl=SC_DEFAULT_MAX_WL_)
 
scfx_repsub_scfx_rep (const scfx_rep &lhs, const scfx_rep &rhs, int max_wl=SC_DEFAULT_MAX_WL_)
 
scfx_replsh_scfx_rep (const scfx_rep &a, int b)
 
scfx_reprsh_scfx_rep (const scfx_rep &a, int b)
 
int cmp_scfx_rep (const scfx_rep &a, const scfx_rep &b)
 
scfx_repquantization_scfx_rep (const scfx_rep &a, const scfx_params &params, bool &q_flag)
 
scfx_repoverflow_scfx_rep (const scfx_rep &a, const scfx_params &params, bool &o_flag)
 
void align (const scfx_rep &lhs, const scfx_rep &rhs, int &new_wp, int &len_mant, scfx_mant_ref &lhs_mant, scfx_mant_ref &rhs_mant)
 
int compare_msw (const scfx_rep &, const scfx_rep &)
 
int compare_msw_ff (const scfx_rep &lhs, const scfx_rep &rhs)
 
void print_dec (scfx_string &s, const scfx_rep &num, int w_prefix, sc_fmt fmt)
 
void print_other (scfx_string &s, const scfx_rep &a, sc_numrep numrep, int w_prefix, sc_fmt fmt, const scfx_params *params)
 
int compare_abs (const scfx_rep &a, const scfx_rep &b)
 

Detailed Description

Definition at line 137 of file scfx_rep.hh.

Member Enumeration Documentation

◆ state

enum sc_dt::scfx_rep::state
private
Enumerator
normal 
infinity 
not_a_number 

Definition at line 139 of file scfx_rep.hh.

Constructor & Destructor Documentation

◆ scfx_rep() [1/12]

sc_dt::scfx_rep::scfx_rep ( )

Definition at line 99 of file scfx_rep.cc.

References set_zero().

◆ scfx_rep() [2/12]

sc_dt::scfx_rep::scfx_rep ( int a)
explicit

Definition at line 106 of file scfx_rep.cc.

References a, sc_dt::scfx_mant::clear(), m_lsw, m_mant, m_msw, m_sign, m_state, m_wp, normal, and set_zero().

◆ scfx_rep() [3/12]

sc_dt::scfx_rep::scfx_rep ( unsigned int a)
explicit

Definition at line 125 of file scfx_rep.cc.

References a, sc_dt::scfx_mant::clear(), m_lsw, m_mant, m_msw, m_sign, m_state, m_wp, normal, and set_zero().

◆ scfx_rep() [4/12]

sc_dt::scfx_rep::scfx_rep ( long a)
explicit

◆ scfx_rep() [5/12]

sc_dt::scfx_rep::scfx_rep ( unsigned long a)
explicit

◆ scfx_rep() [6/12]

sc_dt::scfx_rep::scfx_rep ( double a)
explicit

◆ scfx_rep() [7/12]

sc_dt::scfx_rep::scfx_rep ( const char * s)
inlineexplicit

Definition at line 313 of file scfx_rep.hh.

References from_string(), and sc_dt::SC_DEFAULT_CTE_WL_.

◆ scfx_rep() [8/12]

sc_dt::scfx_rep::scfx_rep ( int64 a)
explicit

◆ scfx_rep() [9/12]

sc_dt::scfx_rep::scfx_rep ( uint64 a)
explicit

◆ scfx_rep() [10/12]

sc_dt::scfx_rep::scfx_rep ( const sc_signed & a)
explicit

◆ scfx_rep() [11/12]

sc_dt::scfx_rep::scfx_rep ( const sc_unsigned & a)
explicit

◆ scfx_rep() [12/12]

sc_dt::scfx_rep::scfx_rep ( const scfx_rep & a)

Definition at line 318 of file scfx_rep.cc.

◆ ~scfx_rep()

sc_dt::scfx_rep::~scfx_rep ( )
inline

Definition at line 321 of file scfx_rep.hh.

Member Function Documentation

◆ calc_indices()

const scfx_index sc_dt::scfx_rep::calc_indices ( int n) const
inlineprivate

Definition at line 426 of file scfx_rep.hh.

References sc_dt::bits_in_word, and m_wp.

Referenced by clear(), get_bit(), overflow(), quantization(), scfx_rep(), scfx_rep(), and set().

◆ cast()

void sc_dt::scfx_rep::cast ( const scfx_params & params,
bool & q_flag,
bool & o_flag )

Definition at line 2024 of file scfx_rep.cc.

References is_neg(), is_zero(), m_sign, overflow(), and quantization().

Referenced by sc_dt::sc_fxnum::cast().

◆ clear()

bool scfx_rep::clear ( int i,
const scfx_params & params )

◆ divide_by_ten()

unsigned int sc_dt::scfx_rep::divide_by_ten ( )
private

Definition at line 2144 of file scfx_rep.cc.

References sc_dt::word_short::l, m_mant, m_msw, m_wp, sc_dt::remainder, and sc_dt::word_short::s.

◆ dump()

void scfx_rep::dump ( ::std::ostream & os) const

Definition at line 2526 of file scfx_rep.cc.

References infinity, m_lsw, m_mant, m_msw, m_sign, m_state, m_wp, normal, not_a_number, and size().

Referenced by sc_dt::sc_fxnum::dump(), and sc_dt::sc_fxval::dump().

◆ find_lsw()

int sc_dt::scfx_rep::find_lsw ( ) const
inlineprivate

Definition at line 687 of file scfx_rep.hh.

References m_mant, and size().

Referenced by find_sw().

◆ find_msw()

int sc_dt::scfx_rep::find_msw ( ) const
inlineprivate

Definition at line 697 of file scfx_rep.hh.

References m_mant, and size().

Referenced by find_sw().

◆ find_sw()

void sc_dt::scfx_rep::find_sw ( )
inlineprivate

◆ from_string()

◆ get_bit()

bool scfx_rep::get_bit ( int i) const

◆ get_slice()

bool scfx_rep::get_slice ( int i,
int j,
const scfx_params & ,
sc_bv_base & bv ) const

Definition at line 2465 of file scfx_rep.cc.

References get_bit(), is_inf(), is_nan(), and sc_dt::sc_bv_base::length().

Referenced by sc_dt::sc_fxnum::get_slice().

◆ get_type()

void scfx_rep::get_type ( int & wl,
int & iwl,
sc_enc & enc ) const

◆ is_inf()

bool sc_dt::scfx_rep::is_inf ( ) const
inline

Definition at line 390 of file scfx_rep.hh.

References infinity, and m_state.

Referenced by get_slice(), get_type(), sc_dt::sc_fxval::is_inf(), round(), scfx_rep(), set_slice(), to_double(), and to_string().

◆ is_nan()

bool sc_dt::scfx_rep::is_nan ( ) const
inline

◆ is_neg()

bool sc_dt::scfx_rep::is_neg ( ) const
inline

◆ is_normal()

bool sc_dt::scfx_rep::is_normal ( ) const
inline

◆ is_zero()

bool sc_dt::scfx_rep::is_zero ( ) const
inline

◆ lshift()

void sc_dt::scfx_rep::lshift ( int n)

◆ multiply_by_ten()

void scfx_rep::multiply_by_ten ( )
private

Definition at line 2178 of file scfx_rep.cc.

References sc_dt::add_mants(), sc_dt::bits_in_word, m_mant, sc_dt::scfx_mant::size(), and size().

Referenced by from_string().

◆ normalize()

void scfx_rep::normalize ( int exponent)
private

Definition at line 2209 of file scfx_rep.cc.

References sc_dt::bits_in_word, find_sw(), m_wp, and shift_left().

Referenced by scfx_rep().

◆ o_bit_at()

bool sc_dt::scfx_rep::o_bit_at ( const scfx_index & x) const
inlineprivate

Definition at line 463 of file scfx_rep.hh.

References m_mant, SC_ASSERT_, and size().

Referenced by overflow().

◆ o_extend()

void sc_dt::scfx_rep::o_extend ( const scfx_index & x,
sc_enc enc )
inlineprivate

Definition at line 440 of file scfx_rep.hh.

References sc_dt::bits_in_word, m_mant, m_sign, SC_ASSERT_, sc_dt::SC_US_, and size().

Referenced by clear(), overflow(), and set().

◆ o_invert()

void sc_dt::scfx_rep::o_invert ( const scfx_index & x2)
inlineprivate

Definition at line 590 of file scfx_rep.hh.

References sc_dt::scfx_index::bi(), m_mant, size(), and sc_dt::scfx_index::wi().

Referenced by overflow().

◆ o_set()

void sc_dt::scfx_rep::o_set ( const scfx_index & x,
const scfx_index & x3,
sc_enc enc,
bool under )
inlineprivate

◆ o_set_high()

void sc_dt::scfx_rep::o_set_high ( const scfx_index & x,
const scfx_index & x2,
sc_enc enc,
int sign = 1 )
inlineprivate

Definition at line 524 of file scfx_rep.hh.

References sc_dt::scfx_index::bi(), m_mant, m_sign, SC_ASSERT_, sc_dt::SC_TC_, size(), and sc_dt::scfx_index::wi().

Referenced by overflow().

◆ o_set_low()

void sc_dt::scfx_rep::o_set_low ( const scfx_index & x,
sc_enc enc )
inlineprivate

Definition at line 506 of file scfx_rep.hh.

References sc_dt::scfx_mant::clear(), m_mant, m_sign, SC_ASSERT_, sc_dt::SC_TC_, and size().

Referenced by overflow().

◆ o_zero_left()

bool sc_dt::scfx_rep::o_zero_left ( const scfx_index & x) const
inlineprivate

Definition at line 474 of file scfx_rep.hh.

References sc_dt::bits_in_word, m_mant, SC_ASSERT_, and size().

Referenced by overflow().

◆ o_zero_right()

bool sc_dt::scfx_rep::o_zero_right ( const scfx_index & x) const
inlineprivate

Definition at line 491 of file scfx_rep.hh.

References m_mant, SC_ASSERT_, and size().

Referenced by overflow().

◆ operator delete()

void sc_dt::scfx_rep::operator delete ( void * ptr,
std::size_t size )

Definition at line 360 of file scfx_rep.cc.

References sc_dt::list, and sc_dt::scfx_rep_node::next.

◆ operator new()

void * sc_dt::scfx_rep::operator new ( std::size_t size)

Definition at line 339 of file scfx_rep.cc.

References sc_dt::scfx_rep_node::data, sc_dt::list, and sc_dt::scfx_rep_node::next.

◆ operator=()

void sc_dt::scfx_rep::operator= ( const scfx_rep & f)
inline

Definition at line 325 of file scfx_rep.hh.

References f(), m_lsw, m_mant, m_msw, m_sign, m_state, m_wp, round(), and sc_dt::SC_DEFAULT_MAX_WL_.

◆ overflow()

◆ print()

void scfx_rep::print ( ::std::ostream & os) const

Definition at line 2515 of file scfx_rep.cc.

References to_string().

Referenced by sc_dt::sc_fxval::print().

◆ q_bit()

bool sc_dt::scfx_rep::q_bit ( const scfx_index & x) const
inlineprivate

Definition at line 601 of file scfx_rep.hh.

References sc_dt::bits_in_word, m_mant, SC_ASSERT_, and size().

Referenced by quantization(), and round().

◆ q_clear()

void sc_dt::scfx_rep::q_clear ( const scfx_index & x)
inlineprivate

Definition at line 617 of file scfx_rep.hh.

References m_mant, SC_ASSERT_, and size().

Referenced by quantization(), and round().

◆ q_incr()

void sc_dt::scfx_rep::q_incr ( const scfx_index & x)
inlineprivate

Definition at line 630 of file scfx_rep.hh.

References m_mant, resize_to(), SC_ASSERT_, and size().

Referenced by quantization(), and round().

◆ q_odd()

bool sc_dt::scfx_rep::q_odd ( const scfx_index & x) const
inlineprivate

Definition at line 651 of file scfx_rep.hh.

References m_mant, SC_ASSERT_, and size().

Referenced by quantization(), and round().

◆ q_zero()

bool sc_dt::scfx_rep::q_zero ( const scfx_index & x) const
inlineprivate

Definition at line 662 of file scfx_rep.hh.

References sc_dt::bits_in_word, m_mant, SC_ASSERT_, and size().

Referenced by quantization(), and round().

◆ quantization()

◆ resize()

scfx_mant * scfx_rep::resize ( int new_size,
int new_wp ) const
private

Definition at line 2231 of file scfx_rep.cc.

References sc_dt::scfx_mant::clear(), m_lsw, m_mant, m_msw, and m_wp.

◆ resize_to()

void sc_dt::scfx_rep::resize_to ( int new_size,
int restore = 0 )
inlineprivate

◆ round()

void scfx_rep::round ( int wl)
private

◆ rounding_flag()

bool sc_dt::scfx_rep::rounding_flag ( ) const
inline

Definition at line 411 of file scfx_rep.hh.

References m_r_flag.

Referenced by sc_dt::sc_fxval::rounding_flag().

◆ rshift()

void sc_dt::scfx_rep::rshift ( int n)

◆ set()

bool scfx_rep::set ( int i,
const scfx_params & params )

◆ set_bin()

void scfx_rep::set_bin ( int i)
private

Definition at line 2252 of file scfx_rep.cc.

References m_mant.

Referenced by from_string().

◆ set_hex()

void scfx_rep::set_hex ( int i,
int n )
private

Definition at line 2284 of file scfx_rep.cc.

References m_mant.

Referenced by from_string().

◆ set_inf()

void sc_dt::scfx_rep::set_inf ( int sign)
inline

Definition at line 305 of file scfx_rep.hh.

References infinity, m_mant, m_sign, m_state, sc_dt::min_mant, and sc_dt::scfx_mant::resize_to().

◆ set_nan()

void sc_dt::scfx_rep::set_nan ( )
inline

◆ set_oct()

void scfx_rep::set_oct ( int i,
int n )
private

Definition at line 2263 of file scfx_rep.cc.

References m_mant.

Referenced by from_string().

◆ set_slice()

bool scfx_rep::set_slice ( int i,
int j,
const scfx_params & params,
const sc_bv_base & bv )

Definition at line 2486 of file scfx_rep.cc.

References clear(), is_inf(), is_nan(), sc_dt::sc_bv_base::length(), and set().

Referenced by sc_dt::sc_fxnum::set_slice().

◆ set_zero()

void sc_dt::scfx_rep::set_zero ( int sign = 1)
inline

◆ shift_left()

void scfx_rep::shift_left ( int n)
private

Definition at line 2311 of file scfx_rep.cc.

References sc_dt::bits_in_word, m_mant, SC_ASSERT_, shift_left(), shift_right(), and size().

Referenced by lshift(), normalize(), shift_left(), and shift_right().

◆ shift_right()

void scfx_rep::shift_right ( int n)
private

Definition at line 2336 of file scfx_rep.cc.

References sc_dt::bits_in_word, m_mant, SC_ASSERT_, shift_left(), shift_right(), and size().

Referenced by rshift(), shift_left(), and shift_right().

◆ size()

◆ to_double()

◆ to_string()

◆ to_uint64()

◆ toggle_tc()

void sc_dt::scfx_rep::toggle_tc ( )
inlineprivate

Definition at line 714 of file scfx_rep.hh.

References sc_dt::complement(), sc_dt::inc(), is_neg(), m_mant, and sc_dt::scfx_mant::size().

Referenced by clear(), get_bit(), overflow(), and set().

Friends And Related Symbol Documentation

◆ add_scfx_rep

scfx_rep * add_scfx_rep ( const scfx_rep & lhs,
const scfx_rep & rhs,
int max_wl = SC_DEFAULT_MAX_WL_ )
friend

Definition at line 1217 of file scfx_rep.cc.

◆ align

void align ( const scfx_rep & lhs,
const scfx_rep & rhs,
int & new_wp,
int & len_mant,
scfx_mant_ref & lhs_mant,
scfx_mant_ref & rhs_mant )
friend

Definition at line 2051 of file scfx_rep.cc.

◆ cmp_scfx_rep

int cmp_scfx_rep ( const scfx_rep & a,
const scfx_rep & b )
friend

Definition at line 1726 of file scfx_rep.cc.

◆ compare_abs

int compare_abs ( const scfx_rep & a,
const scfx_rep & b )
friend

Definition at line 1657 of file scfx_rep.cc.

◆ compare_msw

int compare_msw ( const scfx_rep & ,
const scfx_rep &  )
friend

◆ compare_msw_ff

int compare_msw_ff ( const scfx_rep & lhs,
const scfx_rep & rhs )
friend

Definition at line 2095 of file scfx_rep.cc.

◆ div_scfx_rep

scfx_rep * div_scfx_rep ( const scfx_rep & lhs,
const scfx_rep & rhs,
int div_wl = SC_DEFAULT_DIV_WL_ )
friend

Definition at line 1495 of file scfx_rep.cc.

Referenced by from_string().

◆ lsh_scfx_rep

scfx_rep * lsh_scfx_rep ( const scfx_rep & a,
int b )
friend

Definition at line 355 of file scfx_rep.hh.

◆ mult_scfx_rep

scfx_rep * mult_scfx_rep ( const scfx_rep & a,
const scfx_rep & b,
int max_wl = SC_DEFAULT_MAX_WL_ )
friend

Definition at line 347 of file scfx_rep.hh.

◆ multiply

void multiply ( scfx_rep & result,
const scfx_rep & lhs,
const scfx_rep & rhs,
int max_wl = SC_DEFAULT_MAX_WL_ )
friend

Definition at line 1420 of file scfx_rep.cc.

◆ neg_scfx_rep

scfx_rep * neg_scfx_rep ( const scfx_rep & a)
friend

Definition at line 339 of file scfx_rep.hh.

◆ overflow_scfx_rep

scfx_rep * overflow_scfx_rep ( const scfx_rep & a,
const scfx_params & params,
bool & o_flag )
friend

Definition at line 404 of file scfx_rep.hh.

◆ print_dec

void print_dec ( scfx_string & s,
const scfx_rep & num,
int w_prefix,
sc_fmt fmt )
friend

Definition at line 863 of file scfx_rep.cc.

◆ print_other

void print_other ( scfx_string & s,
const scfx_rep & a,
sc_numrep numrep,
int w_prefix,
sc_fmt fmt,
const scfx_params * params )
friend

Definition at line 987 of file scfx_rep.cc.

◆ quantization_scfx_rep

scfx_rep * quantization_scfx_rep ( const scfx_rep & a,
const scfx_params & params,
bool & q_flag )
friend

Definition at line 395 of file scfx_rep.hh.

◆ rsh_scfx_rep

scfx_rep * rsh_scfx_rep ( const scfx_rep & a,
int b )
friend

Definition at line 363 of file scfx_rep.hh.

◆ sub_scfx_rep

scfx_rep * sub_scfx_rep ( const scfx_rep & lhs,
const scfx_rep & rhs,
int max_wl = SC_DEFAULT_MAX_WL_ )
friend

Definition at line 1326 of file scfx_rep.cc.

Member Data Documentation

◆ m_lsw

int sc_dt::scfx_rep::m_lsw
private

◆ m_mant

◆ m_msw

int sc_dt::scfx_rep::m_msw
private

◆ m_r_flag

bool sc_dt::scfx_rep::m_r_flag
private

Definition at line 282 of file scfx_rep.hh.

Referenced by round(), and rounding_flag().

◆ m_sign

◆ m_state

◆ m_wp


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:55 for gem5 by doxygen 1.11.0