int sc_main(int argn,char* argc[]) { sca_tdf::sca_signal<double> sig_1, sig_2; sin_source_with_noise sin1("sin1"); sin1.out(sig_1); prefilter prefi1("lp1"); prefi1.in(sig_1); prefi1.out(sig_2); sca_trace_file* tfp = sca_create_vcd_trace_file("tb_lab2b"); sca_trace(tfp, sig_1, "sig_1"); sca_trace(tfp, sig_2, "sig_2"); sc_start(5.0, SC_MS); sca_close_vcd_trace_file(tfp); tfp = sca_create_tabular_trace_file("tb_ac_lab2b.dat"); sca_trace(tfp, sig_1, "sig_1"); sca_trace(tfp, sig_2, "sig_2"); tfp->set_mode(sca_ac_format(sca_util::SCA_AC_DB_DEG)); sca_ac_start(1.0, 1e6, 1000, SCA_LOG); return 0; }
int sc_main(int argc, char* argv[]) { sc_set_time_resolution(10.0, SC_NS); // setting the time resolution // like in SystemC sca_tdf::sca_signal<double> sig_sine ; // instantiating an sdf-signal // instantiating TDF-modules works exactly like with SC-modules // except you need to set the TDF sample period at one port of one // module of the cluster with set_timestep(). If you forget it, you get a // run-time error "...at least one sample period must be assigned // per cluster..." // a sample period of 100 ns is fine in this case sine x("sine", 50, 1000); drain y("drain"); x.out(sig_sine); y.in(sig_sine); sca_util::sca_trace_file* tr = sca_util::sca_create_vcd_trace_file("tr"); sca_trace(tr, sig_sine, "sine"); sc_core::sc_start(2, sc_core::SC_MS); return 0; }
int sc_main(int argn, char* argc[]) // SystemC main program { sca_tdf::sca_signal<double> sig_1; // Signal to connect source w sink sin_source_with_noise src_1("src_1"); // Instantiate source src_1.out(sig_1); // Connect (bind) with signal sink sink_1("sink_1"); // Instantiate sink sink_1.in(sig_1); // Connect (bind) with signal sca_trace_file* tfp = // Open trace file sca_create_vcd_trace_file("testbench"); sca_trace(tfp, sig_1, "sig_1"); // Define which signal to trace sc_start(10.0, SC_MS); // Start simulation for 10 ms sca_close_vcd_trace_file(tfp); // Close trace file return 0; // Exit with return code 0 }