gem5  v22.0.0.2
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
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 &, const scfx_rep &, const scfx_rep &, int)
 
scfx_repneg_scfx_rep (const scfx_rep &)
 
scfx_repmult_scfx_rep (const scfx_rep &, const scfx_rep &, int)
 
scfx_repdiv_scfx_rep (const scfx_rep &, const scfx_rep &, int)
 
scfx_repadd_scfx_rep (const scfx_rep &, const scfx_rep &, int)
 
scfx_repsub_scfx_rep (const scfx_rep &, const scfx_rep &, int)
 
scfx_replsh_scfx_rep (const scfx_rep &, int)
 
scfx_reprsh_scfx_rep (const scfx_rep &, int)
 
int cmp_scfx_rep (const scfx_rep &, const scfx_rep &)
 
scfx_repquantization_scfx_rep (const scfx_rep &, const scfx_params &, bool &)
 
scfx_repoverflow_scfx_rep (const scfx_rep &, const scfx_params &, bool &)
 
void align (const scfx_rep &, const scfx_rep &, int &, int &, scfx_mant_ref &, scfx_mant_ref &)
 
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 &, const scfx_rep &, int, sc_fmt)
 
void print_other (scfx_string &, const scfx_rep &, sc_numrep, int, sc_fmt, const scfx_params *)
 
int compare_abs (const scfx_rep &, const scfx_rep &)
 

Detailed Description

Definition at line 169 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 171 of file scfx_rep.hh.

Constructor & Destructor Documentation

◆ scfx_rep() [1/12]

sc_dt::scfx_rep::scfx_rep ( )

Definition at line 131 of file scfx_rep.cc.

◆ scfx_rep() [2/12]

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

◆ scfx_rep() [3/12]

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

Definition at line 157 of file scfx_rep.cc.

◆ scfx_rep() [4/12]

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

Definition at line 171 of file scfx_rep.cc.

References gem5::ArmISA::a, and sc_dt::bits_in_word.

◆ scfx_rep() [5/12]

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

Definition at line 200 of file scfx_rep.cc.

References m_state, and not_a_number.

◆ scfx_rep() [6/12]

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

Definition at line 225 of file scfx_rep.cc.

References gem5::ArmISA::a, sc_dt::bits_in_word, m_mant, and m_sign.

◆ scfx_rep() [7/12]

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

Definition at line 345 of file scfx_rep.hh.

References gem5::ArmISA::a, gem5::ArmISA::b, gem5::VegaISA::c, and sc_dt::multiply().

◆ scfx_rep() [8/12]

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

Definition at line 250 of file scfx_rep.cc.

◆ scfx_rep() [9/12]

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

Definition at line 273 of file scfx_rep.cc.

References calc_indices(), gem5::ArmISA::i, m_mant, and gem5::VegaISA::x.

◆ scfx_rep() [10/12]

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

Definition at line 290 of file scfx_rep.cc.

◆ scfx_rep() [11/12]

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

Definition at line 325 of file scfx_rep.cc.

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

◆ scfx_rep() [12/12]

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

Definition at line 350 of file scfx_rep.cc.

◆ ~scfx_rep()

sc_dt::scfx_rep::~scfx_rep ( )
inline

Definition at line 353 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 458 of file scfx_rep.hh.

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

◆ cast()

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

Definition at line 2056 of file scfx_rep.cc.

References sc_dt::min_mant, sc_dt::sc_max(), and sc_dt::sc_min().

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 2176 of file scfx_rep.cc.

◆ dump()

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

◆ find_lsw()

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

Definition at line 719 of file scfx_rep.hh.

◆ find_msw()

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

Definition at line 729 of file scfx_rep.hh.

◆ find_sw()

void sc_dt::scfx_rep::find_sw ( )
inlineprivate

Definition at line 739 of file scfx_rep.hh.

Referenced by clear(), lshift(), normalize(), round(), scfx_rep(), and set().

◆ from_string()

void sc_dt::scfx_rep::from_string ( const char *  s,
int  cte_wl 
)

Definition at line 421 of file scfx_rep.cc.

References gem5::X86ISA::base, and SCFX_FAIL_IF_.

◆ 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

◆ 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

◆ 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

Definition at line 407 of file scfx_rep.hh.

Referenced by get_type(), sc_dt::sc_fxval::is_zero(), sc_dt::sc_fxnum::is_zero(), and round().

◆ lshift()

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

◆ multiply_by_ten()

void scfx_rep::multiply_by_ten ( )
private

◆ 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, gem5::ArmISA::shift, and shift_left().

◆ o_bit_at()

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

Definition at line 495 of file scfx_rep.hh.

◆ o_extend()

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

Definition at line 472 of file scfx_rep.hh.

References gem5::PowerISA::bi, sc_dt::bits_in_word, gem5::ArmISA::i, m_mant, SC_ASSERT_, size(), and gem5::VegaISA::x.

Referenced by clear(), and set().

◆ o_invert()

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

Definition at line 622 of file scfx_rep.hh.

◆ o_set()

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

Definition at line 589 of file scfx_rep.hh.

References gem5::ArmISA::i, m_mant, and size().

◆ 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

◆ o_set_low()

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

Definition at line 538 of file scfx_rep.hh.

◆ o_zero_left()

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

◆ o_zero_right()

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

Definition at line 523 of file scfx_rep.hh.

References gem5::PowerISA::bi, gem5::ArmISA::i, SC_ASSERT_, size(), and gem5::VegaISA::x.

◆ operator delete()

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

Definition at line 392 of file scfx_rep.cc.

◆ operator new()

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

Definition at line 371 of file scfx_rep.cc.

References gem5::VegaISA::s, and SCFX_FAIL_IF_.

◆ operator=()

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

Definition at line 357 of file scfx_rep.hh.

◆ overflow()

void sc_dt::scfx_rep::overflow ( const scfx_params params,
bool &  o_flag 
)
private

Definition at line 1895 of file scfx_rep.cc.

◆ print()

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

Definition at line 2515 of file scfx_rep.cc.

References gem5::X86ISA::os, sc_dt::SC_DEC, sc_dt::SC_E, and to_string().

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

◆ q_bit()

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

Definition at line 633 of file scfx_rep.hh.

Referenced by round().

◆ q_clear()

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

Definition at line 649 of file scfx_rep.hh.

References gem5::PowerISA::bi, m_mant, SC_ASSERT_, size(), and gem5::VegaISA::x.

Referenced by round().

◆ q_incr()

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

Definition at line 662 of file scfx_rep.hh.

References gem5::PowerISA::bi, sc_dt::bits_in_word, gem5::ArmISA::i, m_mant, SC_ASSERT_, size(), and gem5::VegaISA::x.

Referenced by round().

◆ q_odd()

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

Definition at line 683 of file scfx_rep.hh.

Referenced by round().

◆ q_zero()

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

Definition at line 694 of file scfx_rep.hh.

Referenced by round().

◆ quantization()

void sc_dt::scfx_rep::quantization ( const scfx_params params,
bool &  q_flag 
)
private

Definition at line 1811 of file scfx_rep.cc.

◆ resize()

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

◆ resize_to()

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

Definition at line 446 of file scfx_rep.hh.

References gem5::PowerISA::bi, sc_dt::bits_in_word, gem5::ArmISA::i, m_mant, m_sign, and size().

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

◆ round()

void scfx_rep::round ( int  wl)
private

◆ rounding_flag()

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

Definition at line 443 of file scfx_rep.hh.

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

◆ rshift()

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

Definition at line 1656 of file scfx_rep.cc.

References gem5::ArmISA::a, and gem5::ArmISA::b.

◆ 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 gem5::ArmISA::i, and m_mant.

◆ set_hex()

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

Definition at line 2284 of file scfx_rep.cc.

References gem5::ArmISA::i, m_mant, and gem5::ArmISA::n.

◆ set_inf()

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

Definition at line 337 of file scfx_rep.hh.

References gem5::ArmISA::a, and gem5::VegaISA::c.

Referenced by sc_dt::sub_with_index().

◆ set_nan()

void sc_dt::scfx_rep::set_nan ( )
inline

Definition at line 330 of file scfx_rep.hh.

Referenced by sc_dt::sub_with_index().

◆ set_oct()

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

Definition at line 2263 of file scfx_rep.cc.

References gem5::ArmISA::i, m_mant, and gem5::ArmISA::n.

◆ set_slice()

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

◆ set_zero()

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

Definition at line 321 of file scfx_rep.hh.

◆ 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, gem5::ArmISA::i, m_mant, gem5::ArmISA::n, SC_ASSERT_, shift_right(), and size().

Referenced by normalize(), 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, gem5::ArmISA::i, m_mant, gem5::ArmISA::n, SC_ASSERT_, shift_left(), and size().

Referenced by lshift(), and shift_left().

◆ size()

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

◆ to_double()

double sc_dt::scfx_rep::to_double ( ) const

◆ to_string()

const char * sc_dt::scfx_rep::to_string ( sc_numrep  numrep,
int  w_prefix,
sc_fmt  fmt,
const scfx_params params = 0 
) const

◆ to_uint64()

uint64 sc_dt::scfx_rep::to_uint64 ( ) const

◆ toggle_tc()

void sc_dt::scfx_rep::toggle_tc ( )
inlineprivate

Definition at line 746 of file scfx_rep.hh.

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

Friends And Related Function Documentation

◆ add_scfx_rep

scfx_rep* add_scfx_rep ( const scfx_rep ,
const scfx_rep ,
int   
)
friend

Definition at line 1249 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 2083 of file scfx_rep.cc.

◆ cmp_scfx_rep

int cmp_scfx_rep ( const scfx_rep ,
const scfx_rep  
)
friend

Definition at line 1758 of file scfx_rep.cc.

◆ compare_abs

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

Definition at line 1689 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 2127 of file scfx_rep.cc.

◆ div_scfx_rep

scfx_rep* div_scfx_rep ( const scfx_rep ,
const scfx_rep ,
int   
)
friend

Definition at line 1527 of file scfx_rep.cc.

◆ lsh_scfx_rep

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

Definition at line 387 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 379 of file scfx_rep.hh.

◆ multiply

void multiply ( scfx_rep ,
const scfx_rep ,
const scfx_rep ,
int   
)
friend

Definition at line 1452 of file scfx_rep.cc.

◆ neg_scfx_rep

scfx_rep* neg_scfx_rep ( const scfx_rep a)
friend

Definition at line 371 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 436 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 895 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 1019 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 427 of file scfx_rep.hh.

◆ rsh_scfx_rep

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

Definition at line 395 of file scfx_rep.hh.

◆ sub_scfx_rep

scfx_rep* sub_scfx_rep ( const scfx_rep ,
const scfx_rep ,
int   
)
friend

Definition at line 1358 of file scfx_rep.cc.

Member Data Documentation

◆ m_lsw

int sc_dt::scfx_rep::m_lsw
private

Definition at line 313 of file scfx_rep.hh.

Referenced by dump(), get_type(), lshift(), resize(), and round().

◆ m_mant

scfx_mant sc_dt::scfx_rep::m_mant
private

◆ m_msw

int sc_dt::scfx_rep::m_msw
private

Definition at line 312 of file scfx_rep.hh.

Referenced by dump(), get_type(), resize(), and round().

◆ m_r_flag

bool sc_dt::scfx_rep::m_r_flag
private

Definition at line 314 of file scfx_rep.hh.

Referenced by round().

◆ m_sign

int sc_dt::scfx_rep::m_sign
private

◆ m_state

state sc_dt::scfx_rep::m_state
private

Definition at line 311 of file scfx_rep.hh.

Referenced by dump(), sc_dt::lsh_scfx_rep(), and scfx_rep().

◆ m_wp

int sc_dt::scfx_rep::m_wp
private

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

Generated on Thu Jul 28 2022 13:35:03 for gem5 by doxygen 1.8.17