From 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 24 May 2018 01:37:55 -0700 Subject: systemc: Import tests from the Accellera systemc distribution. Change-Id: Iad76b398949a55d768a34d027a2d8e3739953da6 Reviewed-on: https://gem5-review.googlesource.com/10845 Reviewed-by: Giacomo Travaglini Maintainer: Gabe Black --- .../tracing/vcd_trace/test13/golden/test13.vcd | 32 +++++++++++++ .../systemc/tracing/vcd_trace/test13/test13.cpp | 53 ++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/systemc/tests/systemc/tracing/vcd_trace/test13/golden/test13.vcd create mode 100644 src/systemc/tests/systemc/tracing/vcd_trace/test13/test13.cpp (limited to 'src/systemc/tests/systemc/tracing/vcd_trace/test13') diff --git a/src/systemc/tests/systemc/tracing/vcd_trace/test13/golden/test13.vcd b/src/systemc/tests/systemc/tracing/vcd_trace/test13/golden/test13.vcd new file mode 100644 index 000000000..f1b55ff3a --- /dev/null +++ b/src/systemc/tests/systemc/tracing/vcd_trace/test13/golden/test13.vcd @@ -0,0 +1,32 @@ + +$timescale + 1 ps +$end + +$scope module SystemC $end +$var wire 1 aaaaa clk $end +$scope module mod $end +$var wire 37 aaaab a [36:0] $end +$upscope $end +$upscope $end +$enddefinitions $end + +$comment +All initial values are dumped below at time 0 sec = 0 timescale units. +$end + +$dumpvars +1aaaaa +b0 aaaab +$end + +#25000 +0aaaaa + +#50000 +1aaaaa +b1100 aaaab + +#75000 +0aaaaa + diff --git a/src/systemc/tests/systemc/tracing/vcd_trace/test13/test13.cpp b/src/systemc/tests/systemc/tracing/vcd_trace/test13/test13.cpp new file mode 100644 index 000000000..1c3333c78 --- /dev/null +++ b/src/systemc/tests/systemc/tracing/vcd_trace/test13/test13.cpp @@ -0,0 +1,53 @@ +#include +sc_trace_file* sc_tf; + +class Mod : public sc_module +{ + public: + sc_in_clk clk; + sc_in > a; + + SC_HAS_PROCESS(Mod); + void foo() + { + cout << sc_time_stamp() << "\n"; + cout << " a = " << a << "\n"; + cout << "\n"; + + return; + + } // foo() + + Mod(const sc_module_name& name) : sc_module(name), a("a") + { + SC_METHOD(foo); + sensitive << clk.pos(); + dont_initialize(); + + sc_trace(sc_tf, a, a.name()); + } + +}; // class Mod + + +int sc_main(int argc, char* argv[]) +{ + sc_clock clk("clk", 50, SC_NS, 0.5, 0, SC_NS); + sc_signal > a; + + sc_tf = sc_create_vcd_trace_file("test13"); + + Mod mod("mod"); + + mod.clk(clk); + mod.a(a); + + sc_trace(sc_tf, clk, clk.name()); + + sc_start(50, SC_NS); + a = 12; + sc_start(50, SC_NS); + + return 0; + +} // sc_main() -- cgit v1.2.3