Index: /sources/src/Makefile
===================================================================
--- /sources/src/Makefile	(revision 3)
+++ /sources/src/Makefile	(revision 4)
@@ -10,8 +10,4 @@
 # |                                                             |
 # \------------------------------------------------------------*/
-ifndef SYSTEMC
-$(error SYSTEMC is not defined. This variable should be set to SystemCASS \
-directory when SYSTEMCASS variable is not set.)
-endif
 ifndef SYSTEMCASS
 $(error SYSTEMCASS is not defined. This variable has to be defined to install \
@@ -186,4 +182,5 @@
 
 EXTERNAL_INCLUDES = \
+              ${SYSTEMCASS_INCLUDEDIR}/systemc \
               ${SYSTEMCASS_INCLUDEDIR}/systemc.h \
               ${SYSTEMCASS_INCLUDEDIR}/sc_fwd.h\
@@ -289,4 +286,7 @@
 	cp $*.h ${SYSTEMCASS_INCLUDEDIR}/$*.h
 
+${SYSTEMCASS_INCLUDEDIR}/systemc: systemc
+	cp $< $@
+
 ${SYSTEMCASS_DOCDIR}/%.pdf: %.pdf
 	cp $*.pdf ${SYSTEMCASS_DOCDIR}/$*.pdf
@@ -348,5 +348,5 @@
 	./guess_endianness.x > ${SYSTEMCASS_INCLUDEDIR}/endianness.h
 
-include Makefile.deps
+-include Makefile.deps
 
 ##################
@@ -374,5 +374,5 @@
 #### CLEANING
 clean :
-	echo > Makefile.deps
+	rm -f Makefile.deps
 	rm -f *~
 	rm -f $(OBJECTS)
Index: urces/src/Makefile.deps
===================================================================
--- /sources/src/Makefile.deps	(revision 3)
+++ 	(revision )
@@ -1,1 +1,0 @@
-
Index: /sources/src/casc.h
===================================================================
--- /sources/src/casc.h	(revision 3)
+++ /sources/src/casc.h	(revision 4)
@@ -19,6 +19,8 @@
 #endif
 
+#include <stdint.h>
+
 EXTERN char unstable;
-EXTERN unsigned int pending_write_vector_nb;
+EXTERN int32_t pending_write_vector_nb;
 
 namespace sc_core {
Index: /sources/src/dump_dot.cc
===================================================================
--- /sources/src/dump_dot.cc	(revision 3)
+++ /sources/src/dump_dot.cc	(revision 4)
@@ -41,8 +41,10 @@
 #include "sc_ver.h" // sc_version
 
-typedef std::list<sc_port_base*> port_list_t;
+typedef std::list<sc_core::sc_port_base*> port_list_t;
 using namespace std;
 
 namespace sc_core {
+
+using namespace sc_dt;
 
 // Build a port list owned by the module mod
Index: /sources/src/global_functions.cc
===================================================================
--- /sources/src/global_functions.cc	(revision 3)
+++ /sources/src/global_functions.cc	(revision 4)
@@ -357,5 +357,5 @@
 
 void 
-sc_start(double d_val) 
+sc_start(double d_val)
 {
 	sc_cycle (d_val);
@@ -368,4 +368,16 @@
 }
 
+void 
+sc_start()
+{
+	sc_cycle (-1);
+#ifdef DUMP_SIGNAL_STATS
+	print_registers_writing_stats (cerr);
+#endif
+#ifdef DUMP_SCHEDULE_STATS
+	print_schedule_stats (cerr);
+#endif
+}
+
 void
 sc_start (double       d_val,
@@ -378,5 +390,11 @@
 sc_start( const sc_time& duration )
 {
-	sc_start ((double)duration);
+	sc_cycle ((double)duration);
+#ifdef DUMP_SIGNAL_STATS
+	print_registers_writing_stats (cerr);
+#endif
+#ifdef DUMP_SCHEDULE_STATS
+	print_schedule_stats (cerr);
+#endif
 }
 
Index: /sources/src/global_functions.h
===================================================================
--- /sources/src/global_functions.h	(revision 3)
+++ /sources/src/global_functions.h	(revision 4)
@@ -35,5 +35,6 @@
 
 //extern void next_cycle(void);
-extern void         sc_start         (double d_val = -1);
+extern void         sc_start         (double d_val)  __attribute__((deprecated));
+extern void         sc_start         ();
 extern void         sc_start         ( const sc_time& duration );
 extern void         sc_start         (double d_val, sc_time_unit d_tu);
Index: /sources/src/sc_event_finder.cc
===================================================================
--- /sources/src/sc_event_finder.cc	(revision 3)
+++ /sources/src/sc_event_finder.cc	(revision 4)
@@ -37,5 +37,7 @@
 #include"sc_event_finder.h"
 
-sc_event_finder::sc_event_finder (/*const*/ sc_port_base &p)
+namespace sc_core {
+
+sc_event_finder::sc_event_finder (/*const*/ sc_core::sc_port_base &p)
   : a_port (p)
 {
@@ -46,5 +48,5 @@
 }
 
-/*const*/ sc_port_base& 
+/*const*/ sc_core::sc_port_base& 
 sc_event_finder::port () /*const*/
 {
@@ -52,2 +54,3 @@
 }
 
+}
Index: /sources/src/sc_event_finder.h
===================================================================
--- /sources/src/sc_event_finder.h	(revision 3)
+++ /sources/src/sc_event_finder.h	(revision 4)
@@ -15,12 +15,14 @@
 #include"sc_fwd.h"
 
+namespace sc_core {
+
 class sc_event_finder {
-  /*const*/sc_port_base &a_port;
+  /*const*/sc_core::sc_port_base &a_port;
 public:
-  sc_event_finder (/*const*/ sc_port_base&);
+  sc_event_finder (/*const*/ sc_core::sc_port_base&);
   virtual ~sc_event_finder ();
 
   // methods
-  /*const*/ sc_port_base& port () /*const*/;
+  /*const*/ sc_core::sc_port_base& port () /*const*/;
   
   // operators
@@ -33,3 +35,5 @@
 };
 
+}
+
 #endif /* __SC_EVENT_FINDER_H__ */
Index: /sources/src/sc_fwd.h
===================================================================
--- /sources/src/sc_fwd.h	(revision 3)
+++ /sources/src/sc_fwd.h	(revision 4)
@@ -56,32 +56,4 @@
 }
 
-using sc_core::method_process_t;
-using sc_core::sc_port_base;
-using sc_core::sc_object;
-using sc_core::sc_interface;
-using sc_core::sc_module;
-using sc_core::sc_module_name;
-using sc_core::sc_event;
-using sc_core::sc_event_finder;
-using sc_core::sc_sensitive;
-using sc_core::sc_sensitive_pos;
-using sc_core::sc_sensitive_neg;
-/////////////////////////////////////////////////
-// Ports & Signals
-//
-using sc_core::sc_time;
-
-using sc_core::sc_in;
-using sc_core::sc_inout;
-using sc_core::sc_out;
-using sc_core::sc_signal;
-using sc_core::sc_port_b;
-using sc_core::sc_signal_base;
-using sc_core::sc_clock;
-
-using sc_core::sc_trace_file;
-
-using sc_core::method_process_list_t;
-
 /////////////////////////////////////////////////
 // Data Types
@@ -101,17 +73,4 @@
 }
 
-using sc_dt::sc_bit;
-using sc_dt::sc_bv;
-using sc_dt::sc_logic;
-using sc_dt::sc_lv;
-using sc_dt::sc_unsigned;
-using sc_dt::sc_signed;
-//using sc_dt::sc_int_base;
-using sc_dt::sc_int;
-using sc_dt::sc_uint;
-using sc_dt::sc_bigint;
-using sc_dt::sc_biguint;
-//using sc_dt::sc_uint_base;
-
 #endif
 
Index: /sources/src/sc_main.cc
===================================================================
--- /sources/src/sc_main.cc	(revision 3)
+++ /sources/src/sc_main.cc	(revision 4)
@@ -51,4 +51,5 @@
 //
 using namespace std;
+using namespace sc_core;
 //
 typedef list<sc_module* >         module_list_t;
@@ -58,5 +59,5 @@
 
 bool        check_port_dependencies = false;
-bool        dynamic_link_of_scheduling_code = true;
+bool        dynamic_link_of_scheduling_code = false;
 bool        dump_netlist_info       = false;
 bool        dump_funclist_info      = false;
Index: /sources/src/sc_port.cc
===================================================================
--- /sources/src/sc_port.cc	(revision 3)
+++ /sources/src/sc_port.cc	(revision 4)
@@ -51,5 +51,5 @@
 	extern char unstable;
   char unstable = 0; // not in sc_core namespace because dynamic link support C linkage only
-  unsigned int pending_write_vector_nb = 0;
+  int32_t pending_write_vector_nb = 0;
 }
 
Index: /sources/src/sc_port_ext.h
===================================================================
--- /sources/src/sc_port_ext.h	(revision 3)
+++ /sources/src/sc_port_ext.h	(revision 4)
@@ -43,4 +43,7 @@
 namespace sc_core {
 //
+
+	using namespace sc_dt;
+
 const char *get_name        (const tab_t *pointer);
 
@@ -269,5 +272,5 @@
 sc_inout<T>::init ()
 {
-	set_pointer ((tab_t*)&val);
+	set_pointer ((tab_t*)(void*)&val);
 	sc_object::set_kind    (sc_inout_string);
 	sc_interface::init (sizeof (data_type)); 
Index: /sources/src/sc_time.cc
===================================================================
--- /sources/src/sc_time.cc	(revision 3)
+++ /sources/src/sc_time.cc	(revision 4)
@@ -39,10 +39,14 @@
 #include <sys/time.h>
 #include <string>
-
-using namespace std;
+#include <sstream>
 
 namespace sc_core {
 
-uint64 nb_cycles = 0;
+static const char *const unit_repr_string[6] = 
+{
+	"FS", "PS", "NS", "US", "MS", "SEC"
+};
+
+uint64_t nb_cycles = 0;
 
 const sc_time SC_ZERO_TIME(0,SC_NS);
@@ -51,10 +55,11 @@
 sc_time::sc_time (const sc_time &t)
 {
-  time = t.time;
+	*this = t;
 }
 
 sc_time::sc_time (double val, sc_time_unit tu)
 {
-  time = (long long int) val;
+  time = (uint64_t) val;
+  unit = tu;
 }
 
@@ -64,19 +69,15 @@
 {
   time = t.time;
+  unit = t.unit;
+  return *this;
 }
 
 
-const string 
+const std::string 
 sc_time::to_string () const
 {
-	char  res[32];
-  const char* unit;
-	if (time == 0)
-  {
-    unit = "s";
-  } else
-    unit = "ns";
-  sprintf (res, "%lld %s", time, unit);
-  return (string)res;
+	std::ostringstream o;
+	o << time << ' ' << unit_repr_string[unit];
+	return o.str();
 }
 
Index: /sources/src/sc_time.h
===================================================================
--- /sources/src/sc_time.h	(revision 3)
+++ /sources/src/sc_time.h	(revision 4)
@@ -13,8 +13,6 @@
 #define __SC_TIME_H__
 
-#include <iostream>
 #include <string>
-#include "sc_nbdefs.h"
-#include "internal_ext.h"
+#include <stdint.h>
 
 namespace sc_core {
@@ -41,5 +39,5 @@
 extern sc_time SC_CURRENT_TIME;
 
-extern uint64 nb_cycles;
+extern uint64_t nb_cycles;
 
 inline double sc_simulation_time()   // in default time units
@@ -54,7 +52,7 @@
 {
   friend const sc_time &sc_time_stamp ();
-  long long int time;
+  uint64_t time;
+  enum sc_time_unit unit;
 public:
-//  sc_time (); LRM 2.1
   sc_time (double val, sc_time_unit tu);
   sc_time (const sc_time& = SC_ZERO_TIME);
@@ -62,8 +60,8 @@
   sc_time& operator= (const sc_time &);
  
-  /*sc_dt::*/uint64 value     () const { return (/*sc_dt::*/uint64) time;}
-  double        to_double () const { return time * 1000;}
-  double        to_seconds() const { return time / (double)1000000000;};
-  operator      double    () const { return to_double ();};
+  uint64_t      value     () const { return time;}
+  inline double        to_double () const;
+  inline double        to_seconds() const;
+  inline operator      double    () const { return to_double ();}
   const std::string to_string () const;
 };
@@ -75,9 +73,35 @@
 }
 
+double
+sc_time::to_double () const
+{
+	double fact = 1;
+	switch(unit) {
+	case SC_FS: fact = 1e-6; break;
+	case SC_PS: fact = 1e-3; break;
+	case SC_NS: fact = 1; break;
+	case SC_US: fact = 1e3; break;
+	case SC_MS: fact = 1e6; break;
+	case SC_SEC: fact = 1e9; break;
+	}
+	return (double)time * fact;
+}
+
+double
+sc_time::to_seconds() const
+{
+	double fact = 1;
+	switch(unit) {
+	case SC_FS: fact = 1e-15; break;
+	case SC_PS: fact = 1e-12; break;
+	case SC_NS: fact = 1e-9; break;
+	case SC_US: fact = 1e-6; break;
+	case SC_MS: fact = 1e-3; break;
+	case SC_SEC: fact = 1; break;
+	}
+	return (double)time * fact;
+}
+
 } // end of namespace sc_core
 
-using sc_core::sc_simulation_time;
-using sc_core::sc_time;
-using sc_core::sc_time_stamp;
-
 #endif /* __SC_TIME_H__ */
Index: /sources/src/sc_trace_ext.h
===================================================================
--- /sources/src/sc_trace_ext.h	(revision 3)
+++ /sources/src/sc_trace_ext.h	(revision 4)
@@ -51,4 +51,6 @@
 
 namespace sc_core {
+
+	using namespace sc_dt;
 
 //---------------------------------------------------------------------------
Index: /sources/src/systemc
===================================================================
--- /sources/src/systemc	(revision 4)
+++ /sources/src/systemc	(revision 4)
@@ -0,0 +1,33 @@
+#ifndef __SYSTEMC_HEADER
+#define __SYSTEMC_HEADER
+
+#define SYSTEMCASS_SPECIFIC
+//#define SOCVIEW // we can't define SOCVIEW macro because we don't support
+//some features like "debug" function
+#define STATESAVER_SYSTEM
+#define NONAME_RENAME
+#define PORT_DEPENDANCIES_ENABLED
+
+#include"sc_fwd.h"
+
+#include"global_functions.h"
+#include"sc_nbdefs.h"
+#include"sc_ver_ext.h"
+#include"sc_module_name.h"
+#include"sc_module_ext.h"
+#include"sc_module_name.h"
+#include"module_hierarchy_ext.h"
+#include"serialization_ext.h"
+#include"sc_port_ext.h"
+#include"sc_signal.h"
+#include"sc_clock_ext.h"
+#include"sc_sensitive.h"
+
+#include"sc_time.h"
+#include"sc_unit.h"
+#include"sc_trace_ext.h"
+#include"sc_vcd_trace.h"
+#include"sc_pat_trace.h"
+#include"endianness.h"
+
+#endif
Index: /sources/src/systemc.h
===================================================================
--- /sources/src/systemc.h	(revision 3)
+++ /sources/src/systemc.h	(revision 4)
@@ -38,32 +38,49 @@
 #define __SYSTEMC_H__
 
-#define SYSTEMCASS_SPECIFIC
-//#define SOCVIEW // we can't define SOCVIEW macro because we don't support
-//some features like "debug" function
-#define STATESAVER_SYSTEM
-#define NONAME_RENAME
-#define PORT_DEPENDANCIES_ENABLED
+#include <systemc>
 
-#include"sc_fwd.h"
 
-#include"global_functions.h"
-#include"sc_nbdefs.h"
-#include"sc_ver_ext.h"
-#include"sc_module_name.h"
-#include"sc_module_ext.h"
-#include"sc_module_name.h"
-#include"module_hierarchy_ext.h"
-#include"serialization_ext.h"
-#include"sc_port_ext.h"
-#include"sc_signal.h"
-#include"sc_clock_ext.h"
-#include"sc_sensitive.h"
+using sc_core::method_process_t;
+using sc_core::sc_port_base;
+using sc_core::sc_object;
+using sc_core::sc_interface;
+using sc_core::sc_module;
+using sc_core::sc_module_name;
+using sc_core::sc_event;
+using sc_core::sc_event_finder;
+using sc_core::sc_sensitive;
+using sc_core::sc_sensitive_pos;
+using sc_core::sc_sensitive_neg;
+/////////////////////////////////////////////////
+// Ports & Signals
+//
+using sc_core::sc_time;
+using sc_core::sc_simulation_time;
+using sc_core::sc_time_stamp;
 
-#include"sc_time.h"
-#include"sc_unit.h"
-#include"sc_trace_ext.h"
-#include"sc_vcd_trace.h"
-#include"sc_pat_trace.h"
-#include"endianness.h"
+using sc_core::sc_in;
+using sc_core::sc_inout;
+using sc_core::sc_out;
+using sc_core::sc_signal;
+using sc_core::sc_port_b;
+using sc_core::sc_signal_base;
+using sc_core::sc_clock;
+
+using sc_core::sc_trace_file;
+
+using sc_core::method_process_list_t;
+
+using sc_dt::sc_bit;
+using sc_dt::sc_bv;
+using sc_dt::sc_logic;
+using sc_dt::sc_lv;
+using sc_dt::sc_unsigned;
+using sc_dt::sc_signed;
+//using sc_dt::sc_int_base;
+using sc_dt::sc_int;
+using sc_dt::sc_uint;
+using sc_dt::sc_bigint;
+using sc_dt::sc_biguint;
+//using sc_dt::sc_uint_base;
 
 using std::ios;
