コード例 #1
0
ファイル: tb_lab2b.cpp プロジェクト: kaiserhaz/SystemC
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;
}
コード例 #2
0
ファイル: top.cpp プロジェクト: Vernacular1988/Switch_SoC
// constructor
top::top(sc_core::sc_module_name n,
	 double phc_gain,
	 double lp_fc,
	 double vco_freq,
	 double kvco,
	 double vco_gain
	 )
{

//instantiate models

  sine sin0("sin0",0.0,1.0,0.0,1.0);
  sin0.out(sw12);

  sine sin1("sin1",0.0,1.0,0.0,1.0);
  sin1.out(sw13);

  sine sin2("sin2",0.0,1.0,0.0,1.0);
  sin2.out(sw21);

  sine sin3("sin3",0.0,1.0,0.0,1.0);
  sin3.out(sw23);

  sine sin4("sin4",0.0,1.0,0.0,1.0);
  sin4.out(sw31);

  sine sin5("sin5",0.0,1.0,0.0,1.0);
  sin5.out(sw32);

  sine sin6("sin6",0.0,1.0,0.0,1.0);
  sin6.out(sint1);

  sine sin7("sin7",0.0,1.0,0.0,1.0);
  sin6.out(sint2);


  osc1 = new osc("osc1", phc_gain, lp_fc, vco_freq, kvco, vco_gain);
  osc1->vco_ref1(vco1_in1);
  osc1->vco_ref2(vco1_in2);
  osc1->vco_out(vco1_out);
  osc1->lpf_out(lpf_out1);
  osc1->w1(sw21);
  osc1->w2(sw31);

  sp1 = new split("sp1");
  sp1->in(vco1_out);
  sp1->out1(vco2_in1);
  sp1->out2(vco3_in1);

  osc3 = new osc("osc3", phc_gain, lp_fc, vco_freq-100, kvco, vco_gain);
  osc3->vco_ref1(vco3_in1); //
  osc3->vco_ref2(vco3_in2);
  osc3->vco_out(vco3_out);
  osc3->lpf_out(lpf_out3);
  osc3->w1(sw13);
  osc3->w2(sw23);

  sp3 = new split("sp3");
  sp3->in(vco3_out);
  sp3->out1(vco1_in2);
  sp3->out2(vco2_in2);

 
  osc2 = new osc("osc2", phc_gain, lp_fc, vco_freq+100, kvco, vco_gain);
  osc2->vco_ref1(vco2_in1);
  osc2->vco_ref2(vco2_in2);
  osc2->vco_out(vco2_out);
  osc2->lpf_out(lpf_out2);
  osc2->w1(sw12);
  osc2->w2(sw32);

  sp2 = new split("sp2");
  sp2->in(vco2_out);
  sp2->out1(vco1_in1);
  sp2->out2(vco3_in2);

 
}
コード例 #3
0
int main()
{
	vectorMatrix myMatrix = vectorMatrix(1, 1);
	//myMatrix.printMatrix();
	//myMatrix.reorderMatrix();

	cout << "Matrix Sorting Program: \n";
	cout << "Allows you to create a custom sixed matrix and then sort its columns by lowest to highest \n";
	cout << "You can run the program multiple times without having to close it \n";
	cout << "once done sorting one, simply run the create command again to resize your matrix \n \n";
	cout << "Commands: \n";
	cout << "\n";
	cout << "exit: stops the program from running. \n";
	cout << "\n";
	cout << "create: allows you to create a custom sized matrix. \n";
	cout << "	  entering one value at a time you choose the number of columns and then rows that the matrix will have \n";
	cout << "\n";
	cout << "sort: sorts the created matrix. \n";
	cout << "	  sorts the values in the matrix in order from lowest to highest in their respective columns \n";
	cout << "\n";

	while (isRunning)
	{
		string input;
		getline(cin, input);

		if (input == "exit")
		{
			isRunning = false;
		}
		else if (input == "create")
		{
			cout << "Using this you may create a matrix of your chosen dimensions \n";
			cout << "Please Enter the number of Columns you would like: \n";
			cout << "\n";

			string firstdimensions;
			getline(cin, firstdimensions);

			std::istringstream sin1(firstdimensions);
			int cols = NULL;
			sin1 >> cols;

			//always check if user wants to leave program
			if (firstdimensions == "exit" || firstdimensions == "Exit")
			{
				break;
			}

			cout << "\n";
			cout << "Please Enter the number of Rows you would like: \n";
			cout << "\n";

			string secondDimensions;
			getline(cin, secondDimensions);

			std::istringstream sin2(secondDimensions);
			int rows = NULL;
			sin2 >> rows;

			//always check if user wants to leave program
			if (secondDimensions == "exit" || secondDimensions == "Exit")
			{
				break;
			}
			cout << "\n";

			//if the trees were assigned then neither will be null - if any are null then it was not a valid input
			if (rows != NULL && cols != NULL)
			{
				myMatrix = vectorMatrix(cols, rows);
				cout << "\n The following Matrix was created: \n \n";
				myMatrix.printMatrix();

			}
			else
			{
				cout << "One or more of the selected values were invalid - please tryn again \n";
				cout << "Remember - only input numbers please - no spaces \n";
				cout << "\n";
			}
		}
		else if (input == "help")