Example #1
0
int sc_main(int argc, char* argv[]){

	sc_time PERIOD(10,SC_NS); // NS, SEC, SC
	sc_time DELAY(10,SC_NS);
	sc_clock clock("clock", PERIOD, 0.5, DELAY, true);

	And_Gate ag1("ag1");
	TestBench tb("tb");

	sc_signal<bool> a_sg, b_sg, z_sg;

	ag1.a_in(a_sg);
	ag1.b_in(b_sg);
	ag1.z_out(z_sg);

	tb.clk_in(clock);

	tb.a_out(a_sg);
	tb.b_out(b_sg);
	tb.z_in(z_sg);

	sc_start();

	return 0;
}
int main()
{
    lcs::Bus<1> a, b, a_, b_, p1, p2, s;
    
    lcs::Not<> ng1(a_, a), ng2(b_, b);
    lcs::And<2> ag1(p1, (a,b_)), ag2(p2, (a_,b));
    lcs::Or<2> og(s, (p1,p2));

    lcs::ChangeMonitor<2> inputMonitor((a,b), "Input", lcs::DUMP_ON);
    lcs::ChangeMonitor<1> outputMonitor(s, "Output", lcs::DUMP_ON);

    lcs::Tester<2> tester((a,b));

    lcs::Simulation::setStopTime(1000);
    lcs::Simulation::start();

    return 0;
}