178#if !defined(SC_SIGNAL_SIGNED_H)
179#define SC_SIGNAL_SIGNED_H
181#if ( !defined(_MSC_VER) || _MSC_VER > 1200 )
182# define SC_TEMPLATE template<int W>
184# define SC_TEMPLATE template<> template<int W>
193class sc_signed_sigref;
345 explicit inline sc_signal(
const char* name_);
349 inline bool base_event()
const;
351 inline const sc_event& base_value_changed_event()
const;
358 virtual inline const char*
kind()
const;
359 virtual inline void update();
370 virtual inline void write_part(
sc_dt::int64 v,
int left,
int right );
371 virtual inline void write_part(
sc_dt::uint64 v,
int left,
int right );
372 virtual inline void write_part(
const sc_dt::sc_signed& v,
int left,
int right );
376 virtual inline bool event()
const;
392 inline void operator = (
const char* new_val );
398 inline void operator = (
unsigned int new_val );
399 inline void operator = (
unsigned long new_val );
400 inline void operator = (
unsigned short new_val );
410 virtual inline void concat_set(
sc_dt::int64 src,
int low_i);
414 virtual inline void concat_set(
sc_dt::uint64 src,
int low_i);
502 return simcontext()->delta_count() == m_event_delta + 1;
516 if ( !m_changed_event_p ) m_changed_event_p =
new sc_event;
517 return *m_changed_event_p;
524# if defined(DEBUG_SYSTEMC)
534# if defined(DEBUG_SYSTEMC)
544# if defined(DEBUG_SYSTEMC)
555# if defined(DEBUG_SYSTEMC)
573 if( m_writer_p == 0 )
575 m_writer_p = writer_p;
577 else if( m_writer_p != writer_p )
580 m_writer_p->name(), writer_p->
name() );
600 base_write(src >> low_i);
621 base_write( (src >> low_i) );
628 base_write( (src >> low_i) );
634 base_write( (
sc_dt::uint64)(( low_i < 64 ) ? src >> low_i : 0));
641 {
return base_value_changed_event(); }
646 {
return base_event(); }
693 return operator () (bit,bit);
699 { base_write( new_val ); }
708 { base_write(new_val); }
713 { base_write(new_val); }
751 new_val->to_sc_unsigned(temp);
757 { base_write(new_val); }
771 { base_write(new_val); }
785 int left,
int right )
const
795 std::string nm( if_typename_ );
798 if( m_output_p != 0 )
801 m_output_p->name(), port_.
name() );
806 if ( &port_ && if_typename_ ) {}
814 m_changed_event_p(0),
824 m_changed_event_p(0),
834 if ( m_changed_event_p )
delete m_changed_event_p;
841 if ( m_changed_event_p )
843 if ( m_new_val != *
this )
845 m_changed_event_p->notify_delayed();
846 m_event_delta = simcontext()->delta_count();
855 {
return base_value_changed_event(); }
860 { base_write( value ); }
865 { base_write( value ); }
870 { base_write( value); }
887 m_new_val(left, right) = v;
896 m_new_val(left, right) = v;
906 m_new_val(left, right) = v;
916 m_new_val(left, right) = v;
930 public sc_port<sc_signal_in_if<sc_dt::sc_bigint<W> >, 1,
931 SC_ONE_OR_MORE_BOUND>,
974 if( in_parent != 0 ) {
979 if( inout_parent != 0 ) {
1012 :
base_type( name_, parent_ ), m_traces( 0 )
1028 :
base_type( name_, parent_ ), m_traces( 0 )
1042 {
return (*this)->read()[i]; }
1044 {
return (*this)->read()[i]; }
1046 {
return (*this)->read()(left,right); }
1048 {
return (*this)->read()(left,right); }
1056 {
return (*this)->value_changed_event(); }
1062 {
return (*this)->value_changed_event(); }
1068 {
return (*this)->read(); }
1071 {
return (*this)->read(); }
1076 {
return (*this)->event(); }
1084 *
this, &in_if_type::value_changed_event );
1092 {
return (*this)->read().and_reduce(); }
1094 {
return (*this)->read().nand_reduce(); }
1096 {
return (*this)->read().nor_reduce(); }
1098 {
return (*this)->read().or_reduce(); }
1100 {
return (*this)->read().xnor_reduce(); }
1102 {
return (*this)->read().xor_reduce(); }
1111 if( m_traces != 0 ) {
1112 for(
unsigned int i = 0; i < m_traces->size(); ++ i ) {
1120 virtual inline const char*
kind()
const
1128 if( m_traces == 0 ) {
1139 {
return (*this)->read().concat_length( xz_present_p ); }
1141 {
return (*this)->read().concat_get_uint64(); }
1143 {
return (*this)->read().concat_get_ctrl(dst_p, low_i); }
1145 {
return (*this)->read().concat_get_data(dst_p, low_i); }
1150 if( m_traces != 0 ) {
1151 for(
int i = m_traces->size() - 1; i >= 0; -- i ) {
1152 delete (*m_traces)[i];
1184 a.read().print( os );
1199 public sc_port<sc_signal_inout_if<sc_dt::sc_bigint<W> >, 1,
1200 SC_ONE_OR_MORE_BOUND>,
1237 if( inout_parent != 0 ) {
1250 :
base_type(), m_init_val_p(0), m_traces( 0 )
1254 :
base_type( name_ ), m_init_val_p(0), m_traces( 0 )
1258 :
base_type( interface_ ), m_init_val_p(0), m_traces( 0 )
1262 :
base_type( name_, interface_ ), m_init_val_p(0), m_traces( 0 )
1266 :
base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
1270 :
base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
1274 :
base_type( parent_ ), m_init_val_p(0), m_traces( 0 )
1278 :
base_type( name_, parent_ ), m_init_val_p(0), m_traces( 0 )
1292 {
return (*this)->read()[i]; }
1294 {
return (*this)->read()[i]; }
1296 {
return (*this)->select_part(i,i); }
1298 {
return (*this)->select_part(i,i); }
1300 {
return (*this)->read()(left,right); }
1302 {
return (*this)->read()(left,right); }
1304 {
return (*this)->select_part(left,right); }
1306 {
return (*this)->select_part(left,right); }
1314 {
return (*this)->value_changed_event(); }
1320 {
return (*this)->value_changed_event(); }
1326 {
return (*this)->read(); }
1329 {
return (*this)->read(); }
1334 {
return (*this)->event(); }
1342 *
this, &inout_if_type::value_changed_event );
1350 {
return (*this)->read().and_reduce(); }
1352 {
return (*this)->read().nand_reduce(); }
1354 {
return (*this)->read().nor_reduce(); }
1356 {
return (*this)->read().or_reduce(); }
1358 {
return (*this)->read().xnor_reduce(); }
1360 {
return (*this)->read().xor_reduce(); }
1369 if( m_init_val_p != 0 ) {
1370 (*this)->write( *m_init_val_p );
1371 delete m_init_val_p;
1374 if( m_traces != 0 ) {
1375 for(
unsigned int i = 0; i < m_traces->size(); ++ i ) {
1383 virtual inline const char*
kind()
const
1384 {
return "sc_inout"; }
1392 iface->
write( value_ );
1394 if( m_init_val_p == 0 ) {
1397 *m_init_val_p = value_;
1406 if( m_traces == 0 ) {
1417 {
return (*this)->read().concat_length( xz_present_p ); }
1419 {
return (*this)->read().concat_get_uint64(); }
1421 {
return (*this)->read().concat_get_ctrl(dst_p, low_i); }
1423 {
return (*this)->read().concat_get_data(dst_p, low_i); }
1425 { *
this = (src >> ((low_i < 64) ? low_i : 63)); }
1428 { *
this = src >> low_i; }
1431 { *
this = (src >> low_i); }
1433 { *
this = (src >> low_i); }
1435 { *
this = ((low_i < 64) ? (src >> low_i) : (
sc_dt::uint64)0); }
1440 { (*this)->write( new_val.
read() ); }
1444 { (*this)->write(new_val); }
1446 { (*this)->write(new_val); }
1459 template<
typename T>
1463 new_val->to_sc_unsigned(temp);
1464 (*this)->write(temp);
1467 { (*this)->write(new_val); }
1469 { (*this)->write(new_val); }
1476 { (*this)->write( new_val.read() ); }
1478 { (*this)->write( new_val.read() ); }
1480 { (*this)->write( new_val); }
1485 if( m_traces != 0 ) {
1486 for(
int i = m_traces->size() - 1; i >= 0; -- i ) {
1487 delete (*m_traces)[i];
1519 a.read().print( os );
1595 { (*this)->write(new_val); }
1610 template<
typename T>
1614 new_val->to_sc_unsigned(temp);
1615 (*this)->write(temp);
1618 { (*this)->write(new_val); }
1620 { (*this)->write(new_val); }
1697 v->to_sc_unsigned(temp);
1727 const char* first_writer,
1728 const char* second_writer );
1795 tmp = (src < 0) ? -1 : 0;
1822 uint64 tmp = (low_i < 63) ? (src >> low_i) : 0;
sc_dt::sc_bigint< W > data_type
sc_inout< sc_dt::sc_bigint< W > > inout_port_type
sc_trace_params_vec * m_traces
sc_in(const char *name_, const in_if_type &interface_)
sc_in< sc_dt::sc_bigint< W > > this_type
virtual void end_of_elaboration()
void bind(const in_if_type &interface_)
virtual int vbind(sc_interface &interface_)
void remove_traces() const
sc_in(in_port_type &parent_)
const sc_event & default_event() const
sc_dt::sc_signed_bitref_r bit(int i) const
sc_in(const char *name_, this_type &parent_)
sc_in(inout_port_type &parent_)
virtual bool concat_get_data(sc_dt::sc_digit *dst_p, int low_i) const
virtual bool concat_get_ctrl(sc_dt::sc_digit *dst_p, int low_i) const
virtual const char * kind() const
virtual int vbind(sc_port_base &parent_)
void add_trace(sc_trace_file *tf_, const std::string &name_) const
virtual int concat_length(bool *xz_present_p) const
sc_signal_in_if< sc_dt::sc_bigint< W > > if_type
const sc_dt::sc_bigint< W > & read() const
sc_event_finder & value_changed() const
sc_in(const in_if_type &interface_)
sc_in(const char *name_, inout_port_type &parent_)
sc_dt::sc_signed_subref_r range(int left, int right) const
sc_signal_inout_if< sc_dt::sc_bigint< W > > inout_if_type
const sc_event & value_changed_event() const
sc_in(this_type &parent_)
sc_in(const sc_in< sc_dt::sc_bigint< W > > &)
void bind(in_port_type &parent_)
void bind(inout_port_type &parent_)
virtual sc_dt::uint64 concat_get_uint64() const
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_in(const char *name_, in_port_type &parent_)
sc_in< T > & operator=(const sc_in< T > &)
void operator()(const sc_signal_in_if< T > &i)
virtual bool concat_get_data(sc_dt::sc_digit *dst_p, int low_i) const
virtual int concat_length(bool *xz_present_p) const
sc_signed_sigref & bit(int i)
const sc_dt::sc_bigint< W > & read() const
void add_trace(sc_trace_file *tf_, const std::string &name_) const
sc_inout(inout_port_type &parent_)
void write(const sc_inout< sc_dt::sc_bigint< W > > &new_val)
sc_inout(inout_if_type &interface_)
sc_event_finder & value_changed() const
virtual void concat_set(const sc_dt::sc_unsigned &src, int low_i)
virtual bool concat_get_ctrl(sc_dt::sc_digit *dst_p, int low_i) const
virtual sc_dt::uint64 concat_get_uint64() const
void write(const sc_dt::sc_bigint< W > &new_val)
virtual void end_of_elaboration()
sc_dt::sc_bigint< W > data_type
void bind(const inout_if_type &interface_)
sc_inout(const char *name_, inout_port_type &parent_)
virtual const char * kind() const
void write(const sc_in< sc_dt::sc_bigint< W > > &new_val)
sc_inout(this_type &parent_)
virtual int vbind(sc_port_base &parent_)
virtual void concat_set(sc_dt::int64 src, int low_i)
const sc_event & default_event() const
sc_inout(const char *name_, inout_if_type &interface_)
virtual void concat_set(const sc_dt::sc_signed &src, int low_i)
sc_inout(const char *name_)
sc_inout(const sc_inout< sc_dt::sc_bigint< W > > &)
const sc_event & value_changed_event() const
sc_signed_sigref & range(int left, int right)
void remove_traces() const
sc_dt::sc_signed_bitref_r bit(int i) const
sc_dt::sc_bigint< W > * m_init_val_p
sc_trace_params_vec * m_traces
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_inout< sc_dt::sc_bigint< W > > this_type
void initialize(const sc_dt::sc_bigint< W > &value_)
virtual void concat_set(sc_dt::uint64 src, int low_i)
sc_dt::sc_signed_subref_r range(int left, int right) const
virtual int vbind(sc_interface &interface_)
void bind(inout_port_type &parent_)
sc_inout(const char *name_, this_type &parent_)
base_type inout_port_type
sc_signal_inout_if< sc_dt::sc_bigint< W > > if_type
sc_inout< T > & operator=(const T &t)
const char * name() const
sc_out(inout_if_type &interface_)
sc_out(const char *name_, this_type &parent_)
sc_out(const char *name_, inout_port_type &parent_)
sc_out(const char *name_)
sc_dt::sc_bigint< W > data_type
sc_out(this_type &parent_)
sc_out< data_type > this_type
sc_out(inout_port_type &parent_)
sc_out(const char *name_, inout_if_type &interface_)
base_type::inout_port_type inout_port_type
base_type::inout_if_type inout_if_type
sc_inout< data_type > base_type
sc_out(const this_type &)
sc_out< T > & operator=(const T &t)
int vbind(sc_interface &i) override
sc_interface * get_interface()
sc_signal_in_if< T > * operator[](int n)
void operator()(sc_signal_inout_if< T > &i)
void bind(sc_interface &)
sc_dt::uint64 m_event_delta
sc_process_b * m_writer_p
sc_event * m_changed_event_p
sc_port_base * m_output_p
sc_signal< sc_dt::sc_bigint< W > > this_type
sc_dt::sc_signed m_new_val
sc_signal_in_if(const this_type &)
sc_signal_in_if< sc_dt::sc_bigint< W > > this_type
virtual const sc_dt::sc_bigint< W > & get_data_ref() const =0
virtual const sc_dt::sc_bigint< W > & read() const =0
virtual const sc_event & value_changed_event() const =0
virtual bool event() const =0
sc_signal_in_if< T > & operator=(const sc_signal_in_if< T > &)
virtual void write(const T &)=0
sc_signal< T, WRITER_POLICY > & operator=(const T &t)
virtual void write_part(sc_dt::uint64 v, int left, int right)
virtual void write_part(sc_dt::int64 v, int left, int right)
virtual sc_dt::sc_signed read_part(int left, int right) const
sc_signed_part_if(const sc_signed_part_if &)
virtual sc_dt::sc_signed * part_read_target()
sc_signed_part_if & operator=(const sc_signed_part_if &)
virtual sc_signed_sigref & select_part(int left, int right)
void initialize(sc_signed_part_if *if_p, int left_, int right_)
virtual void concat_set(sc_dt::int64 src, int low_i)
void operator=(sc_dt::uint64 v)
virtual ~sc_signed_sigref()
static sc_vpool< sc_signed_sigref > m_pool
sc_signed_sigref(const sc_signed_sigref &a)
sc_signed_part_if * m_if_p
const sc_signed & operator=(const sc_signed &v)
sc_signed_subref & operator()(int i, int j)
virtual const sc_core::sc_event & default_event() const
virtual const T & read() const
virtual const sc_core::sc_event & value_changed_event() const
virtual void register_port(sc_core::sc_port_base &port, const char *iface_type_name)
virtual bool event() const
virtual void write(const T &t)
virtual const char * kind() const
static sc_process_b * sc_get_current_process_b()
std::vector< sc_trace_params * > sc_trace_params_vec
void sc_signal_invalid_writer(const char *name, const char *kind, const char *first_writer, const char *second_writer)
std::ostream & operator<<(std::ostream &os, sc_status s)
void sc_trace(sc_trace_file *tf, const sc_in< T > &i, const std::string &name)
#define SC_REPORT_ERROR(msg_type, msg)
const std::string & name()