summaryrefslogtreecommitdiff
path: root/src/systemc/tests/systemc/tracing/wif_trace/pct1
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/tracing/wif_trace/pct1
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/tracing/wif_trace/pct1')
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/golden/pct1.awif81
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/main.cpp69
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.cpp49
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.h63
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/pct1.f3
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.cpp98
-rw-r--r--src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.h66
7 files changed, 429 insertions, 0 deletions
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/golden/pct1.awif b/src/systemc/tests/systemc/tracing/wif_trace/pct1/golden/pct1.awif
new file mode 100644
index 000000000..354800e3d
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/golden/pct1.awif
@@ -0,0 +1,81 @@
+
+type scalar "BIT" enum '0', '1' ;
+type scalar "MVL" enum '0', '1', 'X', 'Z', '?' ;
+
+declare O0 "Tx" BIT variable ;
+start_trace O0 ;
+declare O1 "dout" BIT 0 31 variable ;
+start_trace O1 ;
+declare O2 "wr" BIT variable ;
+start_trace O2 ;
+comment "All initial values are dumped below at time 0 sec = 0 timescale units." ;
+assign O0 '1' ;
+assign O1 "00000000000000000000000000000000" ;
+assign O2 '1' ;
+
+delta_time 50000 ;
+assign O0 '0' ;
+
+delta_time 20000 ;
+assign O0 '1' ;
+
+delta_time 10000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 20000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 10000 ;
+assign O0 '0' ;
+
+delta_time 20000 ;
+assign O0 '1' ;
+
+delta_time 20000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 80000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 30000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 20000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 10000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 10000 ;
+assign O0 '0' ;
+
+delta_time 10000 ;
+assign O0 '1' ;
+
+delta_time 90000 ;
+assign O0 '0' ;
+
+delta_time 20000 ;
+assign O0 '1' ;
+
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/main.cpp b/src/systemc/tests/systemc/tracing/wif_trace/pct1/main.cpp
new file mode 100644
index 000000000..bb8807add
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/main.cpp
@@ -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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ main.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:
+
+ *****************************************************************************/
+
+/* Main routine for tri-state simulation */
+
+#include "tx.h"
+#include "monitor.h"
+
+int sc_main(int ac, char *av[])
+{
+ sc_signal<bool> tx;
+ sc_signal<bool> wr;
+ sc_signal<int> dout;
+ sc_signal<bool> two_stop_bits;
+ sc_clock clock("CLK", 10.0, SC_NS, 0.5, 0.0, SC_NS);
+ sc_trace_file *tf = sc_create_wif_trace_file("pct1");
+
+ tx = true;
+ wr = true;
+ dout = 0;
+
+ two_stop_bits = true;
+ sio_tx TX("Transmitter", clock, two_stop_bits, tx);
+ monitor MON("Monitor", clock, tx, dout, wr);
+
+ // sc_trace(tf, clock.signal(), "Clock");
+ sc_trace(tf, tx, "Tx");
+ sc_trace(tf, dout, "dout");
+ sc_trace(tf, wr, "wr");
+
+ sc_start(500, SC_NS);
+ sc_close_wif_trace_file( tf );
+ return 0;
+}
+
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.cpp b/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.cpp
new file mode 100644
index 000000000..9e8f68c6e
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.cpp
@@ -0,0 +1,49 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ monitor.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 "monitor.h"
+
+void monitor::entry()
+{
+ int n=0;
+
+ while(1) {
+ printf("%x", tx.read());
+ wait();
+ }
+} // end of entry function
+
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.h b/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.h
new file mode 100644
index 000000000..1c37a3b28
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/monitor.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ monitor.h --
+
+ 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( monitor )
+{
+ SC_HAS_PROCESS( monitor );
+
+ sc_in_clk clk;
+ sc_in<bool> tx;
+ sc_in<int> dout;
+ sc_in<bool> wr;
+
+ // Constructor
+ monitor( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<bool>& TX,
+ sc_signal<int>& DOUT,
+ sc_signal<bool>& WR )
+ : tx(TX), dout(DOUT), wr(WR)
+ {
+ clk(CLK);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+};
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/pct1.f b/src/systemc/tests/systemc/tracing/wif_trace/pct1/pct1.f
new file mode 100644
index 000000000..4c3ccdbdb
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/pct1.f
@@ -0,0 +1,3 @@
+pct1/main.cpp
+pct1/monitor.cpp
+pct1/tx.cpp
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.cpp b/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.cpp
new file mode 100644
index 000000000..d868d2402
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ tx.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:
+
+ *****************************************************************************/
+
+/* Filename driver.cc */
+/* This is a SIO transmitter */
+
+#include "tx.h"
+
+void sio_tx::byte (char c)
+{
+ bool parity = false;
+ int n;
+
+ // Start bit
+ tx.write(false);
+ wait();
+
+ // 8 data bits
+ for (n=0; n<8; n++) {
+ if (c & 0x1) parity=!parity;
+ tx.write (c & 0x1);
+ c = c >>1;
+ wait();
+ }
+
+ // parity bit
+ tx.write(parity);
+ wait();
+
+ // stop bits;
+ if (two_stop_bits) {
+ tx.write(true);
+ wait();
+ tx.write(true);
+ wait();
+ } else {
+ tx.write(true);
+ wait();
+ }
+} // end of entry function
+
+
+void sio_tx::mark (int cycles)
+{
+ int n;
+
+ for (n=0; n<cycles; n++) {
+ tx.write(true);
+ wait();
+ }
+}
+
+
+void sio_tx::entry()
+{
+ while (1) {
+ mark(5);
+ byte((char)0x5a);
+ byte((char)0xff);
+ mark(1);
+ byte((char)0xab);
+ }
+} // end of entry function
+
diff --git a/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.h b/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.h
new file mode 100644
index 000000000..de1e11469
--- /dev/null
+++ b/src/systemc/tests/systemc/tracing/wif_trace/pct1/tx.h
@@ -0,0 +1,66 @@
+/*****************************************************************************
+
+ 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.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+ tx.h --
+
+ 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:
+
+ *****************************************************************************/
+
+/* Filename tx.h */
+/* This is a SIO transmitter */
+
+#include "systemc.h"
+
+SC_MODULE( sio_tx )
+{
+ SC_HAS_PROCESS( sio_tx );
+
+ sc_in_clk clk;
+ sc_in<bool> two_stop_bits;
+ sc_out<bool> tx;
+
+ // Constructor
+ sio_tx( sc_module_name NAME,
+ sc_clock& CLK,
+ sc_signal<bool>& TWO_STOP_BITS,
+ sc_signal<bool>& TX )
+ : two_stop_bits(TWO_STOP_BITS), tx(TX)
+ {
+ clk(CLK);
+ SC_CTHREAD( entry, clk.pos() );
+ }
+
+ // Process functionality in member function below
+ void entry();
+ void byte (char byte);
+ void mark(int cycles);
+};