diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-24 01:37:55 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:09:54 +0000 |
commit | 16fa8d7cc8c92f5ab879e4cf9c6c0bbb3567860f (patch) | |
tree | 7b6faaacb4574a555e561534aa4a8508c0624c32 /src/systemc/tests/systemc/tracing/vcd_trace/test13 | |
parent | 7235d3b5211d0ba8f528d930a4c1e7ad62eec51a (diff) | |
download | gem5-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/vcd_trace/test13')
-rw-r--r-- | src/systemc/tests/systemc/tracing/vcd_trace/test13/golden/test13.vcd | 32 | ||||
-rw-r--r-- | src/systemc/tests/systemc/tracing/vcd_trace/test13/test13.cpp | 53 |
2 files changed, 85 insertions, 0 deletions
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 <systemc.h> +sc_trace_file* sc_tf; + +class Mod : public sc_module +{ + public: + sc_in_clk clk; + sc_in<sc_uint<37> > 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<sc_uint<37> > 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() |