// ELN - LC highpass (TB)
// (c) Wolfgang Scherr
// w.scherr <at> cuas.at

#include <systemc-ams>

#include "lc_highpass.h"

int sc_main(int argc, char* argv[])
{
  sc_core::sc_set_time_resolution(1.0, sc_core::SC_FS);
  sca_util::sca_information_off();  

  sca_eln::sca_node vi,inp, outp;
  sca_eln::sca_node_ref gnd;

  sca_eln::sca_vsource V1("V1");
  V1.p.bind(vi);
  V1.n.bind(gnd);
  V1.ac_amplitude=2.0;
  V1.set_timestep(1.0,sc_core::SC_NS);

  sca_eln::sca_r Ri("Ri");
  Ri.p.bind(vi);
  Ri.n.bind(inp);
  Ri.value=50.0;

  sca_eln::sca_r Rl("Rl");
  Rl.p.bind(outp);
  Rl.n.bind(gnd);
  Rl.value=50.0;

  lc_highpass hp("hp"); // DUT
    hp.inp(inp);
    hp.outp(outp);

  // tracing
  sca_util::sca_trace_file* atf = sca_util::sca_create_tabular_trace_file( "hp_ac.dat" );
  atf->set_mode(sca_util::sca_ac_format(sca_util::SCA_AC_REAL_IMAG));
  sca_util::sca_trace( atf, inp, "inp" );
  sca_util::sca_trace( atf, outp, "outp" );

  std::cout << "Simulation started..." << std::endl;

  sc_core::sc_start(0, sc_core::SC_US);
  sca_ac_analysis::sca_ac_start(1.0e2,  1.0e7,  101, sca_ac_analysis::SCA_LOG);

  std::cout << "...simulation finished." << std::endl;

  sca_util::sca_close_tabular_trace_file( atf );

  return 0;
}
