Esempio n. 1
0
File: main.c Progetto: aaasz/SHP
int main() {
    int one_out1, one_out2, one_out3;
    int two_out, three_out, four_out;
    int five_out1, five_out2;
    int six_out, seven_out;
    int eight_out;
    xil_printf("Microblaze:\n");
    XTmrCtr_Initialize(&TimerInst, 0);
    XTmrCtr_SetResetValue(&TimerInst, 0, 0);
    XTmrCtr_Start(&TimerInst, 0);
    StartIF_TS = XTmrCtr_GetValue(&TimerInst, 0);
    function_one(10000000, &one_out1, &one_out2, &one_out3);
    function_two(one_out1, &two_out);
    function_three(one_out2, &three_out);
    function_four(one_out3, &four_out);
    function_five(two_out, three_out, four_out, &five_out1, &five_out2);
    function_six(five_out1, &six_out);
    function_seven(five_out2, &seven_out);
    function_eight(six_out, seven_out, &eight_out);
    xil_printf("Rezultat = %d \n", eight_out);
    FinishIF_TS = XTmrCtr_GetValue(&TimerInst, 0);
    TimeSA = (FinishIF_TS - StartIF_TS) / (50000000 / 1000);
    xil_printf("0\n");
    xil_printf("%d\n", TimeSA);
    xil_printf("SERIALSTOP");
    return 0;
}
Esempio n. 2
0
File: foo.c Progetto: ggcov/ggcov
					    /* C(-) */
int
main(int argc, char **argv)
{
    int x;

    printf("foo running\n");		    /* C(4) */
    x = atoi(argv[1]);			    /* C(4) */
    function_one(--x); function_two(--x) ; function_three(--x);	/* C(4) */
    x += 4;				    /* C(1) */

    return 0;				    /* C(1) */
}
Esempio n. 3
0
File: foo.c Progetto: ggcov/ggcov
					    /* C(-) */
int
main(int argc, char **argv)
{
    int x, y;
    int i;
    
    for (i = 1 ; i < argc ; i++)
    {
    	x = atoi(argv[i]);		    /* C(4) */
	if (x == 42)			    /* C(4) */
	    unused_function(x);		    /* C(0) */
    	y = function_one(x);		    /* C(4) */
	printf("%d -> %d\n", x, y);	    /* C(4) */
    }
    return 0;				    /* C(3) */
}
void test()
{
    switch (x) {
        case 0:
        case 1:
            do_something();
            break;
        case 2:
            do_something_else();
            break;
        default:
            break;
    }

    if (condition) x++;

    if (x == y) {
        q();
    } else if (x > y) {
        w();
    } else {
        r();
    }

    function_one();  // this is function 1
    func();          // another function
    func_two();      // function two

    this_is_a_really_long_function(argument_one,
                                   argument_two,
                                   argument_three,
                                   argument_four,
                                   argument_five);

    double squareness =
        num_nets * -1.62428552015961E-4 +
        1.0 / (grid_h * grid_h) * num_cells * 3.02812966834494E-1 +
        2.41123889653172 / grid_h + pow(6.19504321450544E-1, grid_w) * grid_h -
        pow(6.19504321450544E-1, grid_w) * num_cells * 3.02812966834494E-1 +
        3.41290981390719E-1;
}
Esempio n. 5
0
int main()
{
	int out1, out2, out3; 

	printf("Microblaze:\n");
    INIT_TIMER();
    StartIF_TS = XTmrCtr_GetValue (&TimerInst, 0);

    function_one(10000000, &out1, &out2, &out3);
	
	printf("Rez = %d, %d, %d\n", out1, out2, out3);

    FinishIF_TS = XTmrCtr_GetValue (&TimerInst, 0);
    TimeSA = (FinishIF_TS - StartIF_TS)/TIMER_FREQ_MILLI; 
	/* Timp comunicatie */	
	printf("0\n");

	/* Timp executie */
    printf ("%d\n", TimeSA);

    printf("SERIALSTOP");	
    return 0;
}
	// Allocate a new array to make sure the stack is uncorrupted
	int args_2 [ ] = { 20 };
	result = call_function ( &function_one, 1, args_2 );

	std::cout << "\nResult: " << result;
	return 0;
}

//*/



TEST_CASE ( "Calling C++ version of each function", "[c-all-methods]" ) {
    REQUIRE ( function_zero ( ) == 200 );
	REQUIRE ( function_one ( 10 ) == 30 );
	REQUIRE ( function_two ( 10, 20 ) == 30 );
	REQUIRE ( function_three ( 10, 20, 30 ) == 60 );
	REQUIRE ( function_four ( 10, 20, 30, 40 ) == 100 );
	REQUIRE ( function_five ( 10, 20, 30, 40, 50 ) == 150 );
	REQUIRE ( function_six ( 10, 20, 30, 40, 50, 60 ) == 210 );
}

TEST_CASE ( "Calling 0-parameter assembly function", "[c-method-0-parm]" ) {
 	REQUIRE ( func_0 ( ) == 300 );
}

TEST_CASE ( "Calling 1-parameter assembly function", "[c-method-1-parm]" ) {
	REQUIRE ( func_1 ( 10 ) == 30 );
	REQUIRE ( func_1 ( 20 ) == 60 );
	REQUIRE ( func_1 ( 30 ) == 90 );