summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/misc/v1.0
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-05-24 01:37:55 -0700
committerGabe Black <gabeblack@google.com>2018-08-08 10:09:54 +0000
commit16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch)
tree7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/misc/v1.0
parent7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff)
downloadgem5-16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f.tar.xz
systemc: Import tests from the Accellera systemc distribution.
Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/tests/systemc/misc/v1.0')
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/blv/blv.cpp148
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/blv/golden/blv.log5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/blv/isaac.h272
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/dash0.f4
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/dist.cpp88
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/dist.h57
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/golden/dash0.log191
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/main.cpp112
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/pulse.cpp102
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/pulse.h63
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/speed.cpp92
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash0/speed.h71
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/dash1.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/dist.cpp98
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/dist.h68
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/driver.cpp122
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/driver.h70
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/golden/dash1.log37
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/main.cpp141
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/pulse.cpp98
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/pulse.h65
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/speed.cpp93
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash1/speed.h75
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/dash2.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/dist.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/dist.h91
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/driver.cpp122
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/driver.h70
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/golden/dash2.log37
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/main.cpp151
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/pulse.cpp98
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/pulse.h65
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash2/speed.h91
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/dash3.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/dist.h164
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/driver.h70
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/golden/dash3.log37
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/main.cpp151
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/pulse.cpp98
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/pulse.h64
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash3/speed.h140
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/dash4.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/dist.h164
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/driver.h70
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/golden/dash4.log37
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/main.cpp152
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/pulse.cpp98
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/pulse.h64
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash4/speed.h140
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/dash5.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/dist.h164
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/driver.h69
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/golden/dash5.log39
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/main.cpp151
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/pulse.cpp99
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/pulse.h64
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash5/speed.h140
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/dash6.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/dist.h164
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/driver.h69
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/golden/dash6.log35
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/main.cpp151
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/pulse.cpp101
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/pulse.h63
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash6/speed.h140
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/dash7.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/dist.h177
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/driver.h69
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/golden/dash7.log35
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/main.cpp157
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/pulse.cpp101
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/pulse.h63
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash7/speed.h148
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/dash8.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/dist.h183
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/driver.h69
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/golden/dash8.log35
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/main.cpp164
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/pulse.cpp101
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/pulse.h63
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash8/speed.h154
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/const.h62
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/dash9.f5
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/dist.cpp134
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/dist.h183
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/driver.cpp124
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/driver.h69
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/golden/dash9.log35
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/main.cpp169
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/pulse.cpp101
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/pulse.h63
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/speed.cpp111
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/dash9/speed.h154
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log161
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp228
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/out_of_bounds/golden/out_of_bounds.log17
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/out_of_bounds/out_of_bounds.cpp79
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/resolved_sig/golden/resolved_sig.log75
-rw-r--r--src/systemc/tests/systemc/misc/v1.0/resolved_sig/resolved_sig.cpp205
127 files changed, 12236 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/misc/v1.0/blv/blv.cpp b/src/systemc/tests/systemc/misc/v1.0/blv/blv.cpp
new file mode 100644
index 000000000..e2135fbf9
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/blv/blv.cpp
@@ -0,0 +1,148 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ blv.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+//----------------------------------------------------------
+// test the basic functionality of sc_bv<> and sc_lv<>
+//----------------------------------------------------------
+#include "systemc.h"
+#include <time.h>
+#include "isaac.h"
+
+QTIsaac<8> rng;
+
+template<class T>
+void compare(int W)
+{ // functionality verification
+ sc_bv_base x(W);
+ T st;
+ // initialize
+ for(int i=0; i<W; i++)
+ {
+ bool la = (rng.rand()&1) == 0;
+ x[i] = la;
+ st[i] = la;
+ }
+ if(st.to_string()!=x.to_string())
+ cout<<"\nERROR: x= "<<x<<" st= "<<st<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+ if( (int) st.xor_reduce()!= x.xor_reduce())
+ cout<<"\nERROR: st.xor_reduce="<<(short)st.xor_reduce()<<"; x.xor_reduce="<<
+ (short)x.xor_reduce()<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+ if( (int) x.or_reduce()!=st.or_reduce())
+ cout<<"\nERROR: st.or_reduce="<<(short)st.or_reduce()<<
+ "; x.or_reduce="<<(short)x.or_reduce()<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+ if( (int) x.and_reduce()!=st.and_reduce())
+ cout<<"\nERROR: st.and_reduce="<<(short)st.and_reduce()<<
+ "; x.and_reduce="<<(short)x.and_reduce()<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+
+ if((st,st).to_string()!=(x,x).to_string())
+ cout<<"\nERROR: st,st="<<(st,st)<<
+ "; x,x="<<(x,x)<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+ int first = (int) ( (double) W * ((double)rng.rand() / (double)0x7fffffff));
+ int second = (int) ( (double) W * ((double)rng.rand() / (double)0x7fffffff));
+ if(st.range(first,second).to_string()!=x.range(first,second).to_string())
+ cout<<"st.range("<<first<<","<<second<<")="<<st.range(first,second)<<
+ "; x.range("<<first<<","<<second<<")="<<x.range(first,second)<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+
+ sc_bv_base bv(2*W);
+ sc_bv_base xv(2*W);
+ bv = (st,st);
+ xv = (x,x);
+ if(bv.to_string()!=xv.to_string())
+ cout<<"\nERROR: bv(st,st)="<<bv<<"; xv(x,x)="<<xv<<"\n"<<
+ "st="<<st<<"\nx="<<x<< endl;
+ int Len=0;
+ if(first>second)
+ Len = first-second;
+ else
+ Len = second-first;
+ sc_bv_base br(Len+1);
+ sc_bv_base xr(Len+1);
+ br = st.range(first,second);
+ xr = x.range(first,second);
+ if(br.to_string()!=xr.to_string())
+ {
+ cout<<"\nERROR: br("<<first<<","<<second<<")!= xr("<<first<<","<<second
+ <<")" << endl;
+ br = st.range(first,second);
+ xr = x.range(first,second);
+ cout<<"br="<<br.to_string()<<" xr="<<xr.to_string()<<
+ "st.range="<<st.range(first,second)<<" x.range="<<x.range(first,second)<<
+ "st="<<st<<"\nx="<<x<< endl;
+ }
+
+ // verify assignments
+ long ra = rng.rand();
+ x = ra;
+ st = ra;
+ if(st.to_string()!=x.to_string())
+ cout<<"\nERROR (assignment): x= "<<x<<" st= "<<st<<" original long="<<ra
+ << endl;
+}
+
+int sc_main(int, char**)
+{
+ const int N = 2000;
+ int Seed = rng.rand();
+ cout<<"\nverifying sc_bv<"<<N<<">" << endl;
+ try{
+ for(int i=0; i<1000; i++)
+ compare<sc_bv<N> >(N);
+ }
+ catch(...)
+ {
+ cout<<"Test failed due to exception in sc_bv. Seed = "<<Seed<< endl;
+ throw;
+ }
+ try{
+ cout<<"\nverifying sc_lv<"<<N<<">" << endl;
+ for(int i=0; i<1000; i++)
+ compare<sc_lv<N> >(N);
+ }
+ catch(...)
+ {
+ cout<<"Test failed due to exception in sc_lv. Seed = "<<Seed<< endl;
+ throw;
+ }
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/v1.0/blv/golden/blv.log b/src/systemc/tests/systemc/misc/v1.0/blv/golden/blv.log
new file mode 100644
index 000000000..12908a228
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/blv/golden/blv.log
@@ -0,0 +1,5 @@
+SystemC Simulation
+
+verifying sc_bv<2000>
+
+verifying sc_lv<2000>
diff --git a/src/systemc/tests/systemc/misc/v1.0/blv/isaac.h b/src/systemc/tests/systemc/misc/v1.0/blv/isaac.h
new file mode 100644
index 000000000..9625be2ac
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/blv/isaac.h
@@ -0,0 +1,272 @@
+#ifndef __ISAAC_HPP
+#define __ISAAC_HPP
+
+
+/*
+
+ C++ TEMPLATE VERSION OF Robert J. Jenkins Jr.'s
+ ISAAC Random Number Generator.
+
+ Ported from vanilla C to to template C++ class
+ by Quinn Tyler Jackson on 16-23 July 1998.
+
+ quinn@qtj.net
+
+ The function for the expected period of this
+ random number generator, according to Jenkins is:
+
+ f(a,b) = 2**((a+b*(3+2^^a)-1)
+
+ (where a is ALPHA and b is bitwidth)
+
+ So, for a bitwidth of 32 and an ALPHA of 8,
+ the expected period of ISAAC is:
+
+ 2^^(8+32*(3+2^^8)-1) = 2^^8295
+
+ Jackson has been able to run implementations
+ with an ALPHA as high as 16, or
+
+ 2^^2097263
+
+*/
+
+
+typedef unsigned int UINT32;
+const UINT32 GOLDEN_RATIO = UINT32(0x9e3779b9);
+
+
+template <UINT32 ALPHA = (8)>
+class QTIsaac
+{
+ public:
+
+ typedef unsigned char byte;
+
+ struct randctx
+ {
+ randctx(void)
+ {
+ randrsl = new UINT32[N];
+ randmem = new UINT32[N];
+ }
+
+ ~randctx(void)
+ {
+ delete [] randrsl;
+ delete [] randmem;
+ }
+
+ UINT32 randcnt;
+ UINT32* randrsl;
+ UINT32* randmem;
+ UINT32 randa;
+ UINT32 randb;
+ UINT32 randc;
+ };
+
+ QTIsaac(UINT32 a = 0, UINT32 b = 0, UINT32 c = 0);
+ virtual ~QTIsaac(void);
+
+ UINT32 rand(void);
+ virtual void randinit(randctx* ctx, bool bUseSeed);
+ virtual void srand(
+ UINT32 a = 0, UINT32 b = 0, UINT32 c = 0, UINT32* s = NULL);
+
+ enum {N = (1<<ALPHA)};
+
+ protected:
+
+ virtual void isaac(randctx* ctx);
+
+ UINT32 ind(UINT32* mm, UINT32 x);
+ void rngstep(
+ UINT32 mix, UINT32& a, UINT32& b, UINT32*& mm, UINT32*& m,
+ UINT32*& m2, UINT32*& r, UINT32& x, UINT32& y);
+ virtual void shuffle(
+ UINT32& a, UINT32& b, UINT32& c, UINT32& d, UINT32& e, UINT32& f,
+ UINT32& g, UINT32& h);
+
+ private:
+ randctx m_rc;
+};
+
+
+template<UINT32 ALPHA>
+QTIsaac<ALPHA>::QTIsaac(UINT32 a, UINT32 b, UINT32 c) : m_rc()
+{
+ srand(a, b, c);
+}
+
+
+template<UINT32 ALPHA>
+QTIsaac<ALPHA>::~QTIsaac(void)
+{
+ // DO NOTHING
+}
+
+
+template<UINT32 ALPHA>
+void QTIsaac<ALPHA>::srand(UINT32 a, UINT32 b, UINT32 c, UINT32* s)
+{
+ for(int i = 0; i < N; i++)
+ {
+ m_rc.randrsl[i] = s != NULL ? s[i] : 0;
+ }
+
+ m_rc.randa = a;
+ m_rc.randb = b;
+ m_rc.randc = c;
+
+ randinit(&m_rc, true);
+}
+
+
+template<UINT32 ALPHA>
+inline UINT32 QTIsaac<ALPHA>::rand(void)
+{
+ return 0x7fffffff & (!m_rc.randcnt-- ?
+ (isaac(&m_rc), m_rc.randcnt=(N-1), m_rc.randrsl[m_rc.randcnt]) :
+ m_rc.randrsl[m_rc.randcnt]);
+}
+
+
+template<UINT32 ALPHA>
+inline void QTIsaac<ALPHA>::randinit(randctx* ctx, bool bUseSeed)
+{
+ UINT32 a,b,c,d,e,f,g,h;
+ int i;
+
+ a = b = c = d = e = f = g = h = GOLDEN_RATIO;
+
+ UINT32* m = (ctx->randmem);
+ UINT32* r = (ctx->randrsl);
+
+ if(!bUseSeed)
+ {
+ ctx->randa = 0;
+ ctx->randb = 0;
+ ctx->randc = 0;
+ }
+
+ // scramble it
+ for(i=0; i < 4; ++i)
+ {
+ shuffle(a,b,c,d,e,f,g,h);
+ }
+
+ if(bUseSeed)
+ {
+ // initialize using the contents of r[] as the seed
+
+ for(i=0; i < N; i+=8)
+ {
+ a+=r[i ]; b+=r[i+1]; c+=r[i+2]; d+=r[i+3];
+ e+=r[i+4]; f+=r[i+5]; g+=r[i+6]; h+=r[i+7];
+
+ shuffle(a,b,c,d,e,f,g,h);
+
+ m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
+ m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
+ }
+
+ //do a second pass to make all of the seed affect all of m
+
+ for(i=0; i < N; i += 8)
+ {
+ a+=m[i ]; b+=m[i+1]; c+=m[i+2]; d+=m[i+3];
+ e+=m[i+4]; f+=m[i+5]; g+=m[i+6]; h+=m[i+7];
+
+ shuffle(a,b,c,d,e,f,g,h);
+
+ m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
+ m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
+ }
+ }
+ else
+ {
+ // fill in mm[] with messy stuff
+
+ shuffle(a,b,c,d,e,f,g,h);
+
+ m[i ]=a; m[i+1]=b; m[i+2]=c; m[i+3]=d;
+ m[i+4]=e; m[i+5]=f; m[i+6]=g; m[i+7]=h;
+
+ }
+
+ isaac(ctx); // fill in the first set of results
+ ctx->randcnt = N; // prepare to use the first set of results
+}
+
+
+template<UINT32 ALPHA>
+inline UINT32 QTIsaac<ALPHA>::ind(UINT32* mm, UINT32 x)
+{
+ return (*(UINT32*)((byte*)(mm) + ((x) & ((N-1)<<2))));
+}
+
+
+template<UINT32 ALPHA>
+inline void QTIsaac<ALPHA>::rngstep(UINT32 mix, UINT32& a, UINT32& b, UINT32*& mm, UINT32*& m, UINT32*& m2, UINT32*& r, UINT32& x, UINT32& y)
+{
+ x = *m;
+ a = (a^(mix)) + *(m2++);
+ *(m++) = y = ind(mm,x) + a + b;
+ *(r++) = b = ind(mm,y>>ALPHA) + x;
+}
+
+
+template<UINT32 ALPHA>
+inline void QTIsaac<ALPHA>::shuffle(UINT32& a, UINT32& b, UINT32& c, UINT32& d, UINT32& e, UINT32& f, UINT32& g, UINT32& h)
+{
+ a^=b<<11; d+=a; b+=c;
+ b^=c>>2; e+=b; c+=d;
+ c^=d<<8; f+=c; d+=e;
+ d^=e>>16; g+=d; e+=f;
+ e^=f<<10; h+=e; f+=g;
+ f^=g>>4; a+=f; g+=h;
+ g^=h<<8; b+=g; h+=a;
+ h^=a>>9; c+=h; a+=b;
+}
+
+
+template<UINT32 ALPHA>
+inline void QTIsaac<ALPHA>::isaac(randctx* ctx)
+{
+ UINT32 x,y;
+
+ UINT32* mm = ctx->randmem;
+ UINT32* r = ctx->randrsl;
+
+ UINT32 a = (ctx->randa);
+ UINT32 b = (ctx->randb + (++ctx->randc));
+
+ UINT32* m = mm;
+ UINT32* m2 = (m+(N/2));
+ UINT32* mend = m2;
+
+ for(; m<mend; )
+ {
+ rngstep((a<<13), a, b, mm, m, m2, r, x, y);
+ rngstep((a>>6) , a, b, mm, m, m2, r, x, y);
+ rngstep((a<<2) , a, b, mm, m, m2, r, x, y);
+ rngstep((a>>16), a, b, mm, m, m2, r, x, y);
+ }
+
+ m2 = mm;
+
+ for(; m2<mend; )
+ {
+ rngstep((a<<13), a, b, mm, m, m2, r, x, y);
+ rngstep((a>>6) , a, b, mm, m, m2, r, x, y);
+ rngstep((a<<2) , a, b, mm, m, m2, r, x, y);
+ rngstep((a>>16), a, b, mm, m, m2, r, x, y);
+ }
+
+ ctx->randb = b;
+ ctx->randa = a;
+}
+
+
+#endif // __ISAAC_HPP
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/const.h b/src/systemc/tests/systemc/misc/v1.0/dash0/const.h
new file mode 100644
index 000000000..233583047
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/dash0.f b/src/systemc/tests/systemc/misc/v1.0/dash0/dash0.f
new file mode 100644
index 000000000..787379cf9
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/dash0.f
@@ -0,0 +1,4 @@
+dash0/main.cpp
+dash0/dist.cpp
+dash0/pulse.cpp
+dash0/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash0/dist.cpp
new file mode 100644
index 000000000..8056060ba
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/dist.cpp
@@ -0,0 +1,88 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:51 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:10 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:44 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+// Compute the total and partial distances travelled.
+void
+dist_mod::get_dist_proc()
+{
+ wait();
+
+ double total = 0.0;
+ double partial = 0.0;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ // Increment the distances:
+ total = total + DIST_INCR;
+ partial = partial + DIST_INCR;
+
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+
+ if (total >= 3 * DIST_INCR)
+ sc_stop();
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash0/dist.h
new file mode 100644
index 000000000..9eb449ad7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/dist.h
@@ -0,0 +1,57 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+
+ // Compute the total and partial distances travelled.
+ void get_dist_proc();
+
+ SC_CTOR( dist_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/golden/dash0.log b/src/systemc/tests/systemc/misc/v1.0/dash0/golden/dash0.log
new file mode 100644
index 000000000..e3c2c7c53
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/golden/dash0.log
@@ -0,0 +1,191 @@
+SystemC Simulation
+Current speed displayed = 79.2 km/h @ 100 ns
+Current speedometer angle = 164.492 degrees @ 100 ns
+Current speed displayed = 118.8 km/h @ 200 ns
+Current speedometer angle = 246.738 degrees @ 200 ns
+Current speed displayed = 118.8 km/h @ 300 ns
+Current speedometer angle = 246.738 degrees @ 300 ns
+Current speed displayed = 118.8 km/h @ 400 ns
+Current speedometer angle = 246.738 degrees @ 400 ns
+Current speed displayed = 118.8 km/h @ 500 ns
+Current speedometer angle = 246.738 degrees @ 500 ns
+Current speed displayed = 118.8 km/h @ 600 ns
+Current speedometer angle = 246.738 degrees @ 600 ns
+Current speed displayed = 118.8 km/h @ 700 ns
+Current speedometer angle = 246.738 degrees @ 700 ns
+Current speed displayed = 118.8 km/h @ 800 ns
+Current speedometer angle = 246.738 degrees @ 800 ns
+Current speed displayed = 118.8 km/h @ 900 ns
+Current speedometer angle = 246.738 degrees @ 900 ns
+Current speed displayed = 118.8 km/h @ 1 us
+Current speedometer angle = 246.738 degrees @ 1 us
+Current speed displayed = 118.8 km/h @ 1100 ns
+Current speedometer angle = 246.738 degrees @ 1100 ns
+Current speed displayed = 118.8 km/h @ 1200 ns
+Current speedometer angle = 246.738 degrees @ 1200 ns
+Current speed displayed = 118.8 km/h @ 1300 ns
+Current speedometer angle = 246.738 degrees @ 1300 ns
+Current speed displayed = 118.8 km/h @ 1400 ns
+Current speedometer angle = 246.738 degrees @ 1400 ns
+Current speed displayed = 118.8 km/h @ 1500 ns
+Current speedometer angle = 246.738 degrees @ 1500 ns
+Current speed displayed = 118.8 km/h @ 1600 ns
+Current speedometer angle = 246.738 degrees @ 1600 ns
+Current speed displayed = 118.8 km/h @ 1700 ns
+Current speedometer angle = 246.738 degrees @ 1700 ns
+Current speed displayed = 118.8 km/h @ 1800 ns
+Current speedometer angle = 246.738 degrees @ 1800 ns
+Current speed displayed = 118.8 km/h @ 1900 ns
+Current speedometer angle = 246.738 degrees @ 1900 ns
+Current speed displayed = 118.8 km/h @ 2 us
+Current speedometer angle = 246.738 degrees @ 2 us
+Current speed displayed = 118.8 km/h @ 2100 ns
+Current speedometer angle = 246.738 degrees @ 2100 ns
+Current speed displayed = 118.8 km/h @ 2200 ns
+Current speedometer angle = 246.738 degrees @ 2200 ns
+Current speed displayed = 118.8 km/h @ 2300 ns
+Current speedometer angle = 246.738 degrees @ 2300 ns
+Current speed displayed = 118.8 km/h @ 2400 ns
+Current speedometer angle = 246.738 degrees @ 2400 ns
+Current speed displayed = 118.8 km/h @ 2500 ns
+Current speedometer angle = 246.738 degrees @ 2500 ns
+Current speed displayed = 118.8 km/h @ 2600 ns
+Current speedometer angle = 246.738 degrees @ 2600 ns
+Current speed displayed = 118.8 km/h @ 2700 ns
+Current speedometer angle = 246.738 degrees @ 2700 ns
+Current speed displayed = 118.8 km/h @ 2800 ns
+Current speedometer angle = 246.738 degrees @ 2800 ns
+Current speed displayed = 118.8 km/h @ 2900 ns
+Current speedometer angle = 246.738 degrees @ 2900 ns
+Current speed displayed = 118.8 km/h @ 3 us
+Current speedometer angle = 246.738 degrees @ 3 us
+Current total distance displayed = 0.01 km @ 3050 ns
+Current partial distance displayed = 0.01 km @ 3050 ns
+Current speed displayed = 118.8 km/h @ 3100 ns
+Current speedometer angle = 246.738 degrees @ 3100 ns
+Current speed displayed = 118.8 km/h @ 3200 ns
+Current speedometer angle = 246.738 degrees @ 3200 ns
+Current speed displayed = 118.8 km/h @ 3300 ns
+Current speedometer angle = 246.738 degrees @ 3300 ns
+Current speed displayed = 118.8 km/h @ 3400 ns
+Current speedometer angle = 246.738 degrees @ 3400 ns
+Current speed displayed = 118.8 km/h @ 3500 ns
+Current speedometer angle = 246.738 degrees @ 3500 ns
+Current speed displayed = 118.8 km/h @ 3600 ns
+Current speedometer angle = 246.738 degrees @ 3600 ns
+Current speed displayed = 118.8 km/h @ 3700 ns
+Current speedometer angle = 246.738 degrees @ 3700 ns
+Current speed displayed = 118.8 km/h @ 3800 ns
+Current speedometer angle = 246.738 degrees @ 3800 ns
+Current speed displayed = 118.8 km/h @ 3900 ns
+Current speedometer angle = 246.738 degrees @ 3900 ns
+Current speed displayed = 118.8 km/h @ 4 us
+Current speedometer angle = 246.738 degrees @ 4 us
+Current speed displayed = 118.8 km/h @ 4100 ns
+Current speedometer angle = 246.738 degrees @ 4100 ns
+Current speed displayed = 118.8 km/h @ 4200 ns
+Current speedometer angle = 246.738 degrees @ 4200 ns
+Current speed displayed = 118.8 km/h @ 4300 ns
+Current speedometer angle = 246.738 degrees @ 4300 ns
+Current speed displayed = 118.8 km/h @ 4400 ns
+Current speedometer angle = 246.738 degrees @ 4400 ns
+Current speed displayed = 118.8 km/h @ 4500 ns
+Current speedometer angle = 246.738 degrees @ 4500 ns
+Current speed displayed = 118.8 km/h @ 4600 ns
+Current speedometer angle = 246.738 degrees @ 4600 ns
+Current speed displayed = 118.8 km/h @ 4700 ns
+Current speedometer angle = 246.738 degrees @ 4700 ns
+Current speed displayed = 118.8 km/h @ 4800 ns
+Current speedometer angle = 246.738 degrees @ 4800 ns
+Current speed displayed = 118.8 km/h @ 4900 ns
+Current speedometer angle = 246.738 degrees @ 4900 ns
+Current speed displayed = 118.8 km/h @ 5 us
+Current speedometer angle = 246.738 degrees @ 5 us
+Current speed displayed = 118.8 km/h @ 5100 ns
+Current speedometer angle = 246.738 degrees @ 5100 ns
+Current speed displayed = 118.8 km/h @ 5200 ns
+Current speedometer angle = 246.738 degrees @ 5200 ns
+Current speed displayed = 118.8 km/h @ 5300 ns
+Current speedometer angle = 246.738 degrees @ 5300 ns
+Current speed displayed = 118.8 km/h @ 5400 ns
+Current speedometer angle = 246.738 degrees @ 5400 ns
+Current speed displayed = 118.8 km/h @ 5500 ns
+Current speedometer angle = 246.738 degrees @ 5500 ns
+Current speed displayed = 118.8 km/h @ 5600 ns
+Current speedometer angle = 246.738 degrees @ 5600 ns
+Current speed displayed = 118.8 km/h @ 5700 ns
+Current speedometer angle = 246.738 degrees @ 5700 ns
+Current speed displayed = 118.8 km/h @ 5800 ns
+Current speedometer angle = 246.738 degrees @ 5800 ns
+Current speed displayed = 118.8 km/h @ 5900 ns
+Current speedometer angle = 246.738 degrees @ 5900 ns
+Current speed displayed = 118.8 km/h @ 6 us
+Current speedometer angle = 246.738 degrees @ 6 us
+Current speed displayed = 118.8 km/h @ 6100 ns
+Current speedometer angle = 246.738 degrees @ 6100 ns
+Current total distance displayed = 0.02 km @ 6100 ns
+Current partial distance displayed = 0.02 km @ 6100 ns
+Current speed displayed = 118.8 km/h @ 6200 ns
+Current speedometer angle = 246.738 degrees @ 6200 ns
+Current speed displayed = 118.8 km/h @ 6300 ns
+Current speedometer angle = 246.738 degrees @ 6300 ns
+Current speed displayed = 118.8 km/h @ 6400 ns
+Current speedometer angle = 246.738 degrees @ 6400 ns
+Current speed displayed = 118.8 km/h @ 6500 ns
+Current speedometer angle = 246.738 degrees @ 6500 ns
+Current speed displayed = 118.8 km/h @ 6600 ns
+Current speedometer angle = 246.738 degrees @ 6600 ns
+Current speed displayed = 118.8 km/h @ 6700 ns
+Current speedometer angle = 246.738 degrees @ 6700 ns
+Current speed displayed = 118.8 km/h @ 6800 ns
+Current speedometer angle = 246.738 degrees @ 6800 ns
+Current speed displayed = 118.8 km/h @ 6900 ns
+Current speedometer angle = 246.738 degrees @ 6900 ns
+Current speed displayed = 118.8 km/h @ 7 us
+Current speedometer angle = 246.738 degrees @ 7 us
+Current speed displayed = 118.8 km/h @ 7100 ns
+Current speedometer angle = 246.738 degrees @ 7100 ns
+Current speed displayed = 118.8 km/h @ 7200 ns
+Current speedometer angle = 246.738 degrees @ 7200 ns
+Current speed displayed = 118.8 km/h @ 7300 ns
+Current speedometer angle = 246.738 degrees @ 7300 ns
+Current speed displayed = 118.8 km/h @ 7400 ns
+Current speedometer angle = 246.738 degrees @ 7400 ns
+Current speed displayed = 118.8 km/h @ 7500 ns
+Current speedometer angle = 246.738 degrees @ 7500 ns
+Current speed displayed = 118.8 km/h @ 7600 ns
+Current speedometer angle = 246.738 degrees @ 7600 ns
+Current speed displayed = 118.8 km/h @ 7700 ns
+Current speedometer angle = 246.738 degrees @ 7700 ns
+Current speed displayed = 118.8 km/h @ 7800 ns
+Current speedometer angle = 246.738 degrees @ 7800 ns
+Current speed displayed = 118.8 km/h @ 7900 ns
+Current speedometer angle = 246.738 degrees @ 7900 ns
+Current speed displayed = 118.8 km/h @ 8 us
+Current speedometer angle = 246.738 degrees @ 8 us
+Current speed displayed = 118.8 km/h @ 8100 ns
+Current speedometer angle = 246.738 degrees @ 8100 ns
+Current speed displayed = 118.8 km/h @ 8200 ns
+Current speedometer angle = 246.738 degrees @ 8200 ns
+Current speed displayed = 118.8 km/h @ 8300 ns
+Current speedometer angle = 246.738 degrees @ 8300 ns
+Current speed displayed = 118.8 km/h @ 8400 ns
+Current speedometer angle = 246.738 degrees @ 8400 ns
+Current speed displayed = 118.8 km/h @ 8500 ns
+Current speedometer angle = 246.738 degrees @ 8500 ns
+Current speed displayed = 118.8 km/h @ 8600 ns
+Current speedometer angle = 246.738 degrees @ 8600 ns
+Current speed displayed = 118.8 km/h @ 8700 ns
+Current speedometer angle = 246.738 degrees @ 8700 ns
+Current speed displayed = 118.8 km/h @ 8800 ns
+Current speedometer angle = 246.738 degrees @ 8800 ns
+Current speed displayed = 118.8 km/h @ 8900 ns
+Current speedometer angle = 246.738 degrees @ 8900 ns
+Current speed displayed = 118.8 km/h @ 9 us
+Current speedometer angle = 246.738 degrees @ 9 us
+Current speed displayed = 118.8 km/h @ 9100 ns
+Current speedometer angle = 246.738 degrees @ 9100 ns
+Current total distance displayed = 0.03 km @ 9150 ns
+Current partial distance displayed = 0.03 km @ 9150 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash0/main.cpp
new file mode 100644
index 000000000..f31ae8c8a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/main.cpp
@@ -0,0 +1,112 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), a clock, and the pulse generator. The
+ pulses are generated by the sensors placed around one of the wheel
+ shafts. The rate of pulse generation is determined by the speed of
+ the car, which is constant at 120 km/h. The clock represents the
+ real time. The signals in this program are traced. The simulation
+ is stopped by the odometers module.
+
+ purpose -- no environment module; multiple modules at one level;
+ single processes within each module; input, output and clock
+ ports; internal and external signals; asynchronous function and
+ thread processes; one clock; tracing.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:19 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:51 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:10 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:44 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Clocks.
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, speed_pulses);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses);
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.cpp
new file mode 100644
index 000000000..db885b1e0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.cpp
@@ -0,0 +1,102 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:51 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:10 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:44 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+ int speed = 120;
+
+ while (true) {
+
+#ifdef DEBUG
+ cout << "Pulses were generated @ " << sc_time_stamp() << endl;
+#endif
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.h
new file mode 100644
index 000000000..d11f80185
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/pulse.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk;
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash0/speed.cpp
new file mode 100644
index 000000000..012a8428e
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/speed.cpp
@@ -0,0 +1,92 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:52 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:10 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:44 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ elapsed_time = elapsed_time + 1;
+}
+
+// Compute speed.
+void
+speed_mod::read_speed_proc()
+{
+ wait();
+
+ double speed = 0.0;
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+
+ // Reset timer.
+ elapsed_time = 0;
+
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ cout << "Current speedometer angle = "
+ << speed * MAX_ANGLE / MAX_SPEED
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash0/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash0/speed.h
new file mode 100644
index 000000000..821b36c25
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash0/speed.h
@@ -0,0 +1,71 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ // Compute speed.
+ void read_speed_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ // Initialize time.
+ elapsed_time = 0;
+
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/const.h b/src/systemc/tests/systemc/misc/v1.0/dash1/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/dash1.f b/src/systemc/tests/systemc/misc/v1.0/dash1/dash1.f
new file mode 100644
index 000000000..42e7f867e
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/dash1.f
@@ -0,0 +1,5 @@
+dash1/driver.cpp
+dash1/dist.cpp
+dash1/main.cpp
+dash1/pulse.cpp
+dash1/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash1/dist.cpp
new file mode 100644
index 000000000..3bd6062bd
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/dist.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:12 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_mod::prev_reset;
+
+// Compute the total and partial distances travelled.
+void
+dist_mod::get_dist_proc()
+{
+ wait();
+
+ double tmp_total = 0;
+ double tmp_partial = 0;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start) {
+
+ // Increment the distances:
+ tmp_total += DIST_INCR;
+
+ // This is to simulate reset.event():
+ if (prev_reset != (bool) reset)
+ tmp_partial = 0.0; // If reset.event(), reset the partial distance.
+ else
+ tmp_partial += DIST_INCR;
+
+ prev_reset = reset;
+
+ }
+ else {
+ prev_reset = false;
+ tmp_total = 0.0;
+ tmp_partial = 0.0;
+ }
+
+ total = tmp_total;
+ partial = tmp_partial;
+
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash1/dist.h
new file mode 100644
index 000000000..8ccdc790f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/dist.h
@@ -0,0 +1,68 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal variables:
+ static bool prev_reset;
+
+ // Compute the total and partial distances travelled.
+ void get_dist_proc();
+
+ SC_CTOR( dist_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+
+ prev_reset = false;
+ }
+
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash1/driver.cpp
new file mode 100644
index 000000000..b06573cce
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/driver.cpp
@@ -0,0 +1,122 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:52 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:12 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ wait();
+
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ reset = false;
+ start = false;
+ speed_set = 0;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ sc_stop();
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash1/driver.h
new file mode 100644
index 000000000..f12767fb4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/driver.h
@@ -0,0 +1,70 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_THREAD( driver_out_proc );
+ sensitive << clk.pos();
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/golden/dash1.log b/src/systemc/tests/systemc/misc/v1.0/dash1/golden/dash1.log
new file mode 100644
index 000000000..a84ae19b4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/golden/dash1.log
@@ -0,0 +1,37 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 39.6 km/h @ 10300 ns
+Current speedometer angle = 82.2462 degrees @ 10300 ns
+Current total distance displayed = 0.01 km @ 19150 ns
+Current partial distance displayed = 0.01 km @ 19150 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 59.4 km/h @ 20075 ns
+Current speedometer angle = 123.369 degrees @ 20075 ns
+Current speed displayed = 118.8 km/h @ 20175 ns
+Current speedometer angle = 246.738 degrees @ 20175 ns
+Current total distance displayed = 0.02 km @ 22775 ns
+Current partial distance displayed = 0.02 km @ 22775 ns
+Current total distance displayed = 0.03 km @ 25825 ns
+Current partial distance displayed = 0.03 km @ 25825 ns
+Current total distance displayed = 0.04 km @ 28875 ns
+Current partial distance displayed = 0.04 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 79.2 km/h @ 30150 ns
+Current speedometer angle = 164.492 degrees @ 30150 ns
+Current speed displayed = 59.4 km/h @ 30350 ns
+Current speedometer angle = 123.369 degrees @ 30350 ns
+Current total distance displayed = 0.05 km @ 33850 ns
+Current partial distance displayed = 0 km @ 33850 ns
+Current total distance displayed = 0.06 km @ 39950 ns
+Current partial distance displayed = 0.01 km @ 39950 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 39.6 km/h @ 40225 ns
+Current speedometer angle = 82.2462 degrees @ 40225 ns
+Current total distance displayed = 0.07 km @ 49075 ns
+Current partial distance displayed = 0.02 km @ 49075 ns
+Driver stopped the car @ 50 us
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash1/main.cpp
new file mode 100644
index 000000000..225ee80a7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/main.cpp
@@ -0,0 +1,141 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash0's purpose) -- environment
+ module (driver); multiple clocks.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:53 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:12 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.cpp
new file mode 100644
index 000000000..397abccc6
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:12 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+ do {
+ wait();
+ } while (start.read() == false);
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.h
new file mode 100644
index 000000000..1188e2bc3
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/pulse.h
@@ -0,0 +1,65 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk << start;
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash1/speed.cpp
new file mode 100644
index 000000000..44fdd64bc
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/speed.cpp
@@ -0,0 +1,93 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:12 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_mod::read_speed_proc()
+{
+ wait();
+
+ double tmp_speed;
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start) {
+ tmp_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ speed = tmp_speed;
+ angle = tmp_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash1/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash1/speed.h
new file mode 100644
index 000000000..47e3ced3c
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash1/speed.h
@@ -0,0 +1,75 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ // Compute speed.
+ void read_speed_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ elapsed_time = 0;
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/const.h b/src/systemc/tests/systemc/misc/v1.0/dash2/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/dash2.f b/src/systemc/tests/systemc/misc/v1.0/dash2/dash2.f
new file mode 100644
index 000000000..04f0b3607
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/dash2.f
@@ -0,0 +1,5 @@
+dash2/driver.cpp
+dash2/dist.cpp
+dash2/main.cpp
+dash2/pulse.cpp
+dash2/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash2/dist.cpp
new file mode 100644
index 000000000..ac090ed87
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/dist.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:14 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_mod::prev_reset;
+
+// Get the pulses for one distance increment.
+void
+dist_mod::get_dist_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok_for_incr = (ok_for_incr ? false : true);
+ else
+ ok_for_incr = false;
+ }
+}
+
+// Compute total distance.
+void
+dist_mod::compute_total_proc()
+{
+ if (start)
+ total_dist = total_dist + 1.0;
+ else
+ total_dist = 0.0;
+}
+
+// Compute partial distance.
+void
+dist_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_dist = 0.0;
+ else
+ partial_dist = partial_dist + 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_dist = 0.0;
+}
+
+// LCD display driver.
+void
+dist_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash2/dist.h
new file mode 100644
index 000000000..e34e9a923
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/dist.h
@@ -0,0 +1,91 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash2/driver.cpp
new file mode 100644
index 000000000..ed3ba8455
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/driver.cpp
@@ -0,0 +1,122 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:53 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:14 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ wait();
+
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ sc_stop();
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash2/driver.h
new file mode 100644
index 000000000..f12767fb4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/driver.h
@@ -0,0 +1,70 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_THREAD( driver_out_proc );
+ sensitive << clk.pos();
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/golden/dash2.log b/src/systemc/tests/systemc/misc/v1.0/dash2/golden/dash2.log
new file mode 100644
index 000000000..a84ae19b4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/golden/dash2.log
@@ -0,0 +1,37 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 39.6 km/h @ 10300 ns
+Current speedometer angle = 82.2462 degrees @ 10300 ns
+Current total distance displayed = 0.01 km @ 19150 ns
+Current partial distance displayed = 0.01 km @ 19150 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 59.4 km/h @ 20075 ns
+Current speedometer angle = 123.369 degrees @ 20075 ns
+Current speed displayed = 118.8 km/h @ 20175 ns
+Current speedometer angle = 246.738 degrees @ 20175 ns
+Current total distance displayed = 0.02 km @ 22775 ns
+Current partial distance displayed = 0.02 km @ 22775 ns
+Current total distance displayed = 0.03 km @ 25825 ns
+Current partial distance displayed = 0.03 km @ 25825 ns
+Current total distance displayed = 0.04 km @ 28875 ns
+Current partial distance displayed = 0.04 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 79.2 km/h @ 30150 ns
+Current speedometer angle = 164.492 degrees @ 30150 ns
+Current speed displayed = 59.4 km/h @ 30350 ns
+Current speedometer angle = 123.369 degrees @ 30350 ns
+Current total distance displayed = 0.05 km @ 33850 ns
+Current partial distance displayed = 0 km @ 33850 ns
+Current total distance displayed = 0.06 km @ 39950 ns
+Current partial distance displayed = 0.01 km @ 39950 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 39.6 km/h @ 40225 ns
+Current speedometer angle = 82.2462 degrees @ 40225 ns
+Current total distance displayed = 0.07 km @ 49075 ns
+Current partial distance displayed = 0.02 km @ 49075 ns
+Driver stopped the car @ 50 us
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash2/main.cpp
new file mode 100644
index 000000000..4c5e17742
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/main.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash1's purpose) -- multiple
+ processes inside single modules.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:54 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:14 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.cpp
new file mode 100644
index 000000000..4a2c87009
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:14 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+ do {
+ wait();
+ } while (start.read() == false);
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.h
new file mode 100644
index 000000000..1188e2bc3
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/pulse.h
@@ -0,0 +1,65 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk << start;
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash2/speed.cpp
new file mode 100644
index 000000000..1f592886f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:14 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed;
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed * 1.0;
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash2/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash2/speed.h
new file mode 100644
index 000000000..db9ac2262
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash2/speed.h
@@ -0,0 +1,91 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> raw_speed;
+ sc_signal<double> filtered_speed;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+
+ elapsed_time = 0;
+ raw_speed = 0.0;
+ filtered_speed = 0.0;
+ }
+
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/const.h b/src/systemc/tests/systemc/misc/v1.0/dash3/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/dash3.f b/src/systemc/tests/systemc/misc/v1.0/dash3/dash3.f
new file mode 100644
index 000000000..103c584fa
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/dash3.f
@@ -0,0 +1,5 @@
+dash3/driver.cpp
+dash3/dist.cpp
+dash3/main.cpp
+dash3/pulse.cpp
+dash3/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash3/dist.cpp
new file mode 100644
index 000000000..2734277f4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash3/dist.h
new file mode 100644
index 000000000..9c7cb5761
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/dist.h
@@ -0,0 +1,164 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ read_mod->pulse.bind(pulse);
+ read_mod->start.bind(start);
+ read_mod->ok_for_incr.bind(ok_for_incr);
+
+ compute_mod->reset.bind(reset);
+ compute_mod->start.bind(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist.bind(partial_dist);
+
+ lcd_mod->start.bind(start);
+ lcd_mod->total_dist.bind(total_dist);
+ lcd_mod->partial_dist.bind(partial_dist);
+ lcd_mod->total.bind(total);
+ lcd_mod->partial.bind(partial);
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash3/driver.cpp
new file mode 100644
index 000000000..305b32a58
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:54 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ wait();
+
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash3/driver.h
new file mode 100644
index 000000000..f12767fb4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/driver.h
@@ -0,0 +1,70 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_THREAD( driver_out_proc );
+ sensitive << clk.pos();
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/golden/dash3.log b/src/systemc/tests/systemc/misc/v1.0/dash3/golden/dash3.log
new file mode 100644
index 000000000..a84ae19b4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/golden/dash3.log
@@ -0,0 +1,37 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 39.6 km/h @ 10300 ns
+Current speedometer angle = 82.2462 degrees @ 10300 ns
+Current total distance displayed = 0.01 km @ 19150 ns
+Current partial distance displayed = 0.01 km @ 19150 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 59.4 km/h @ 20075 ns
+Current speedometer angle = 123.369 degrees @ 20075 ns
+Current speed displayed = 118.8 km/h @ 20175 ns
+Current speedometer angle = 246.738 degrees @ 20175 ns
+Current total distance displayed = 0.02 km @ 22775 ns
+Current partial distance displayed = 0.02 km @ 22775 ns
+Current total distance displayed = 0.03 km @ 25825 ns
+Current partial distance displayed = 0.03 km @ 25825 ns
+Current total distance displayed = 0.04 km @ 28875 ns
+Current partial distance displayed = 0.04 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 79.2 km/h @ 30150 ns
+Current speedometer angle = 164.492 degrees @ 30150 ns
+Current speed displayed = 59.4 km/h @ 30350 ns
+Current speedometer angle = 123.369 degrees @ 30350 ns
+Current total distance displayed = 0.05 km @ 33850 ns
+Current partial distance displayed = 0 km @ 33850 ns
+Current total distance displayed = 0.06 km @ 39950 ns
+Current partial distance displayed = 0.01 km @ 39950 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 39.6 km/h @ 40225 ns
+Current speedometer angle = 82.2462 degrees @ 40225 ns
+Current total distance displayed = 0.07 km @ 49075 ns
+Current partial distance displayed = 0.02 km @ 49075 ns
+Driver stopped the car @ 50 us
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash3/main.cpp
new file mode 100644
index 000000000..fba72223d
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/main.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash2's purpose) -- multiple
+ modules inside single modules.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:54 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.cpp
new file mode 100644
index 000000000..d9f83ce87
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+ do {
+ wait();
+ } while (start.read() == false);
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.h
new file mode 100644
index 000000000..17d301bb7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/pulse.h
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk << start;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash3/speed.cpp
new file mode 100644
index 000000000..33445c1d0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed * 1.0; // Ambiguous overload w/o 1.0.
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed * 1.0; // Ambiguous overload w/o 1.0.
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash3/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash3/speed.h
new file mode 100644
index 000000000..7e63cda24
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash3/speed.h
@@ -0,0 +1,140 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ read_mod->start.bind(start);
+ read_mod->pulse.bind(pulse);
+ read_mod->elapsed_time.bind(elapsed_time);
+ read_mod->filtered_speed.bind(filtered_speed);
+
+ pwm_mod->start.bind(start);
+ pwm_mod->filtered_speed.bind(filtered_speed);
+ pwm_mod->speed.bind(speed);
+ pwm_mod->angle.bind(angle);
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/const.h b/src/systemc/tests/systemc/misc/v1.0/dash4/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/dash4.f b/src/systemc/tests/systemc/misc/v1.0/dash4/dash4.f
new file mode 100644
index 000000000..f5f312dc5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/dash4.f
@@ -0,0 +1,5 @@
+dash4/driver.cpp
+dash4/dist.cpp
+dash4/main.cpp
+dash4/pulse.cpp
+dash4/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash4/dist.cpp
new file mode 100644
index 000000000..2734277f4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash4/dist.h
new file mode 100644
index 000000000..9c7cb5761
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/dist.h
@@ -0,0 +1,164 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ read_mod->pulse.bind(pulse);
+ read_mod->start.bind(start);
+ read_mod->ok_for_incr.bind(ok_for_incr);
+
+ compute_mod->reset.bind(reset);
+ compute_mod->start.bind(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist.bind(partial_dist);
+
+ lcd_mod->start.bind(start);
+ lcd_mod->total_dist.bind(total_dist);
+ lcd_mod->partial_dist.bind(partial_dist);
+ lcd_mod->total.bind(total);
+ lcd_mod->partial.bind(partial);
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash4/driver.cpp
new file mode 100644
index 000000000..9e601c155
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:55 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ wait();
+
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash4/driver.h
new file mode 100644
index 000000000..f12767fb4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/driver.h
@@ -0,0 +1,70 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_THREAD( driver_out_proc );
+ sensitive << clk.pos();
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/golden/dash4.log b/src/systemc/tests/systemc/misc/v1.0/dash4/golden/dash4.log
new file mode 100644
index 000000000..a84ae19b4
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/golden/dash4.log
@@ -0,0 +1,37 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 39.6 km/h @ 10300 ns
+Current speedometer angle = 82.2462 degrees @ 10300 ns
+Current total distance displayed = 0.01 km @ 19150 ns
+Current partial distance displayed = 0.01 km @ 19150 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 59.4 km/h @ 20075 ns
+Current speedometer angle = 123.369 degrees @ 20075 ns
+Current speed displayed = 118.8 km/h @ 20175 ns
+Current speedometer angle = 246.738 degrees @ 20175 ns
+Current total distance displayed = 0.02 km @ 22775 ns
+Current partial distance displayed = 0.02 km @ 22775 ns
+Current total distance displayed = 0.03 km @ 25825 ns
+Current partial distance displayed = 0.03 km @ 25825 ns
+Current total distance displayed = 0.04 km @ 28875 ns
+Current partial distance displayed = 0.04 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 79.2 km/h @ 30150 ns
+Current speedometer angle = 164.492 degrees @ 30150 ns
+Current speed displayed = 59.4 km/h @ 30350 ns
+Current speedometer angle = 123.369 degrees @ 30350 ns
+Current total distance displayed = 0.05 km @ 33850 ns
+Current partial distance displayed = 0 km @ 33850 ns
+Current total distance displayed = 0.06 km @ 39950 ns
+Current partial distance displayed = 0.01 km @ 39950 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 39.6 km/h @ 40225 ns
+Current speedometer angle = 82.2462 degrees @ 40225 ns
+Current total distance displayed = 0.07 km @ 49075 ns
+Current partial distance displayed = 0.02 km @ 49075 ns
+Driver stopped the car @ 50 us
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash4/main.cpp
new file mode 100644
index 000000000..537dd6ede
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/main.cpp
@@ -0,0 +1,152 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash3's purpose) -- new style of
+ declaring modules and processes (i.e., via the use of
+ module_name).
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:55 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.cpp
new file mode 100644
index 000000000..d9f83ce87
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.cpp
@@ -0,0 +1,98 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:19 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+ do {
+ wait();
+ } while (start.read() == false);
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.h
new file mode 100644
index 000000000..17d301bb7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/pulse.h
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk << start;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash4/speed.cpp
new file mode 100644
index 000000000..ed4c5a8b6
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed * 1.0; // Ambiguous overload w/o 1.0.
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed * 1.0; // Ambiguous overload w/o 1.0.
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash4/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash4/speed.h
new file mode 100644
index 000000000..7e63cda24
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash4/speed.h
@@ -0,0 +1,140 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ read_mod->start.bind(start);
+ read_mod->pulse.bind(pulse);
+ read_mod->elapsed_time.bind(elapsed_time);
+ read_mod->filtered_speed.bind(filtered_speed);
+
+ pwm_mod->start.bind(start);
+ pwm_mod->filtered_speed.bind(filtered_speed);
+ pwm_mod->speed.bind(speed);
+ pwm_mod->angle.bind(angle);
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/const.h b/src/systemc/tests/systemc/misc/v1.0/dash5/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/dash5.f b/src/systemc/tests/systemc/misc/v1.0/dash5/dash5.f
new file mode 100644
index 000000000..078a71be9
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/dash5.f
@@ -0,0 +1,5 @@
+dash5/driver.cpp
+dash5/dist.cpp
+dash5/main.cpp
+dash5/pulse.cpp
+dash5/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash5/dist.cpp
new file mode 100644
index 000000000..e2759fdf9
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:50 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash5/dist.h
new file mode 100644
index 000000000..9c7cb5761
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/dist.h
@@ -0,0 +1,164 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ read_mod->pulse.bind(pulse);
+ read_mod->start.bind(start);
+ read_mod->ok_for_incr.bind(ok_for_incr);
+
+ compute_mod->reset.bind(reset);
+ compute_mod->start.bind(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist.bind(partial_dist);
+
+ lcd_mod->start.bind(start);
+ lcd_mod->total_dist.bind(total_dist);
+ lcd_mod->partial_dist.bind(partial_dist);
+ lcd_mod->total.bind(total);
+ lcd_mod->partial.bind(partial);
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash5/driver.cpp
new file mode 100644
index 000000000..404770b0c
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:56 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ wait();
+
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash5/driver.h
new file mode 100644
index 000000000..795fa63b5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/driver.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_CTHREAD( driver_out_proc, clk.pos() );
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/golden/dash5.log b/src/systemc/tests/systemc/misc/v1.0/dash5/golden/dash5.log
new file mode 100644
index 000000000..bc7566ef8
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/golden/dash5.log
@@ -0,0 +1,39 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 39.6 km/h @ 10300 ns
+Current speedometer angle = 82.2462 degrees @ 10300 ns
+Current total distance displayed = 0.01 km @ 19150 ns
+Current partial distance displayed = 0.01 km @ 19150 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 59.4 km/h @ 20075 ns
+Current speedometer angle = 123.369 degrees @ 20075 ns
+Current speed displayed = 118.8 km/h @ 20175 ns
+Current speedometer angle = 246.738 degrees @ 20175 ns
+Current total distance displayed = 0.02 km @ 22775 ns
+Current partial distance displayed = 0.02 km @ 22775 ns
+Current total distance displayed = 0.03 km @ 25825 ns
+Current partial distance displayed = 0.03 km @ 25825 ns
+Current total distance displayed = 0.04 km @ 28875 ns
+Current partial distance displayed = 0.04 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 79.2 km/h @ 30150 ns
+Current speedometer angle = 164.492 degrees @ 30150 ns
+Current speed displayed = 59.4 km/h @ 30350 ns
+Current speedometer angle = 123.369 degrees @ 30350 ns
+Current total distance displayed = 0.05 km @ 33850 ns
+Current partial distance displayed = 0 km @ 33850 ns
+Current total distance displayed = 0.06 km @ 39950 ns
+Current partial distance displayed = 0.01 km @ 39950 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 39.6 km/h @ 40225 ns
+Current speedometer angle = 82.2462 degrees @ 40225 ns
+Current total distance displayed = 0.07 km @ 49075 ns
+Current partial distance displayed = 0.02 km @ 49075 ns
+Driver stopped the car @ 50 us
+Current total distance displayed = 0.08 km @ 58225 ns
+Current partial distance displayed = 0.03 km @ 58225 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash5/main.cpp
new file mode 100644
index 000000000..af9623388
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/main.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash4's purpose) -- synchronous
+ processes.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:56 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.cpp
new file mode 100644
index 000000000..eb6d70d23
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.cpp
@@ -0,0 +1,99 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ wait();
+
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+ // do { wait(); } while (start == true);
+ do {
+ wait();
+ } while (start == false);
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.h
new file mode 100644
index 000000000..17d301bb7
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/pulse.h
@@ -0,0 +1,64 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_THREAD( gen_pulse_proc );
+ sensitive << clk << start;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash5/speed.cpp
new file mode 100644
index 000000000..913d0aa6a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed * 1.0; // Ambiguous overload w/o 1.0.
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed * 1.0; // Ambiguous overload w/o 1.0.
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash5/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash5/speed.h
new file mode 100644
index 000000000..7e63cda24
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash5/speed.h
@@ -0,0 +1,140 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ read_mod->start.bind(start);
+ read_mod->pulse.bind(pulse);
+ read_mod->elapsed_time.bind(elapsed_time);
+ read_mod->filtered_speed.bind(filtered_speed);
+
+ pwm_mod->start.bind(start);
+ pwm_mod->filtered_speed.bind(filtered_speed);
+ pwm_mod->speed.bind(speed);
+ pwm_mod->angle.bind(angle);
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/const.h b/src/systemc/tests/systemc/misc/v1.0/dash6/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/dash6.f b/src/systemc/tests/systemc/misc/v1.0/dash6/dash6.f
new file mode 100644
index 000000000..4479b4c89
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/dash6.f
@@ -0,0 +1,5 @@
+dash6/driver.cpp
+dash6/dist.cpp
+dash6/main.cpp
+dash6/pulse.cpp
+dash6/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp
new file mode 100644
index 000000000..7080a461f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash6/dist.h
new file mode 100644
index 000000000..9c7cb5761
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/dist.h
@@ -0,0 +1,164 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ read_mod->pulse.bind(pulse);
+ read_mod->start.bind(start);
+ read_mod->ok_for_incr.bind(ok_for_incr);
+
+ compute_mod->reset.bind(reset);
+ compute_mod->start.bind(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist.bind(partial_dist);
+
+ lcd_mod->start.bind(start);
+ lcd_mod->total_dist.bind(total_dist);
+ lcd_mod->partial_dist.bind(partial_dist);
+ lcd_mod->total.bind(total);
+ lcd_mod->partial.bind(partial);
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash6/driver.cpp
new file mode 100644
index 000000000..6c085b77d
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:57 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ wait();
+
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash6/driver.h
new file mode 100644
index 000000000..795fa63b5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/driver.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_CTHREAD( driver_out_proc, clk.pos() );
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/golden/dash6.log b/src/systemc/tests/systemc/misc/v1.0/dash6/golden/dash6.log
new file mode 100644
index 000000000..8668a2d8a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/golden/dash6.log
@@ -0,0 +1,35 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 18.2769 km/h @ 10625 ns
+Current speedometer angle = 37.9598 degrees @ 10625 ns
+Current speed displayed = 19.8 km/h @ 11225 ns
+Current speedometer angle = 41.1231 degrees @ 11225 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 26.4 km/h @ 20075 ns
+Current speedometer angle = 54.8308 degrees @ 20075 ns
+Current speed displayed = 59.4 km/h @ 20275 ns
+Current speedometer angle = 123.369 degrees @ 20275 ns
+Current total distance displayed = 0.01 km @ 22775 ns
+Current partial distance displayed = 0.01 km @ 22775 ns
+Current total distance displayed = 0.02 km @ 28875 ns
+Current partial distance displayed = 0.02 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 39.6 km/h @ 30175 ns
+Current speedometer angle = 82.2462 degrees @ 30175 ns
+Current speed displayed = 29.7 km/h @ 30575 ns
+Current speedometer angle = 61.6846 degrees @ 30575 ns
+Current total distance displayed = 0.03 km @ 39975 ns
+Current partial distance displayed = 0 km @ 39975 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 23.76 km/h @ 40275 ns
+Current speedometer angle = 49.3477 degrees @ 40275 ns
+Current speed displayed = 19.8 km/h @ 40875 ns
+Current speedometer angle = 41.1231 degrees @ 40875 ns
+Driver stopped the car @ 50 us
+Current total distance displayed = 0.04 km @ 58275 ns
+Current partial distance displayed = 0.01 km @ 58275 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash6/main.cpp
new file mode 100644
index 000000000..a84f33217
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/main.cpp
@@ -0,0 +1,151 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash5's purpose) -- more
+ synchronous processes.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:57 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.cpp
new file mode 100644
index 000000000..c2b5031f2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.cpp
@@ -0,0 +1,101 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+
+ do { wait(); } while (start != true);
+
+ /*
+ do {
+ wait();
+ } while (start == false);
+ */
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.h
new file mode 100644
index 000000000..b1206d185
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/pulse.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_CTHREAD( gen_pulse_proc, clk.pos() );
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash6/speed.cpp
new file mode 100644
index 000000000..913d0aa6a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed * 1.0; // Ambiguous overload w/o 1.0.
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed * 1.0; // Ambiguous overload w/o 1.0.
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash6/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash6/speed.h
new file mode 100644
index 000000000..7e63cda24
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash6/speed.h
@@ -0,0 +1,140 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ read_mod->start.bind(start);
+ read_mod->pulse.bind(pulse);
+ read_mod->elapsed_time.bind(elapsed_time);
+ read_mod->filtered_speed.bind(filtered_speed);
+
+ pwm_mod->start.bind(start);
+ pwm_mod->filtered_speed.bind(filtered_speed);
+ pwm_mod->speed.bind(speed);
+ pwm_mod->angle.bind(angle);
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/const.h b/src/systemc/tests/systemc/misc/v1.0/dash7/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/dash7.f b/src/systemc/tests/systemc/misc/v1.0/dash7/dash7.f
new file mode 100644
index 000000000..319d6fb4f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/dash7.f
@@ -0,0 +1,5 @@
+dash7/driver.cpp
+dash7/dist.cpp
+dash7/main.cpp
+dash7/pulse.cpp
+dash7/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash7/dist.cpp
new file mode 100644
index 000000000..7080a461f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash7/dist.h
new file mode 100644
index 000000000..0285b557e
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/dist.h
@@ -0,0 +1,177 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ // read_mod->pulse.bind(pulse);
+ // read_mod->start.bind(start);
+ // read_mod->ok_for_incr.bind(ok_for_incr);
+ read_mod->pulse(pulse);
+ read_mod->start(start);
+ read_mod->ok_for_incr(ok_for_incr);
+
+ // compute_mod->reset.bind(reset);
+ // compute_mod->start.bind(start);
+ // compute_mod->ok_for_incr.bind(ok_for_incr);
+ // compute_mod->total_dist.bind(total_dist);
+ // compute_mod->partial_dist.bind(partial_dist);
+ compute_mod->reset(reset);
+ compute_mod->start(start);
+ compute_mod->ok_for_incr(ok_for_incr);
+ compute_mod->total_dist(total_dist);
+ compute_mod->partial_dist(partial_dist);
+
+ // lcd_mod->start.bind(start);
+ // lcd_mod->total_dist.bind(total_dist);
+ // lcd_mod->partial_dist.bind(partial_dist);
+ // lcd_mod->total.bind(total);
+ // lcd_mod->partial.bind(partial);
+ lcd_mod->start.bind(start);
+ lcd_mod->total_dist.bind(total_dist);
+ lcd_mod->partial_dist(partial_dist);
+ lcd_mod->total(total);
+ lcd_mod->partial.bind(partial);
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash7/driver.cpp
new file mode 100644
index 000000000..6c085b77d
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:57 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ wait();
+
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash7/driver.h
new file mode 100644
index 000000000..795fa63b5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/driver.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_CTHREAD( driver_out_proc, clk.pos() );
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/golden/dash7.log b/src/systemc/tests/systemc/misc/v1.0/dash7/golden/dash7.log
new file mode 100644
index 000000000..8668a2d8a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/golden/dash7.log
@@ -0,0 +1,35 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 18.2769 km/h @ 10625 ns
+Current speedometer angle = 37.9598 degrees @ 10625 ns
+Current speed displayed = 19.8 km/h @ 11225 ns
+Current speedometer angle = 41.1231 degrees @ 11225 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 26.4 km/h @ 20075 ns
+Current speedometer angle = 54.8308 degrees @ 20075 ns
+Current speed displayed = 59.4 km/h @ 20275 ns
+Current speedometer angle = 123.369 degrees @ 20275 ns
+Current total distance displayed = 0.01 km @ 22775 ns
+Current partial distance displayed = 0.01 km @ 22775 ns
+Current total distance displayed = 0.02 km @ 28875 ns
+Current partial distance displayed = 0.02 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 39.6 km/h @ 30175 ns
+Current speedometer angle = 82.2462 degrees @ 30175 ns
+Current speed displayed = 29.7 km/h @ 30575 ns
+Current speedometer angle = 61.6846 degrees @ 30575 ns
+Current total distance displayed = 0.03 km @ 39975 ns
+Current partial distance displayed = 0 km @ 39975 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 23.76 km/h @ 40275 ns
+Current speedometer angle = 49.3477 degrees @ 40275 ns
+Current speed displayed = 19.8 km/h @ 40875 ns
+Current speedometer angle = 41.1231 degrees @ 40875 ns
+Driver stopped the car @ 50 us
+Current total distance displayed = 0.04 km @ 58275 ns
+Current partial distance displayed = 0.01 km @ 58275 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash7/main.cpp
new file mode 100644
index 000000000..fd1b45ba0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/main.cpp
@@ -0,0 +1,157 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash6's purpose) -- named port
+ binding mixed with bind(). Example: let m1 and m2 be two modules,
+ and p1 and p2 be their ports. Let m2 contain m1. Let's bind these
+ ports. In dashX with X <= 6, the binding is done in m2's
+ constructor as m1->p1.bind(p2). In this test, the binding is named
+ in that the binding is done in m2's constructor as m1->p1(p2).
+
+ The output of this program is identical to that of dash6.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:58 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist, disp_partial_dist,
+ reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers(dist_pulses, reset, start, disp_total_dist, disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.cpp
new file mode 100644
index 000000000..c2b5031f2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.cpp
@@ -0,0 +1,101 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+
+ do { wait(); } while (start != true);
+
+ /*
+ do {
+ wait();
+ } while (start == false);
+ */
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.h
new file mode 100644
index 000000000..b1206d185
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/pulse.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_CTHREAD( gen_pulse_proc, clk.pos() );
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash7/speed.cpp
new file mode 100644
index 000000000..10e29ce12
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed;
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed;
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash7/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash7/speed.h
new file mode 100644
index 000000000..b56b3a17e
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash7/speed.h
@@ -0,0 +1,148 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ // read_mod->start.bind(start);
+ // read_mod->pulse.bind(pulse);
+ // read_mod->elapsed_time.bind(elapsed_time);
+ // read_mod->filtered_speed.bind(filtered_speed);
+ read_mod->start(start);
+ read_mod->pulse(pulse);
+ read_mod->elapsed_time(elapsed_time);
+ read_mod->filtered_speed(filtered_speed);
+
+ // pwm_mod->start.bind(start);
+ // pwm_mod->filtered_speed.bind(filtered_speed);
+ // pwm_mod->speed.bind(speed);
+ // pwm_mod->angle.bind(angle);
+ pwm_mod->start(start);
+ pwm_mod->filtered_speed.bind(filtered_speed);
+ pwm_mod->speed.bind(speed);
+ pwm_mod->angle(angle);
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/const.h b/src/systemc/tests/systemc/misc/v1.0/dash8/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/dash8.f b/src/systemc/tests/systemc/misc/v1.0/dash8/dash8.f
new file mode 100644
index 000000000..356623a35
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/dash8.f
@@ -0,0 +1,5 @@
+dash8/driver.cpp
+dash8/dist.cpp
+dash8/main.cpp
+dash8/pulse.cpp
+dash8/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash8/dist.cpp
new file mode 100644
index 000000000..7080a461f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash8/dist.h
new file mode 100644
index 000000000..6cf8446f0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/dist.h
@@ -0,0 +1,183 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ // read_mod->pulse.bind(pulse);
+ // read_mod->start.bind(start);
+ // read_mod->ok_for_incr.bind(ok_for_incr);
+
+ read_mod->pulse(pulse);
+ read_mod->start(start);
+ read_mod->ok_for_incr(ok_for_incr);
+
+ // (*read_mod)(pulse, start, ok_for_incr);
+
+ // compute_mod->reset.bind(reset);
+ // compute_mod->start.bind(start);
+ // compute_mod->ok_for_incr.bind(ok_for_incr);
+ // compute_mod->total_dist.bind(total_dist);
+ // compute_mod->partial_dist.bind(partial_dist);
+ compute_mod->reset(reset);
+ compute_mod->start(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist(partial_dist);
+
+ // lcd_mod->start.bind(start);
+ // lcd_mod->total_dist.bind(total_dist);
+ // lcd_mod->partial_dist.bind(partial_dist);
+ // lcd_mod->total.bind(total);
+ // lcd_mod->partial.bind(partial);
+
+ lcd_mod->start(start);
+ lcd_mod->total_dist(total_dist);
+ lcd_mod->partial_dist(partial_dist);
+ lcd_mod->total(total);
+ lcd_mod->partial(partial);
+
+ // *lcd_mod << start, total_dist, partial_dist, total, partial;
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash8/driver.cpp
new file mode 100644
index 000000000..a16743f2f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:58 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ wait();
+
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash8/driver.h
new file mode 100644
index 000000000..795fa63b5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/driver.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_CTHREAD( driver_out_proc, clk.pos() );
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/golden/dash8.log b/src/systemc/tests/systemc/misc/v1.0/dash8/golden/dash8.log
new file mode 100644
index 000000000..8668a2d8a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/golden/dash8.log
@@ -0,0 +1,35 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 18.2769 km/h @ 10625 ns
+Current speedometer angle = 37.9598 degrees @ 10625 ns
+Current speed displayed = 19.8 km/h @ 11225 ns
+Current speedometer angle = 41.1231 degrees @ 11225 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 26.4 km/h @ 20075 ns
+Current speedometer angle = 54.8308 degrees @ 20075 ns
+Current speed displayed = 59.4 km/h @ 20275 ns
+Current speedometer angle = 123.369 degrees @ 20275 ns
+Current total distance displayed = 0.01 km @ 22775 ns
+Current partial distance displayed = 0.01 km @ 22775 ns
+Current total distance displayed = 0.02 km @ 28875 ns
+Current partial distance displayed = 0.02 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 39.6 km/h @ 30175 ns
+Current speedometer angle = 82.2462 degrees @ 30175 ns
+Current speed displayed = 29.7 km/h @ 30575 ns
+Current speedometer angle = 61.6846 degrees @ 30575 ns
+Current total distance displayed = 0.03 km @ 39975 ns
+Current partial distance displayed = 0 km @ 39975 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 23.76 km/h @ 40275 ns
+Current speedometer angle = 49.3477 degrees @ 40275 ns
+Current speed displayed = 19.8 km/h @ 40875 ns
+Current speedometer angle = 41.1231 degrees @ 40875 ns
+Driver stopped the car @ 50 us
+Current total distance displayed = 0.04 km @ 58275 ns
+Current partial distance displayed = 0.01 km @ 58275 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash8/main.cpp
new file mode 100644
index 000000000..f00f7f46a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/main.cpp
@@ -0,0 +1,164 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ purpose (in terms of changes to dash7's purpose) -- Positional
+ connection method for binding the ports of modules. Example: Let m
+ be a module with ports p1 and p2. Let m_ptr be a pointer to m, and
+ let p1_arg and p2_arg be the ports that we want to bind to p1 and
+ p2 of m. Then, we can do the binding in one of the following:
+
+ m(p1_arg, p2_arg); or (*m_ptr)(p1_arg, p2_arg);
+ m.p1(p1_arg); m.p2.bind(p2_arg); or
+ m_ptr->p1(p1_arg); m->p2.bind(p2_arg);
+
+ The output of this program is identical to that of dash6 and dash7.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:58 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist,
+ disp_partial_dist, reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers.pulse(dist_pulses);
+ odometers.reset(reset);
+ odometers.start.bind(start);
+ odometers.total(disp_total_dist);
+ odometers.partial.bind(disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.cpp
new file mode 100644
index 000000000..c2b5031f2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.cpp
@@ -0,0 +1,101 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+
+ do { wait(); } while (start != true);
+
+ /*
+ do {
+ wait();
+ } while (start == false);
+ */
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.h
new file mode 100644
index 000000000..b1206d185
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/pulse.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_CTHREAD( gen_pulse_proc, clk.pos() );
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash8/speed.cpp
new file mode 100644
index 000000000..10e29ce12
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed;
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed;
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash8/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash8/speed.h
new file mode 100644
index 000000000..181cac253
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash8/speed.h
@@ -0,0 +1,154 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ // read_mod->start.bind(start);
+ // read_mod->pulse.bind(pulse);
+ // read_mod->filtered_speed.bind(filtered_speed);
+ // read_mod->elapsed_time.bind(elapsed_time);
+
+ read_mod->start(start);
+ read_mod->pulse(pulse);
+ read_mod->filtered_speed(filtered_speed);
+ read_mod->elapsed_time(elapsed_time);
+
+ // (*read_mod)(start, pulse, filtered_speed, elapsed_time);
+
+ // pwm_mod->start.bind(start);
+ // pwm_mod->filtered_speed.bind(filtered_speed);
+ // pwm_mod->speed.bind(speed);
+ // pwm_mod->angle.bind(angle);
+
+ pwm_mod->start(start);
+ pwm_mod->filtered_speed(filtered_speed);
+ pwm_mod->speed(speed);
+ pwm_mod->angle(angle);
+
+ // *pwm_mod << start << filtered_speed << speed << angle;
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/const.h b/src/systemc/tests/systemc/misc/v1.0/dash9/const.h
new file mode 100644
index 000000000..9bc1ed3bf
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/const.h
@@ -0,0 +1,62 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ const.h -- Constants for the dashboard controller.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef CONST_H
+#define CONST_H
+
+const int MAX_SPEED = 130; // Car speed in km/h.
+const int MAX_ANGLE = 270; // Needle angle in the speedometer in degrees.
+
+const double DIST_BETWEEN_TWO_PULSES = 0.00066 / 2; // 1/2 of a tire in km.
+const double DIST_INCR = 0.01; // One distance increment in km.
+
+// Two pulses are needed to compute speed.
+const int NUM_PULSES_FOR_SPEED = 2;
+
+// DIST_INCR / DIST_BETWEEN_TWO_PULSES
+const int NUM_PULSES_FOR_DIST_INCR = 61;
+
+const int SLOW_CLOCK_PERIOD0 = 10000; // in 10 x milliseconds.
+const int FAST_CLOCK_PERIOD1 = 50; // in 10 x milliseconds.
+const int ONE_HOUR = 36000000; // in 10 x milliseconds.
+const int PERIODS_PER_HOUR = ONE_HOUR / FAST_CLOCK_PERIOD1;
+
+#define AWAIT(N) \
+ for (register int i = 0; i < N; ++i) \
+ wait();
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/dash9.f b/src/systemc/tests/systemc/misc/v1.0/dash9/dash9.f
new file mode 100644
index 000000000..bfe0d5fe0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/dash9.f
@@ -0,0 +1,5 @@
+dash9/driver.cpp
+dash9/dist.cpp
+dash9/main.cpp
+dash9/pulse.cpp
+dash9/speed.cpp
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/dist.cpp b/src/systemc/tests/systemc/misc/v1.0/dash9/dist.cpp
new file mode 100644
index 000000000..7080a461f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/dist.cpp
@@ -0,0 +1,134 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.cpp -- Implementation of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: dist.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "dist.h"
+
+bool dist_compute_mod::prev_reset;
+double dist_compute_mod::total_compute_dist;
+double dist_compute_mod::partial_compute_dist;
+
+// Get the pulses for one distance increment.
+void
+dist_read_mod::get_dist_proc()
+{
+ wait();
+
+ bool ok = false;
+
+ while (true) {
+
+ // More than one pulse is needed for a distance increment. This
+ // function collects NUM_PULSES_FOR_DIST_INCR pulses for that
+ // purpose.
+ AWAIT(NUM_PULSES_FOR_DIST_INCR);
+
+ if (start)
+ ok = !ok;
+ else
+ ok = false;
+
+ ok_for_incr = ok;
+ }
+}
+
+// Compute total distance.
+void
+dist_compute_mod::compute_total_proc()
+{
+ if (start)
+ total_compute_dist += 1.0;
+ else
+ total_compute_dist = 0.0;
+
+ total_dist = total_compute_dist;
+}
+
+// Compute partial distance.
+void
+dist_compute_mod::compute_partial_proc()
+{
+ if (start) {
+
+ // Implement reset.event():
+ if (prev_reset != (bool) reset)
+ partial_compute_dist = 0.0;
+ else
+ partial_compute_dist += 1.0;
+
+ prev_reset = reset;
+
+ }
+ else
+ partial_compute_dist = 0.0;
+
+ partial_dist = partial_compute_dist;
+}
+
+// LCD display driver.
+void
+dist_lcd_mod::lcd_driver_proc()
+{
+ if (start) {
+
+ if (total_dist.event())
+ total = total_dist * DIST_INCR;
+
+ if (partial_dist.event())
+ partial = partial_dist * DIST_INCR;
+
+ }
+ else {
+ total = 0.0;
+ partial = 0.0;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/dist.h b/src/systemc/tests/systemc/misc/v1.0/dash9/dist.h
new file mode 100644
index 000000000..6cf8446f0
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/dist.h
@@ -0,0 +1,183 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ dist.h -- Definition of the odometers.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DIST_H
+#define DIST_H
+
+SC_MODULE( dist_read_mod )
+{
+ // Input ports:
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<bool> ok_for_incr;
+
+ // Get the pulses for one distance increment.
+ void get_dist_proc();
+
+ SC_CTOR( dist_read_mod )
+ {
+ SC_THREAD( get_dist_proc );
+ sensitive << pulse.pos();
+ }
+};
+
+SC_MODULE( dist_compute_mod )
+{
+ // Input ports:
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> ok_for_incr;
+
+ // Output ports:
+ sc_out<double> total_dist;
+ sc_out<double> partial_dist;
+
+ // Internal variables:
+ static bool prev_reset;
+ static double total_compute_dist;
+ static double partial_compute_dist;
+
+ // Compute total and partial distances.
+ void compute_total_proc();
+ void compute_partial_proc();
+
+ SC_CTOR( dist_compute_mod )
+ {
+ SC_METHOD( compute_total_proc );
+ sensitive << ok_for_incr;
+
+ SC_METHOD( compute_partial_proc );
+ sensitive << ok_for_incr;
+
+ prev_reset = false;
+ total_compute_dist = 0.0;
+ partial_compute_dist = 0.0;
+ }
+};
+
+SC_MODULE( dist_lcd_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> total_dist;
+ sc_in<double> partial_dist;
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // LCD display driver.
+ void lcd_driver_proc();
+
+ SC_CTOR( dist_lcd_mod )
+ {
+ SC_METHOD( lcd_driver_proc );
+ sensitive << total_dist << partial_dist;
+ }
+};
+
+SC_MODULE( dist_mod )
+{
+ // Ports:
+ sc_in<bool> pulse; // Pulse coming ftom the pulse generator.
+ sc_in<bool> reset; // Reset the partial distance odometer if true.
+ sc_in<bool> start; // Becomes true if the car's started.
+
+ // Output ports:
+ sc_out<double> total; // Total distance.
+ sc_out<double> partial; // Partial distance.
+
+ // Internal signals:
+ sc_signal<bool> ok_for_incr;
+ sc_signal<double> total_dist;
+ sc_signal<double> partial_dist;
+
+ // Internal models:
+ dist_read_mod *read_mod;
+ dist_compute_mod *compute_mod;
+ dist_lcd_mod *lcd_mod;
+
+ SC_CTOR( dist_mod )
+ {
+ read_mod = new dist_read_mod("read_mod");
+ compute_mod = new dist_compute_mod("compute_mod");
+ lcd_mod = new dist_lcd_mod("lcd_mod");
+
+ // read_mod->pulse.bind(pulse);
+ // read_mod->start.bind(start);
+ // read_mod->ok_for_incr.bind(ok_for_incr);
+
+ read_mod->pulse(pulse);
+ read_mod->start(start);
+ read_mod->ok_for_incr(ok_for_incr);
+
+ // (*read_mod)(pulse, start, ok_for_incr);
+
+ // compute_mod->reset.bind(reset);
+ // compute_mod->start.bind(start);
+ // compute_mod->ok_for_incr.bind(ok_for_incr);
+ // compute_mod->total_dist.bind(total_dist);
+ // compute_mod->partial_dist.bind(partial_dist);
+ compute_mod->reset(reset);
+ compute_mod->start(start);
+ compute_mod->ok_for_incr.bind(ok_for_incr);
+ compute_mod->total_dist.bind(total_dist);
+ compute_mod->partial_dist(partial_dist);
+
+ // lcd_mod->start.bind(start);
+ // lcd_mod->total_dist.bind(total_dist);
+ // lcd_mod->partial_dist.bind(partial_dist);
+ // lcd_mod->total.bind(total);
+ // lcd_mod->partial.bind(partial);
+
+ lcd_mod->start(start);
+ lcd_mod->total_dist(total_dist);
+ lcd_mod->partial_dist(partial_dist);
+ lcd_mod->total(total);
+ lcd_mod->partial(partial);
+
+ // *lcd_mod << start, total_dist, partial_dist, total, partial;
+
+ ok_for_incr = false;
+ total_dist = 0.0;
+ partial_dist = 0.0;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/driver.cpp b/src/systemc/tests/systemc/misc/v1.0/dash9/driver.cpp
new file mode 100644
index 000000000..8f36a3e4f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/driver.cpp
@@ -0,0 +1,124 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.cpp -- Implementation of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: driver.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.4 2006/01/24 21:05:59 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+
+// Driver's output actions.
+void
+driver_mod::driver_out_proc()
+{
+ // while (true) {
+ cout << "Driver is up @ " << sc_time_stamp() << endl;
+
+ // Car is at rest.
+ speed_set = 0;
+ reset = false;
+ start = false;
+ wait();
+
+ cout << "Driver started the car @ " << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ start = true;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver set the speed to 120 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 120;
+ wait();
+
+ cout << "Driver reset the partial distance odometer @ "
+ << sc_time_stamp() << endl;
+ cout << "Driver set the speed to 60 km/h @ " << sc_time_stamp() << endl;
+ reset = true;
+ speed_set = 60;
+ wait();
+
+ cout << "Driver set the speed to 40 km/h @ " << sc_time_stamp() << endl;
+ speed_set = 40;
+ wait();
+
+ cout << "Driver stopped the car @ " << sc_time_stamp() << endl;
+ wait();
+
+ sc_stop();
+ // }
+}
+
+// Driver's input actions.
+void
+driver_mod::driver_in_proc()
+{
+ if (speed.event()) {
+ cout << "Current speed displayed = "
+ << speed << " km/h @ " << sc_time_stamp() << endl;
+ }
+
+ if (angle.event()) {
+ cout << "Current speedometer angle = " << angle
+ << " degrees @ " << sc_time_stamp() << endl;
+ }
+
+ if (total.event()) {
+ cout << "Current total distance displayed = "
+ << total << " km @ " << sc_time_stamp() << endl;
+ }
+
+ if (partial.event()) {
+ cout << "Current partial distance displayed = "
+ << partial << " km @ " << sc_time_stamp() << endl;
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/driver.h b/src/systemc/tests/systemc/misc/v1.0/dash9/driver.h
new file mode 100644
index 000000000..795fa63b5
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/driver.h
@@ -0,0 +1,69 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ driver.h -- Definition of the driver.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef DRIVER_H
+#define DRIVER_H
+
+SC_MODULE( driver_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock for the actions of the driver.
+ sc_in<double> speed;
+ sc_in<double> angle;
+ sc_in<double> total;
+ sc_in<double> partial;
+
+ // Output ports:
+ sc_out<bool> reset; // Set if the driver wants to reset the partial
+ // distance odometer.
+ sc_out<int> speed_set; // Speed of the car as set by the driver.
+ sc_out<bool> start; // Set if the driver starts the car.
+
+ // Driver's actions.
+ void driver_out_proc();
+ void driver_in_proc();
+
+ SC_CTOR( driver_mod )
+ {
+ SC_CTHREAD( driver_out_proc, clk.pos() );
+
+ SC_METHOD( driver_in_proc );
+ sensitive << speed << angle << total << partial;
+ }
+};
+
+#endif
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/golden/dash9.log b/src/systemc/tests/systemc/misc/v1.0/dash9/golden/dash9.log
new file mode 100644
index 000000000..8668a2d8a
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/golden/dash9.log
@@ -0,0 +1,35 @@
+SystemC Simulation
+Driver is up @ 0 s
+Driver started the car @ 10 us
+Driver set the speed to 40 km/h @ 10 us
+Current speed displayed = 18.2769 km/h @ 10625 ns
+Current speedometer angle = 37.9598 degrees @ 10625 ns
+Current speed displayed = 19.8 km/h @ 11225 ns
+Current speedometer angle = 41.1231 degrees @ 11225 ns
+Driver set the speed to 120 km/h @ 20 us
+Current speed displayed = 26.4 km/h @ 20075 ns
+Current speedometer angle = 54.8308 degrees @ 20075 ns
+Current speed displayed = 59.4 km/h @ 20275 ns
+Current speedometer angle = 123.369 degrees @ 20275 ns
+Current total distance displayed = 0.01 km @ 22775 ns
+Current partial distance displayed = 0.01 km @ 22775 ns
+Current total distance displayed = 0.02 km @ 28875 ns
+Current partial distance displayed = 0.02 km @ 28875 ns
+Driver reset the partial distance odometer @ 30 us
+Driver set the speed to 60 km/h @ 30 us
+Current speed displayed = 39.6 km/h @ 30175 ns
+Current speedometer angle = 82.2462 degrees @ 30175 ns
+Current speed displayed = 29.7 km/h @ 30575 ns
+Current speedometer angle = 61.6846 degrees @ 30575 ns
+Current total distance displayed = 0.03 km @ 39975 ns
+Current partial distance displayed = 0 km @ 39975 ns
+Driver set the speed to 40 km/h @ 40 us
+Current speed displayed = 23.76 km/h @ 40275 ns
+Current speedometer angle = 49.3477 degrees @ 40275 ns
+Current speed displayed = 19.8 km/h @ 40875 ns
+Current speedometer angle = 41.1231 degrees @ 40875 ns
+Driver stopped the car @ 50 us
+Current total distance displayed = 0.04 km @ 58275 ns
+Current partial distance displayed = 0.01 km @ 58275 ns
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/main.cpp b/src/systemc/tests/systemc/misc/v1.0/dash9/main.cpp
new file mode 100644
index 000000000..22c03af23
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/main.cpp
@@ -0,0 +1,169 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.cpp -- Main function for the dashboard controller for a
+ car. This controller contains a speedometer, two odometers (total
+ and partial distance), the driver of the car, clocks, and the
+ pulse generator. The pulses are generated by the sensors placed
+ around one of the wheel shafts. The rate of pulse generation is
+ determined by the speed of the car. The driver can start the car,
+ set its speed, reset the partial distance odometer, and stop the
+ car (which means he will stop the simulation). One of the clocks
+ is slow and the other is fast. The fast clock represents the real
+ time. The slow clock is used to control the actions of the
+ driver. The signals in this program are traced.
+
+ dash8's purpose (in terms of changes to dash7's purpose) --
+ Positional connection method for binding the ports of modules.
+ Example: Let m be a module with ports p1 and p2. Let m_ptr be a
+ pointer to m, and let p1_arg and p2_arg be the ports that we want
+ to bind to p1 and p2 of m. Then, we can do the binding in one of
+ the following:
+
+ m(p1_arg, p2_arg); or (*m_ptr)(p1_arg, p2_arg);
+
+ m.p1(p1_arg); m.p2.bind(p2_arg); or
+ m_ptr->p1(p1_arg); m->p2.bind(p2_arg);
+
+ The output of this program is identical to that of dash[6-8].
+
+ purpose (in terms of changes to dash8's purpose) -- the use of
+ module and process declaration macros, defined in systemc.h.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: main.cpp,v $
+// Revision 1.2 2011/01/07 01:20:20 acg
+// Andy Goodrich: update for new IEEE 1666.
+//
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.5 2006/01/24 21:05:59 acg
+// Andy Goodrich: replacement of deprecated features with their non-deprecated
+// counterparts.
+//
+// Revision 1.4 2006/01/20 00:43:24 acg
+// Andy Goodrich: Changed over to use putenv() instead of setenv() to accommodate old versions of Solaris.
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "driver.h"
+#include "pulse.h"
+#include "speed.h"
+#include "dist.h"
+
+int
+sc_main(int argc, char *argv[])
+{
+ // Pulses for the speedometer and odometers, generated by the pulse
+ // generator.
+ sc_signal<bool> speed_pulses("speed_pulses");
+ sc_signal<bool> dist_pulses("dist_pulses");
+ // Signals for the driver's actions.
+ sc_signal<bool> reset("reset");
+ sc_signal<int> speed("speed");
+ sc_signal<bool> start("start");
+
+ // Signals observed by the driver.
+ sc_signal<double> disp_speed("disp_speed");
+ sc_signal<double> disp_angle("disp_angle");
+ sc_signal<double> disp_total_dist("disp_total_dist");
+ sc_signal<double> disp_partial_dist("disp_partial_dist");
+
+ // Clocks.
+ sc_clock clk0("slow_clk", SLOW_CLOCK_PERIOD0, SC_NS, 0.5, 0.0, SC_NS, true);
+ sc_clock clk1("fast_clk", FAST_CLOCK_PERIOD1, SC_NS, 0.5, 0.0, SC_NS, false);
+
+ driver_mod driver("driver");
+ driver(clk0, disp_speed, disp_angle, disp_total_dist,
+ disp_partial_dist, reset, speed, start);
+
+ gen_pulse_mod gen_pulse("gen_pulse");
+ gen_pulse(clk1, start, speed, speed_pulses, dist_pulses);
+
+ speed_mod speedometer("speedometer");
+ speedometer(clk1, start, speed_pulses, disp_speed, disp_angle);
+
+ dist_mod odometers("odometers");
+ odometers.pulse(dist_pulses);
+ odometers.reset(reset);
+ odometers.start.bind(start);
+ odometers.total(disp_total_dist);
+ odometers.partial.bind(disp_partial_dist);
+
+ // Initialize signals:
+ start = false;
+
+ // Tracing:
+ // Trace file creation.
+ sc_trace_file *tf = sc_create_vcd_trace_file("dash");
+ // External signals.
+ sc_trace(tf, clk0, "slow_clk");
+ sc_trace(tf, clk1, "fast_clk");
+ sc_trace(tf, speed_pulses, "speed_pulses");
+ sc_trace(tf, dist_pulses, "dist_pulses");
+ sc_trace(tf, reset, "reset");
+ sc_trace(tf, start, "start");
+ sc_trace(tf, speed, "speed");
+ sc_trace(tf, disp_speed, "disp_speed");
+ sc_trace(tf, disp_angle, "disp_angle");
+ sc_trace(tf, disp_total_dist, "disp_total_dist");
+ sc_trace(tf, disp_partial_dist, "disp_partial_dist");
+ // Internal signals.
+ sc_trace(tf, speedometer.elapsed_time, "elapsed_time");
+ sc_trace(tf, speedometer.read_mod->raw_speed, "raw_speed");
+ sc_trace(tf, speedometer.filtered_speed, "filtered_speed");
+ sc_trace(tf, odometers.ok_for_incr, "ok_for_incr");
+ sc_trace(tf, odometers.total_dist, "total_dist");
+ sc_trace(tf, odometers.partial_dist, "partial_dist");
+
+ disp_speed = 0.0;
+ disp_angle = 0.0;
+ disp_total_dist = 0.0;
+ disp_partial_dist = 0.0;
+
+ sc_start();
+
+ return 0;
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.cpp b/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.cpp
new file mode 100644
index 000000000..c2b5031f2
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.cpp
@@ -0,0 +1,101 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.cpp -- Implementation of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: pulse.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "pulse.h"
+
+// Find the pulse period to produce speed.
+// This function also rounds the period to the nearest integer.
+int
+gen_pulse_mod::find_period(int speed)
+{
+ if (speed <= 0)
+ return 1;
+
+ const double num = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / 2;
+
+ double dp = num / speed;
+ int ip = int(dp);
+
+ ip = ip + ((dp - ip) >= double(0.5) ? 1 : 0);
+
+ return ip;
+}
+
+// Generate pulses for speedometer and odometers.
+void
+gen_pulse_mod::gen_pulse_proc()
+{
+ speed_pulse = false;
+ dist_pulse = false;
+
+ // Wait until the car is started.
+
+ do { wait(); } while (start != true);
+
+ /*
+ do {
+ wait();
+ } while (start == false);
+ */
+
+ while (true) {
+
+ speed_pulse = true;
+ dist_pulse = true;
+ AWAIT(find_period(speed));
+
+ speed_pulse = false;
+ dist_pulse = false;
+ AWAIT(find_period(speed));
+ }
+}
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.h b/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.h
new file mode 100644
index 000000000..b1206d185
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/pulse.h
@@ -0,0 +1,63 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ pulse.h -- Definition of the pulse generator.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef PULSE_H
+#define PULSE_H
+
+SC_MODULE( gen_pulse_mod )
+{
+ // Ports:
+ sc_in_clk clk; // Clock for the pulse generator.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<int> speed; // Speed of the car set by the driver.
+ sc_out<bool> speed_pulse; // Pulses for the speedometer.
+ sc_out<bool> dist_pulse; // Pulses for the odometers.
+
+ // Find the pulse period to produce speed.
+ int find_period(int speed);
+
+ // Generate pulses for speedometer and odometers.
+ void gen_pulse_proc();
+
+ SC_CTOR( gen_pulse_mod )
+ {
+ SC_CTHREAD( gen_pulse_proc, clk.pos() );
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/speed.cpp b/src/systemc/tests/systemc/misc/v1.0/dash9/speed.cpp
new file mode 100644
index 000000000..10e29ce12
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/speed.cpp
@@ -0,0 +1,111 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.cpp -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+// $Log: speed.cpp,v $
+// Revision 1.1.1.1 2006/12/15 20:26:24 acg
+// systemc_tests-2.3
+//
+// Revision 1.3 2006/01/19 00:48:20 acg
+// Andy Goodrich: Changes for the fact signal write checking is enabled.
+//
+// Revision 1.2 2006/01/18 00:23:51 acg
+// Change over from SC_NO_WRITE_CHECK to sc_write_check_enable() call.
+//
+
+#define SC_NO_WRITE_CHECK
+#include "systemc.h"
+#include "const.h"
+#include "speed.h"
+
+// Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+void speed_mod::find_time_proc()
+{
+ if (start)
+ elapsed_time = elapsed_time + 1;
+ else
+ elapsed_time = 0;
+}
+
+// Compute speed.
+void
+speed_read_mod::read_speed_proc()
+{
+ wait();
+
+ while (true) {
+
+ // More than one pulse is needed to compute a distance and
+ // consequently, speed. This function collects NUM_PULSES_FOR_SPEED
+ // pulses for that purpose.
+ AWAIT(NUM_PULSES_FOR_SPEED);
+
+ if (start)
+ raw_speed = DIST_BETWEEN_TWO_PULSES * PERIODS_PER_HOUR / elapsed_time;
+ else
+ raw_speed = 0.0;
+
+ // Reset timer.
+ elapsed_time = 0;
+ }
+}
+
+// Filter speed.
+void
+speed_read_mod::filter_speed_proc()
+{
+ if (start)
+ filtered_speed = raw_speed;
+ else
+ filtered_speed = 0.0;
+}
+
+// Compute needle angle and drive the speedometer.
+void
+speed_pwm_mod::pwm_driver_proc()
+{
+ if (start) {
+ speed = filtered_speed;
+ angle = filtered_speed * MAX_ANGLE / MAX_SPEED;
+ }
+ else {
+ speed = 0.0;
+ angle = 0.0;
+ }
+}
+
+
+// End of file
diff --git a/src/systemc/tests/systemc/misc/v1.0/dash9/speed.h b/src/systemc/tests/systemc/misc/v1.0/dash9/speed.h
new file mode 100644
index 000000000..181cac253
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/dash9/speed.h
@@ -0,0 +1,154 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ speed.h -- Definition of the speedometer.
+
+ Original Author: Ali Dasdan, Synopsys, Inc.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#ifndef SPEED_H
+#define SPEED_H
+
+SC_MODULE( speed_read_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> filtered_speed; // Filtered speed.
+
+ // Inout ports:
+ sc_inout<int> elapsed_time;
+
+ // Internal signals:
+ sc_signal<double> raw_speed;
+
+ // Compute speed.
+ void read_speed_proc();
+
+ // Filter speed.
+ void filter_speed_proc();
+
+ SC_CTOR( speed_read_mod )
+ {
+ SC_THREAD( read_speed_proc );
+ sensitive << pulse.pos();
+
+ SC_METHOD( filter_speed_proc );
+ sensitive << raw_speed;
+
+ raw_speed = 0.0;
+ }
+};
+
+SC_MODULE( speed_pwm_mod )
+{
+ // Input ports:
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<double> filtered_speed;
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Compute needle angle and drive the speedometer.
+ void pwm_driver_proc();
+
+ SC_CTOR( speed_pwm_mod )
+ {
+ SC_METHOD( pwm_driver_proc );
+ sensitive << filtered_speed;
+ }
+};
+
+SC_MODULE( speed_mod )
+{
+ // Input ports:
+ sc_in_clk clk; // Clock to measure the time, needed to compute the speed.
+ sc_in<bool> start; // Becomes true if the car's started.
+ sc_in<bool> pulse; // Pulse coming from the pulse generator.
+
+ // Output ports:
+ sc_out<double> speed; // Displayed speed.
+ sc_out<double> angle; // Displayed angle.
+
+ // Internal signals:
+ sc_signal<int> elapsed_time;
+ sc_signal<double> filtered_speed;
+
+ // Internal models:
+ speed_read_mod *read_mod;
+ speed_pwm_mod *pwm_mod;
+
+ // Find the elapsed_time between NUM_PULSES_FOR_SPEED pulses.
+ void find_time_proc();
+
+ SC_CTOR( speed_mod )
+ {
+ SC_METHOD( find_time_proc );
+ sensitive << clk.pos();
+
+ read_mod = new speed_read_mod("read_mod");
+ pwm_mod = new speed_pwm_mod("pwm_mod");
+
+ // read_mod->start.bind(start);
+ // read_mod->pulse.bind(pulse);
+ // read_mod->filtered_speed.bind(filtered_speed);
+ // read_mod->elapsed_time.bind(elapsed_time);
+
+ read_mod->start(start);
+ read_mod->pulse(pulse);
+ read_mod->filtered_speed(filtered_speed);
+ read_mod->elapsed_time(elapsed_time);
+
+ // (*read_mod)(start, pulse, filtered_speed, elapsed_time);
+
+ // pwm_mod->start.bind(start);
+ // pwm_mod->filtered_speed.bind(filtered_speed);
+ // pwm_mod->speed.bind(speed);
+ // pwm_mod->angle.bind(angle);
+
+ pwm_mod->start(start);
+ pwm_mod->filtered_speed(filtered_speed);
+ pwm_mod->speed(speed);
+ pwm_mod->angle(angle);
+
+ // *pwm_mod << start << filtered_speed << speed << angle;
+
+ elapsed_time = 0;
+ filtered_speed = 0.0;
+ }
+};
+
+#endif
+
diff --git a/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log b/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log
new file mode 100644
index 000000000..dbee91c11
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/module_name/golden/module_name.log
@@ -0,0 +1,161 @@
+SystemC Simulation
+block_f 32
+block_e 0
+tb_proc
+tb2_proc
+a = 49597
+b = 41218
+c = 760938885
+block_d 0
+block_f 33
+block_e 1
+tb_proc
+tb2_proc
+a = 20635
+b = 40894
+c = -1246516011
+block_d 1
+block_f 34
+block_e 2
+tb_proc
+tb2_proc
+a = 16767
+b = 17233
+c = -15844000
+block_d 2
+block_f 35
+block_e 3
+tb_proc
+tb2_proc
+a = 36246
+b = 28171
+c = 520167275
+block_d 3
+block_f 36
+block_e 4
+tb_proc
+tb2_proc
+a = 60879
+b = 49566
+c = 1249464285
+block_d 4
+block_f 37
+block_e 5
+tb_proc
+tb2_proc
+a = 10971
+b = 24107
+c = -460784608
+block_d 5
+block_f 38
+block_e 6
+tb_proc
+tb2_proc
+a = 30561
+b = 49648
+c = -1530949183
+block_d 6
+block_f 39
+block_e 7
+tb_proc
+tb2_proc
+a = 50031
+b = 12559
+c = -1949594816
+block_d 7
+block_f 40
+block_e 8
+tb_proc
+tb2_proc
+a = 23787
+b = 35674
+c = -706812907
+block_d 8
+block_f 41
+block_e 9
+tb_proc
+tb2_proc
+a = 43320
+b = 37558
+c = 466019036
+block_d 9
+block_f 42
+block_e 10
+tb_proc
+tb2_proc
+a = 840
+b = 18689
+c = -348573121
+block_d 10
+block_f 43
+block_e 11
+tb_proc
+tb2_proc
+a = 62466
+b = 6308
+c = -432757004
+block_d 11
+block_f 44
+block_e 12
+tb_proc
+tb2_proc
+a = 46271
+b = 49801
+c = -339134160
+block_d 12
+block_f 45
+block_e 13
+tb_proc
+tb2_proc
+a = 43433
+b = 22683
+c = 1371907000
+block_d 13
+block_f 46
+block_e 14
+tb_proc
+tb2_proc
+a = 35494
+b = 35259
+c = 16626955
+block_d 14
+block_f 47
+block_e 15
+tb_proc
+tb2_proc
+a = 29020
+b = 19555
+c = 459762375
+block_d 15
+block_f 48
+block_e 16
+tb_proc
+tb2_proc
+a = 10941
+b = 49656
+c = 1948954441
+block_d 16
+block_f 49
+block_e 17
+tb_proc
+tb2_proc
+a = 60450
+b = 27709
+c = -1408553477
+block_d 17
+block_f 50
+block_e 18
+tb_proc
+tb2_proc
+a = 1353
+b = 31160
+c = -969114991
+block_d 18
+block_f 51
+block_e 19
+tb_proc
+tb2_proc
+a = 55880
+b = 62232
+c = -750247424
+block_d 19
diff --git a/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp b/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp
new file mode 100644
index 000000000..3cdae1f91
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/module_name/module_name.cpp
@@ -0,0 +1,228 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ module_name.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+int numbers[] = { 49597, 41218, 20635, 40894, 16767, 17233, 36246, 28171, 60879, 49566, 10971, 24107, 30561, 49648, 50031, 12559, 23787, 35674, 43320, 37558, 840, 18689, 62466, 6308, 46271, 49801, 43433, 22683, 35494, 35259, 29020, 19555, 10941, 49656, 60450, 27709, 1353, 31160, 55880, 62232, 15190, 1315, 20803, 45751, 50963, 5298, 58311, 9215, 2378 };
+
+int numbers_index = 0;
+
+struct example : sc_module {
+ sc_in_clk clk;
+ sc_in<int> a;
+ sc_in<int> b;
+ sc_out<int> c;
+
+ sc_signal<int> d;
+ sc_signal<int> e;
+
+ void block_a();
+ void block_b();
+ void block_c();
+ void block_d();
+ void block_e();
+ void block_f();
+
+ SC_CTOR(example)
+ {
+ SC_METHOD( block_a );
+ sensitive << a;
+ sensitive << b;
+
+ SC_METHOD( block_b );
+ sensitive << a << b;
+
+ SC_METHOD( block_c );
+ sensitive << d << e;
+
+ SC_CTHREAD( block_d, clk.neg() );
+
+ SC_CTHREAD( block_e, clk.pos() );
+
+ SC_CTHREAD( block_f, clk.pos() );
+ }
+};
+
+void
+example::block_a()
+{
+ d = a + b;
+}
+
+void
+example::block_b()
+{
+ e = a - b;
+}
+
+void
+example::block_c()
+{
+ c = d * e;
+}
+
+void
+example::block_d()
+{
+ int i = 0;
+ while (true) {
+ cout << "block_d " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+void
+example::block_e()
+{
+ int i = 0;
+ while (true) {
+ cout << "block_e " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+void
+example::block_f()
+{
+ int i = 32;
+ while (true) {
+ cout << "block_f " << i << endl;
+ i++;
+ wait();
+ }
+}
+
+struct tb : sc_module {
+ sc_in_clk clk;
+ sc_out<int> a;
+
+ void tb_proc();
+
+ SC_CTOR(tb)
+ {
+ SC_CTHREAD( tb_proc, clk.pos() );
+ }
+};
+
+void
+tb::tb_proc()
+{
+ while (true) {
+ a = numbers[numbers_index % (sizeof(numbers)/sizeof(numbers[0]))];
+ numbers_index++;
+ cout << "tb_proc " << endl;
+ wait();
+ }
+}
+
+struct tb2 : sc_module {
+ sc_in_clk clk;
+ sc_out<int> b;
+
+ void tb2_proc();
+
+ SC_CTOR(tb2)
+ {
+ SC_CTHREAD( tb2_proc, clk.pos() );
+ }
+};
+
+void
+tb2::tb2_proc()
+{
+ while (true) {
+ b = numbers[numbers_index % (sizeof(numbers)/sizeof(numbers[0]))];
+ numbers_index++;
+ cout << "tb2_proc " << endl;
+ wait();
+ }
+}
+
+SC_MODULE( monitor )
+{
+ SC_HAS_PROCESS( monitor );
+
+ const sc_signal<int>& a;
+ const sc_signal<int>& b;
+ const sc_signal<int>& c;
+
+ monitor( sc_module_name,
+ const sc_signal<int>& A,
+ const sc_signal<int>& B,
+ const sc_signal<int>& C ) :
+ a(A), b(B), c(C)
+ {
+ SC_METHOD( entry );
+ sensitive << a;
+ sensitive << b;
+ sensitive << c;
+ }
+ void entry();
+};
+
+void
+monitor::entry()
+{
+ if (a.event()) cout << "a = " << a << endl;
+ if (b.event()) cout << "b = " << b << endl;
+ if (c.event()) cout << "c = " << c << endl;
+}
+
+int
+sc_main( int argc, char* argv[] )
+{
+ sc_signal<int> a("a");
+ sc_signal<int> b("b");
+ sc_signal<int> c("c");
+ sc_clock clk("clk", 10, SC_NS);
+
+ example ex1("ex1");
+ ex1(clk, a, b, c);
+
+ tb tbb1("tbb1");
+ tbb1(clk, a);
+
+ tb2 tbb2("tbb2");
+ tbb2(clk, b);
+
+ monitor mon("mon", a, b, c);
+
+ sc_start(200, SC_NS);
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/golden/out_of_bounds.log b/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/golden/out_of_bounds.log
new file mode 100644
index 000000000..ff9f7da9f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/golden/out_of_bounds.log
@@ -0,0 +1,17 @@
+SystemC Simulation
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
+Error: (E5) out of bounds
+In file: <removed by verify.pl>
diff --git a/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/out_of_bounds.cpp b/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/out_of_bounds.cpp
new file mode 100644
index 000000000..2377edbb1
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/out_of_bounds/out_of_bounds.cpp
@@ -0,0 +1,79 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ out_of_bounds.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+//----------------------------------------------------------
+// test the out of range of sc_bv<> and sc_lv<>
+//----------------------------------------------------------
+#include "systemc.h"
+
+template<class X>
+void test(int W)
+{
+ X x(W);
+ try { x.range(W+1,0); }
+ catch(const sc_report& s)
+ {
+ cout<<s.what()<<"\n";
+ }
+ try { x.range(0,W+1); }
+ catch(const sc_report& s)
+ {
+ cout<<s.what()<<"\n";
+ }
+ try { x.range(W-1,-1); }
+ catch(const sc_report& s)
+ {
+ cout<<s.what()<<"\n";
+ }
+ try { x.range(-1,W-1); }
+ catch(const sc_report& s)
+ {
+ cout<<s.what()<<"\n";
+ }
+ catch(...)
+ { cout<<"couldn''t catch anything\n";}
+}
+
+int sc_main(int, char**)
+{
+ const unsigned N = 2000;
+
+ test<sc_bv<N> >(N);
+ test<sc_lv<N> >(N);
+
+ return 0;
+}
diff --git a/src/systemc/tests/systemc/misc/v1.0/resolved_sig/golden/resolved_sig.log b/src/systemc/tests/systemc/misc/v1.0/resolved_sig/golden/resolved_sig.log
new file mode 100644
index 000000000..076b2dbe6
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/resolved_sig/golden/resolved_sig.log
@@ -0,0 +1,75 @@
+SystemC Simulation
+writing to bus: 00000000; reading from bus=00000000
+datawidth writing to bus: 10101010
+writing to bus: 10101010; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: Z0Z0Z0Z0; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: X0X0X0X0; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 00000000; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 10101010; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: 01010101; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 11111111; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: Z1Z1Z1Z1; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: X1X1X1X1; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 01010101; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 11111111; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: 0Z0Z0Z0Z; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 1Z1Z1Z1Z; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: ZZZZZZZZ; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: XZXZXZXZ; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 0Z0Z0Z0Z; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 1Z1Z1Z1Z; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: 0X0X0X0X; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 1X1X1X1X; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: ZXZXZXZX; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: XXXXXXXX; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 0X0X0X0X; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 1X1X1X1X; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: 00000000; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 10101010; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: Z0Z0Z0Z0; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: X0X0X0X0; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 00000000; reading from bus=X0X0X0X0
+datawidth writing to bus: 10101010
+writing to bus: 10101010; reading from bus=10101010
+datawidth writing to bus: 10101010
+writing to bus: 01010101; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 11111111; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: Z1Z1Z1Z1; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+writing to bus: X1X1X1X1; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 01010101; reading from bus=XXXXXXXX
+datawidth writing to bus: 10101010
+writing to bus: 11111111; reading from bus=1X1X1X1X
+datawidth writing to bus: 10101010
+
+Info: /OSCI/SystemC: Simulation stopped by user.
diff --git a/src/systemc/tests/systemc/misc/v1.0/resolved_sig/resolved_sig.cpp b/src/systemc/tests/systemc/misc/v1.0/resolved_sig/resolved_sig.cpp
new file mode 100644
index 000000000..91f5eea6f
--- /dev/null
+++ b/src/systemc/tests/systemc/misc/v1.0/resolved_sig/resolved_sig.cpp
@@ -0,0 +1,205 @@
+/*****************************************************************************
+
+ Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
+ more contributor license agreements. See the NOTICE file distributed
+ with this work for additional information regarding copyright ownership.
+ Accellera licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with the
+ License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ permissions and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ resolved_sig.cpp --
+
+ Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+ changes you are making here.
+
+ Name, Affiliation, Date:
+ Description of Modification:
+
+ *****************************************************************************/
+
+#include "systemc.h"
+
+ /**************************************/
+
+SC_MODULE( stimgen )
+{
+ SC_HAS_PROCESS( stimgen );
+
+ // Inputs
+ sc_in_clk clk;
+ sc_in<int> result;
+
+ // Outputs
+ sc_out<int> in1;
+ sc_out<int> in2;
+ sc_out<bool> ready;
+ sc_out_rv<8> bus;
+
+ // Constructor
+ stimgen( sc_module_name NAME,
+ sc_clock& TICK,
+ sc_signal<int>& RESULT,
+ sc_signal<int>& IN1,
+ sc_signal<int>& IN2,
+ sc_signal<bool>& READY,
+ sc_signal_rv<8>& BUS )
+ {
+ SC_CTHREAD( entry, clk.pos() );
+ clk( TICK );
+ result( RESULT );
+ in1( IN1 );
+ in2( IN2 );
+ ready( READY );
+ bus( BUS );
+ }
+
+ void entry();
+};
+
+ /**************************************/
+
+SC_MODULE( datawidth )
+{
+ SC_HAS_PROCESS( datawidth );
+
+ // Inputs
+ sc_in_clk clk;
+ sc_in<int> in1;
+ sc_in<int> in2;
+ sc_in<bool> ready;
+ sc_inout_rv<8> bus;
+
+ // Outputs
+ sc_out<int> result;
+
+ // Constructor
+ datawidth( sc_module_name NAME,
+ sc_clock& TICK,
+ sc_signal<int>& IN1,
+ sc_signal<int>& IN2,
+ sc_signal<bool>& READY,
+ sc_signal<int>& RESULT,
+ sc_signal_rv<8>& BUS )
+ {
+ SC_CTHREAD( entry, clk.pos() );
+ clk( TICK );
+ in1( IN1 );
+ in2( IN2 );
+ ready( READY );
+ bus( BUS );
+ result( RESULT );
+ }
+
+ void entry();
+};
+
+ /*******************************************/
+
+void
+datawidth::entry()
+{
+ int tmp_a;
+ int tmp_b;
+ int tmp_result;
+
+ while (true) {
+
+ // HANDSHAKING
+ do { wait(); } while ( ready != 1 );
+
+ // COMPUTATION
+ tmp_a = in1.read();
+ tmp_b = in2.read();
+ tmp_result = tmp_a + tmp_b;
+ cout << "; reading from bus=" << bus.read() << endl;
+ sc_lv<8> lv( '0' );
+ lv[1] = lv[3] = lv[5] = lv[7] = 1;
+ cout << "datawidth writing to bus: " << lv << endl;
+ bus.write( lv );
+
+ // WRITE OUTPUT
+ result.write( tmp_result ); // result = in1 + in2
+ wait();
+ }
+}
+
+ /*****************************************/
+
+void
+stimgen::entry()
+{
+ int i;
+ int j;
+
+ ready.write( 0 );
+
+ for( i = 0; i < 6; i ++ ) { // integer in1 (6 bits of data)
+ for( j = 0; j < 6; j ++ ) { // integer in2 (6 bits of data)
+ in1.write( i );
+ in2.write( j );
+ ready.write( 1 );
+ sc_lv<8> lv( sc_logic( i % 4 ) );
+ lv[1] = lv[3] = lv[5] = lv[7] = j % 4;
+ cout << "writing to bus: " << lv << flush;
+ bus.write( lv );
+ wait();
+
+ ready.write( 0 );
+ wait();
+
+ // cout << in1.read() << " + " << in2.read()
+ // << " = " << result.read() << endl;
+ }
+ }
+
+ sc_stop();
+}
+
+ /***************************************/
+ /* */
+ /* int = int + int */
+ /* */
+ /* Max addition is 63 + 63 */
+ /* */
+ /***************************************/
+
+int
+sc_main( int ac, char *av[] )
+{
+ // Signal Instantiation
+ sc_signal<int> in1( "in1" );
+ sc_signal<int> in2( "in2" );
+ sc_signal<int> result( "result" );
+ sc_signal<bool> ready( "ready" );
+ sc_signal_rv<8> bus( "bus" );
+
+ // Clock Instantiation
+ sc_clock clk( "clock", 10, SC_NS, 0.5, 0, SC_NS );
+
+ // Process Instantiation
+ datawidth D1( "D1", clk, in1, in2, ready, result, bus );
+ stimgen T1( "T1", clk, result, in1, in2, ready,bus );
+
+ // Simulation Run Control
+ sc_start();
+
+ return 0;
+}