165 #if !defined(SC_SIGNAL_UNSIGNED_H) 166 #define SC_SIGNAL_UNSIGNED_H 168 #if ( !defined(_MSC_VER) || _MSC_VER > 1200 ) 169 # define SC_TEMPLATE template<int W> 171 # define SC_TEMPLATE template<> template<int W> 183 class sc_unsigned_sigref;
241 virtual const sc_event& value_changed_event()
const = 0;
252 virtual bool event()
const = 0;
335 explicit inline sc_signal(
const char* name_);
339 inline bool base_event()
const;
341 inline const sc_event& base_value_changed_event()
const;
348 virtual inline const char* kind()
const;
349 virtual inline void update();
366 virtual inline bool event()
const;
370 virtual inline const sc_event& value_changed_event()
const;
381 inline void operator = (
const this_type& new_val );
382 inline void operator = (
const char* new_val );
388 inline void operator = (
unsigned int new_val );
389 inline void operator = (
unsigned long new_val );
390 inline void operator = (
unsigned short new_val );
400 virtual inline void concat_set(
sc_dt::int64 src,
int low_i);
404 virtual inline void concat_set(
sc_dt::uint64 src,
int low_i);
492 return simcontext()->delta_count() == m_event_delta + 1;
506 if ( !m_changed_event_p ) m_changed_event_p =
new sc_event;
507 return *m_changed_event_p;
514 # if defined(DEBUG_SYSTEMC) 524 # if defined(DEBUG_SYSTEMC) 534 # if defined(DEBUG_SYSTEMC) 545 # if defined(DEBUG_SYSTEMC) 563 if( m_writer_p == 0 )
565 m_writer_p = writer_p;
567 else if( m_writer_p != writer_p )
570 m_writer_p->name(), writer_p->
name() );
590 base_write(src >> low_i);
611 base_write( (src >> low_i) );
618 base_write( (src >> low_i) );
624 base_write( (
sc_dt::uint64)(( low_i < 64 ) ? src >> low_i : 0));
631 {
return base_value_changed_event(); }
636 {
return base_event(); }
683 return operator () (bit,bit);
689 { base_write( new_val ); }
698 { base_write(new_val); }
703 { base_write(new_val); }
708 { base_write(new_val); }
747 new_val->to_sc_unsigned(temp);
754 { base_write(new_val); }
777 int left,
int right )
const 788 # ifdef DEBUG_SYSTEMC 789 std::string nm( if_typename_ );
792 if( m_output_p != 0 )
795 m_output_p->name(), port_.
name() );
800 if ( &port_ && if_typename_ ) {}
808 m_changed_event_p(0),
818 m_changed_event_p(0),
828 if ( m_changed_event_p )
delete m_changed_event_p;
835 if ( m_changed_event_p )
839 m_changed_event_p->notify_delayed();
849 {
return base_value_changed_event(); }
855 { base_write( value ); }
861 { base_write( value ); }
866 { base_write( value); }
883 result_p->
initialize(dynamic_cast<sc_unsigned_part_if*>(
this), left, right);
926 public sc_port<sc_signal_in_if<sc_dt::sc_biguint<W> >, 1,
927 SC_ONE_OR_MORE_BOUND>,
948 void bind(
const in_if_type& interface_ )
950 void operator () (
const in_if_type& interface_ )
952 void bind( in_port_type& parent_ )
954 void operator () ( in_port_type& parent_ )
956 void bind( inout_port_type& parent_ )
958 void operator () ( inout_port_type& parent_ )
969 in_port_type* in_parent =
dynamic_cast<in_port_type*
>( &parent_ );
970 if( in_parent != 0 ) {
974 inout_port_type* inout_parent =
dynamic_cast<inout_port_type*
>( &parent_ );
975 if( inout_parent != 0 ) {
988 : base_type(), m_traces( 0 )
992 : base_type( name_ ), m_traces( 0 )
995 explicit sc_in(
const in_if_type& interface_ )
996 : base_type( const_cast<in_if_type&>( interface_ ) ), m_traces( 0 )
999 sc_in(
const char* name_,
const in_if_type& interface_ )
1000 : base_type( name_, const_cast<in_if_type&>( interface_ ) ), m_traces( 0 )
1004 : base_type( parent_ ), m_traces( 0 )
1007 sc_in(
const char* name_, in_port_type& parent_ )
1008 : base_type( name_, parent_ ), m_traces( 0 )
1011 explicit sc_in( inout_port_type& parent_ )
1012 : base_type(), m_traces( 0 )
1015 sc_in(
const char* name_, inout_port_type& parent_ )
1016 : base_type( name_ ), m_traces( 0 )
1020 : base_type( parent_ ), m_traces( 0 )
1023 sc_in(
const char* name_, this_type& parent_ )
1024 : base_type( name_, parent_ ), m_traces( 0 )
1038 {
return (*this)->read()[
i]; }
1040 {
return (*this)->read()[
i]; }
1042 {
return (*this)->read()(left,right); }
1044 {
return (*this)->read()(left,right); }
1052 {
return (*this)->value_changed_event(); }
1058 {
return (*this)->value_changed_event(); }
1064 {
return (*this)->read(); }
1067 {
return (*this)->read(); }
1072 {
return (*this)->event(); }
1080 *
this, &in_if_type::value_changed_event );
1088 {
return (*this)->read().and_reduce(); }
1090 {
return (*this)->read().nand_reduce(); }
1092 {
return (*this)->read().nor_reduce(); }
1094 {
return (*this)->read().or_reduce(); }
1096 {
return (*this)->read().xnor_reduce(); }
1098 {
return (*this)->read().xor_reduce(); }
1107 if( m_traces != 0 ) {
1108 for(
unsigned int i = 0;
i < m_traces->size(); ++
i ) {
1116 virtual inline const char*
kind()
const 1124 if( m_traces == 0 ) {
1135 {
return (*this)->read().concat_length( xz_present_p ); }
1137 {
return (*this)->read().concat_get_uint64(); }
1139 {
return (*this)->read().concat_get_ctrl(dst_p, low_i); }
1141 {
return (*this)->read().concat_get_data(dst_p, low_i); }
1146 if( m_traces != 0 ) {
1147 for(
int i = m_traces->size() - 1;
i >= 0; --
i ) {
1148 delete (*m_traces)[
i];
1169 static data_type dummy;
1180 a.read().print( os );
1195 public sc_port<sc_signal_inout_if<sc_dt::sc_biguint<W> >, 1,
1196 SC_ONE_OR_MORE_BOUND>,
1215 void bind(
const inout_if_type& interface_ )
1217 void operator () (
const inout_if_type& interface_ )
1219 void bind( inout_port_type& parent_ )
1221 void operator () ( inout_port_type& parent_ )
1232 inout_port_type* inout_parent =
dynamic_cast<inout_port_type*
>( &parent_ );
1233 if( inout_parent != 0 ) {
1246 : base_type(), m_init_val_p(0), m_traces( 0 )
1250 : base_type( name_ ), m_init_val_p(0), m_traces( 0 )
1254 : base_type( interface_ ), m_init_val_p(0), m_traces( 0 )
1257 sc_inout(
const char* name_, inout_if_type& interface_ )
1258 : base_type( name_, interface_ ), m_init_val_p(0), m_traces( 0 )
1262 : base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
1265 sc_inout(
const char* name_, inout_port_type& parent_ )
1266 : base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
1270 : base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
1274 : base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
1288 {
return (*this)->read()[
i]; }
1290 {
return (*this)->read()[
i]; }
1292 {
return (*this)->select_part(i,i); }
1294 {
return (*this)->select_part(i,i); }
1296 {
return (*this)->read()(left,right); }
1298 {
return (*this)->read()(left,right); }
1300 {
return (*this)->select_part(left,right); }
1302 {
return (*this)->select_part(left,right); }
1310 {
return (*this)->value_changed_event(); }
1316 {
return (*this)->value_changed_event(); }
1322 {
return (*this)->read(); }
1325 {
return (*this)->read(); }
1330 {
return (*this)->event(); }
1338 *
this, &inout_if_type::value_changed_event );
1346 {
return (*this)->read().and_reduce(); }
1348 {
return (*this)->read().nand_reduce(); }
1350 {
return (*this)->read().nor_reduce(); }
1352 {
return (*this)->read().or_reduce(); }
1354 {
return (*this)->read().xnor_reduce(); }
1356 {
return (*this)->read().xor_reduce(); }
1365 if( m_init_val_p != 0 ) {
1366 (*this)->write( *m_init_val_p );
1367 delete m_init_val_p;
1370 if( m_traces != 0 ) {
1371 for(
unsigned int i = 0;
i < m_traces->size(); ++
i ) {
1379 virtual inline const char*
kind()
const 1380 {
return "sc_inout"; }
1386 inout_if_type* iface =
dynamic_cast<inout_if_type*
>( this->get_interface() );
1388 iface->
write( value_ );
1390 if( m_init_val_p == 0 ) {
1393 *m_init_val_p = value_;
1402 if( m_traces == 0 ) {
1413 {
return (*this)->read().concat_length( xz_present_p ); }
1415 {
return (*this)->read().concat_get_uint64(); }
1417 {
return (*this)->read().concat_get_ctrl(dst_p, low_i); }
1419 {
return (*this)->read().concat_get_data(dst_p, low_i); }
1421 { *
this = (src >> ((low_i < 64) ? low_i : 63)); }
1424 { *
this = src >> low_i; }
1427 { *
this = (src >> low_i); }
1429 { *
this = (src >> low_i); }
1431 { *
this = (low_i < 64 ) ? src >> low_i : (
sc_dt::uint64)0; }
1441 { (*this)->write(new_val); }
1456 template<
typename T>
1460 new_val->to_sc_unsigned(temp);
1461 (*this)->write(temp);
1464 { (*this)->write(new_val); }
1466 { (*this)->write(new_val); }
1473 { (*this)->write( new_val.read() ); }
1475 { (*this)->write( new_val.read() ); }
1477 { (*this)->write( new_val ); }
1482 if( m_traces != 0 ) {
1483 for(
int i = m_traces->size() - 1;
i >= 0; --
i ) {
1484 delete (*m_traces)[
i];
1505 static data_type dummy;
1516 a.read().print( os );
1550 : base_type( name_ )
1554 : base_type( interface_ )
1557 sc_out(
const char* name_, inout_if_type& interface_ )
1558 : base_type( name_, interface_ )
1562 : base_type( parent_ )
1565 sc_out(
const char* name_, inout_port_type& parent_ )
1566 : base_type( name_, parent_ )
1570 : base_type( parent_ )
1573 sc_out(
const char* name_, this_type& parent_ )
1574 : base_type( name_, parent_ )
1592 { (*this)->write(new_val); }
1607 template<
typename T>
1611 new_val->to_sc_unsigned(temp);
1612 (*this)->write(temp);
1615 { (*this)->write(new_val); }
1617 { (*this)->write(new_val); }
1626 sc_out(
const this_type& );
1657 m_if_p->write_part( v, m_left, m_right );
1700 m_if_p->write_part( v, m_left, m_right );
1705 m_if_p->write_part( v, m_left, m_right );
1708 template<
typename T>
1713 v->to_sc_unsigned(temp);
1714 m_if_p->write_part( temp, m_left, m_right );
1719 #endif // !defined(SC_SIGNAL_UNSIGNED_H) 1727 const char* first_writer,
1728 const char* second_writer );
1795 tmp = (src < 0) ? -1 : 0;
1796 m_if_p->write_part( tmp, m_left, m_right );
1802 m_if_p->write_part( src >> low_i, m_left, m_right );
1810 m_if_p->write_part( tmp >> low_i, m_left, m_right );
1816 m_if_p->write_part( src >> low_i, m_left, m_right );
1823 m_if_p->write_part( tmp, m_left, m_right );
void initialize(sc_unsigned_part_if *if_p, int left_, int right_)
virtual sc_dt::sc_unsigned read_part(int left, int right) const
sc_dt::sc_biguint< W > data_type
sc_dt::sc_unsigned_subref_r range(int left, int right) const
X & operator^=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_inout< data_type > base_type
virtual void end_of_elaboration()
void remove_traces() const
sc_in(this_type &parent_)
sc_in(const char *name_, this_type &parent_)
const std::string & name()
virtual void concat_set(const sc_dt::sc_unsigned &src, int low_i)
sc_port_base * m_output_p
sc_in(inout_port_type &parent_)
sc_event_finder & value_changed() const
void write(const sc_in< sc_dt::sc_biguint< W > > &new_val)
const sc_event & value_changed_event() const
void write(const sc_dt::sc_biguint< W > &new_val)
sc_out(const char *name_)
X & operator&=(sc_proxy< X > &px, const sc_proxy< Y > &py)
sc_inout(inout_if_type &interface_)
virtual bool concat_get_ctrl(sc_dt::sc_digit *dst_p, int low_i) const
base_type::inout_if_type inout_if_type
const char * sc_gen_unique_name(const char *seed)
sc_inout(const char *name_, inout_if_type &interface_)
virtual int vbind(sc_interface &interface_)
sc_dt::sc_biguint< W > data_type
sc_unsigned_sigref & range(int left, int right)
sc_signal< T, WRITER_POLICY > & operator=(const T &t)
virtual sc_dt::sc_unsigned * part_read_target()
virtual void end_of_elaboration()
base_type inout_port_type
virtual void concat_set(sc_dt::uint64 src, int low_i)
const char * name() const
int vbind(sc_interface &i) override
void add_trace(sc_trace_file *tf_, const std::string &name_) const
virtual void write(const T &t)
sc_out(const char *name_, inout_port_type &parent_)
sc_dt::sc_unsigned_bitref_r bit(int i) const
sc_signal< sc_dt::sc_biguint< W > > this_type
void add_trace(sc_trace_file *tf_, const std::string &name_) const
std::ostream & operator<<(std::ostream &os, sc_status s)
virtual const T & read() const
virtual void write(const T &)=0
static sc_process_b * sc_get_current_process_b()
sc_out(this_type &parent_)
sc_unsigned_part_if * m_if_p
sc_signal_inout_if< sc_dt::sc_biguint< W > > inout_if_type
sc_in(const in_if_type &interface_)
sc_inout(const char *name_, inout_port_type &parent_)
const sc_unsigned & operator=(const sc_unsigned &v)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
virtual int vbind(sc_port_base &parent_)
virtual bool concat_get_ctrl(sc_dt::sc_digit *dst_p, int low_i) const
virtual const char * kind() const
sc_inout(const char *name_)
sc_unsigned_part_if & operator=(const sc_unsigned_part_if &)
virtual bool concat_get_data(sc_dt::sc_digit *dst_p, int low_i) const
sc_simcontext * simcontext() const
sc_out(inout_port_type &parent_)
sc_out(const char *name_, inout_if_type &interface_)
virtual const char * kind() const
void sc_trace(sc_trace_file *tf, const sc_in< T > &i, const std::string &name)
void operator=(sc_dt::uint64 v)
virtual void concat_set(const sc_dt::sc_signed &src, int low_i)
void bind(const inout_if_type &interface_)
sc_inout(inout_port_type &parent_)
virtual int vbind(sc_port_base &parent_)
sc_process_b * m_writer_p
virtual sc_unsigned_sigref & select_part(int left, int right)
void sc_signal_invalid_writer(const char *name, const char *kind, const char *first_writer, const char *second_writer)
sc_dt::sc_unsigned_bitref_r bit(int i) const
virtual int vbind(sc_interface &interface_)
sc_inout< sc_dt::sc_biguint< W > > this_type
X & operator|=(sc_proxy< X > &px, const sc_proxy< Y > &py)
virtual const char * kind() const
sc_signal_in_if< sc_dt::sc_biguint< W > > if_type
sc_inout< sc_dt::sc_biguint< W > > inout_port_type
virtual sc_dt::uint64 concat_get_uint64() const
const char SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_[]
sc_trace_params_vec * m_traces
const sc_dt::sc_biguint< W > & read() const
virtual void register_port(sc_port_base &, const char *)
sc_in(in_port_type &parent_)
sc_inout(this_type &parent_)
base_type::inout_port_type inout_port_type
const sc_event & default_event() const
sc_in(const char *name_, const in_if_type &interface_)
void write(const sc_inout< sc_dt::sc_biguint< W > > &new_val)
const sc_dt::sc_biguint< W > & read() const
virtual int concat_length(bool *xz_present_p) const
sc_inout(const char *name_, this_type &parent_)
virtual void concat_set(sc_dt::int64 src, int low_i)
sc_trace_params_vec * m_traces
#define SC_REPORT_ERROR(msg_type, msg)
void bind(inout_port_type &parent_)
const sc_event & value_changed_event() const
sc_dt::sc_biguint< W > data_type
sc_dt::sc_biguint< W > * m_init_val_p
const sc_event & default_event() const
sc_out< data_type > this_type
virtual void concat_set(sc_dt::int64 src, int low_i)
virtual int concat_length(bool *xz_present_p) const
virtual const sc_event & default_event() const
sc_dt::sc_unsigned m_new_val
std::vector< sc_trace_params * > sc_trace_params_vec
void remove_traces() const
sc_in(const char *name_, inout_port_type &parent_)
sc_unsigned_sigref & bit(int i)
sc_out(const char *name_, this_type &parent_)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
virtual ~sc_unsigned_sigref()
virtual const sc_core::sc_event & value_changed_event() const
static sc_vpool< sc_unsigned_sigref > m_pool
sc_signal_inout_if< sc_dt::sc_biguint< W > > if_type
sc_in< sc_dt::sc_biguint< W > > this_type
sc_event_finder & value_changed() const
void bind(const in_if_type &interface_)
sc_dt::uint64 delta_count() const
sc_event * m_changed_event_p
virtual void write_part(sc_dt::int64 v, int left, int right)
void initialize(const sc_dt::sc_biguint< W > &value_)
sc_out(inout_if_type &interface_)
void bind(sc_interface &)
sc_signal_in_if< sc_dt::sc_biguint< W > > this_type
void bind(in_port_type &parent_)
sc_in(const char *name_, in_port_type &parent_)
void bind(inout_port_type &parent_)
sc_dt::uint64 m_event_delta
virtual bool concat_get_data(sc_dt::sc_digit *dst_p, int low_i) const
virtual sc_dt::uint64 concat_get_uint64() const
sc_dt::sc_unsigned_subref_r range(int left, int right) const