⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tb_vco.cpp.bak

📁 新型的SystemC-AMS语言
💻 BAK
字号:
#include "systemc-ams.h"
#include "vco.h"

SCA_SDF_MODULE(src_ctrl) {
   sca_sdf_out<double>  out;

   void init () {
      out.write(0.0);
   }

   void sig_proc() {
      double now = sc_time_stamp().to_seconds();
      if (now < 5.0e-5)       out.write(-5.0);
      else if (now < 1.0e-4)  out.write(+5.0);
      else                    out.write(0.0);
   }
   
   SCA_CTOR(src_ctrl) {}
}; // src_ctrl

SCA_SDF_MODULE(trace)
{
   sca_sdf_in<double> in;
   ofstream output;

   void sig_proc() {
      output << sc_time_stamp().to_seconds() << "\t " << in.read() << endl;
   }

   SCA_CTOR(trace) {
      output.open(name(), ios::out);
   }
};

int sc_main(int argc, char* argv[])
{
   sca_sdf_signal<double>  ctrl, vcoo;
   
   sc_set_time_resolution(0.01, SC_US);

   vco i_vco ("vco");
      i_vco.in(ctrl);
      i_vco.out(vcoo);
      i_vco.gain = 2.5;
      i_vco.kvco = 1e5;
      i_vco.fc = 1e6;
      i_vco.vfc = 0.0;

   src_ctrl i_src("src_ctrl");
      i_src.out(ctrl);
      i_src.out.set_delay(1);
      i_src.out.set_T(sc_time(0.01, SC_US));
      
   trace tr_ctrl("tr_ctrl"); tr_ctrl.in(ctrl);
   trace tr_vcoo("tr_vcoo"); tr_vcoo.in(vcoo);
      
   sc_start(140, SC_US);

   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -