Exemple #1
0
int main(void) 
{ int __retres1 ;

  {
  {
  e_wl = 2;
  e_c = e_wl;
  e_g = e_c;
  e_f = e_g;
  e_e = e_f;
  wl_pc = 0;
  c1_pc = 0;
  c2_pc = 0;
  wb_pc = 0;
  wb_i = 1;
  c2_i = wb_i;
  c1_i = c2_i;
  wl_i = c1_i;
  r_i = 0;
  c_req_up = 0;
  d = 0;
  c = 0;
  start_simulation();
  }
  __retres1 = 0;
  return (__retres1);
}
}
Exemple #2
0
static void
object_registered_cb (DfsmObject *obj, GAsyncResult *async_result, MainData *data)
{
	GError *error = NULL;

	g_debug ("Finished registering object %p.", obj);

	/* Finish the async call. */
	dfsm_object_register_on_bus_finish (obj, async_result, &error);
	data->outstanding_registration_callbacks--;

	if (error != NULL) {
		/* Error! Unregister all the objects we've just registered, disconnect from the bus and run away. */
		g_printerr (_("Error connecting simulated object to D-Bus: %s"), error->message);
		g_printerr ("\n");

		data->exit_status = STATUS_DBUS_ERROR;

		g_error_free (error);

		/* Unregister objects and run away from the bus. */
		unregister_objects_and_close_connection (data);
	}

	/* Bail if this isn't the last callback. */
	if (data->outstanding_registration_callbacks > 0) {
		return;
	}

	/* Spawn! */
	start_simulation (data);
}
Exemple #3
0
Fichier : main.c Projet : olivo/BP
int main(void) 
{ int __retres1 ;

  {
  {
 c_m_lock  =    0;
 c_m_ev  =    2;

  m_run_i = 1;
  m_run_pc = 0;
  s_run_i = 1;
  s_run_pc = 0;
  c_empty_req = 1;
  c_empty_rsp = 1;
  c_read_req_ev = 2;
  c_write_req_ev = 2;
  c_read_rsp_ev = 2;
  c_write_rsp_ev = 2;
  c_m_lock = 0;
  c_m_ev = 2;
  start_simulation();
  }
  __retres1 = 0;
  return (__retres1);
}
}
int main(void) 
{ int __retres1 ;

  {
  {
  init_model();
  start_simulation();
  }
  __retres1 = 0;
  return (__retres1);
}
}
Exemple #5
0
int main(void)
{
        struct ramdisk_struct *simulated_disk;

        simulated_disk = create_ramdisk(RAMDISK_SIZE, DEFAULT_LBA_SHIFT);
        if (!simulated_disk) {
                fprintf(stderr, "error initializing ramdisk");
                return -1;
        }

        start_simulation(simulated_disk);

        destroy_ramdisk(simulated_disk);

        return 0;
}
Exemple #6
0
static void
connection_created_cb (GObject *source_object, GAsyncResult *result, MainData *data)
{
	guint i;
	GError *error = NULL;

	/* Finish connecting to D-Bus. */
	data->connection = g_dbus_connection_new_finish (result, &error);

	if (error != NULL) {
		g_printerr (_("Error connecting to D-Bus using address ‘%s’: %s"), data->dbus_address, error->message);
		g_printerr ("\n");

		g_error_free (error);

		data->exit_status = STATUS_DBUS_ERROR;
		g_main_loop_quit (data->main_loop);
		return;
	}

	/* Connect to closed notifications, so we know if the bus disappears. */
	g_signal_connect (data->connection, "closed", (GCallback) connection_closed_cb, data);

	/* Hold an outstanding callback while we loop over the objects, so that we don't spawn the program under test before we've finished
	 * registering all the objects (e.g. if their callbacks are called very quickly). */
	data->outstanding_registration_callbacks++;

	/* Register our DfsmObjects on the bus. */
	for (i = 0; i < data->simulated_objects->len; i++) {
		DfsmObject *simulated_object;

		simulated_object = g_ptr_array_index (data->simulated_objects, i);

		/* Register the object. We keep a count of all the outstanding callbacks and only spawn the program under test once all are complete. */
		data->outstanding_registration_callbacks++;

		g_signal_connect (simulated_object, "notify::dbus-activity-count", (GCallback) simulated_object_dbus_activity_count_notify_cb, data);
		dfsm_object_register_on_bus (simulated_object, data->connection, (GAsyncReadyCallback) object_registered_cb, data);
	}

	/* Release our outstanding callback and spawn the test program if it hasn't been spawned already. */
	data->outstanding_registration_callbacks--;
	if (data->outstanding_registration_callbacks == 0) {
		start_simulation (data);
	}
}
int main(void) 
{ int __retres1 ;

  {
  {
  init_model();
  start_simulation();
  }
  if (! ((int )z_val == 0)) {
    {
    error();
    }
  } else {

  }
  __retres1 = 0;
  return (__retres1);
}
}
Exemple #8
0
/*!
 this is a straight forward main function, that does the following
  - load lua config file
  - get configuration table from config
  - contruct a preferences class from them
  - start simulation according to the preferences
  - dump the result as precified in preferences
 */
int main(int argc, char * argv[argc])
{
  fftw_init_threads();
  fftw_plan_with_nthreads(4);

  if (argc != 3) {
    fprintf(stderr, "usage: %s config.lua result.dat\n", argv[0]);
    return -1;
  }

  lua_State * L = luaL_newstate();
  luaL_openlibs(L);

  preferences_t * prefs = preferences_new();

  if (luaL_dofile(L, argv[1])) {
    fprintf(stderr, "could not load '%s' : %s\n", argv[1], lua_tostring(L, 1));
  } else {
    // get config table
    lua_getfield(L, LUA_GLOBALSINDEX, "config");
    if (lua_isnil(L, -1)) {
      fprintf(stderr, "table config undefined\n");
    } else {
      // ref config table, so we can access it in preferences_read()
      prefs->config = luaL_ref(L, LUA_REGISTRYINDEX);
      if (!preferences_read(L, prefs)) {
        if (!start_simulation(prefs)) {
          FILE * fp = fopen(argv[2], "wb"); assert(fp);
          dump_results(prefs, fp);
          fclose(fp);
        }
      }
    }
  }

  preferences_free(prefs);

  lua_close(L);

  fftw_cleanup();
  fftw_cleanup_threads();
  pthread_exit(NULL);
}
Exemple #9
0
int main(int argc , char * argv[])
{
//    if(argc !=4 ){        printf("\nUSAGE : simuation graph_data car_data time_step");exit(0);}
    GRAPH G; 
    CARS C;
    EDGES E;
    time_step =1;// atof(argv[3]);
    read_graph(&G, "input");//argv[1]); 
    read_cars(&C, "car_input");//argv[2]);
    print_graph(&G);
    print_cars(&C);
    init(&G,&C,&E);
   // print_edges(&E);
    printf(" \n time_step : %f\n",time_step);
    start_simulation(&G,&C,&E);
    print_collisons();
    print_path_history(&C);
    print_edge_history(&E);
    return 1;
}
Exemple #10
0
int main(void) 
{ int count ;
  int __retres2 ;

  {
  {
  num  =    0;
  i  =    0;
  max_loop = 2;
  e  ;
  timer  =    0;
  P_1_pc  =    0;
  C_1_pc  =    0;

  count = 0;
  init_model();
  start_simulation();
  }
  __retres2 = 0;
  return (__retres2);
}
}
mainwin::mainwin(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::mainwin)
{
    /* Initialize program parameters */
    initialize_scalar_propery_names();

    // Set up user interface
    ui->setupUi(this);

    // Set up main window
    this->show();
    // Set central widget

    /* Connect menu items with functions */
    QObject::connect(ui->actionPause, SIGNAL(triggered(bool)),
                     this, SLOT(toggle_pause_simulation()));
    QObject::connect(ui->actionSave_screen_as_TikZ_picture, SIGNAL(triggered(bool)),
                     this, SLOT(save_screen_as_tikz_picture()));

    // Start simulation directly when application has finished loading
    QTimer::singleShot(100, this, SLOT(start_simulation()));
}
Exemple #12
0
Fichier : main.c Projet : olivo/BP
int main(void) 
{ int count ;
  int __retres2 ;

  {
  {

  main_in1_ev  =    2;
  main_in1_req_up  =    0;
  main_in2_ev  =    2;
  main_in2_req_up  =    0;
  main_diff_ev  =    2;
  main_diff_req_up  =    0;
  main_sum_ev  =    2;
  main_sum_req_up  =    0;
  main_pres_ev  =    2;
  main_pres_req_up  =    0;
  main_dbl_ev  =    2;
  main_dbl_req_up  =    0;
  main_zero_ev  =    2;
  main_zero_req_up  =    0;
  main_clk_val  =    0;
  main_clk_ev  =    2;
  main_clk_req_up  =    0;
  main_clk_pos_edge  =    2;
  main_clk_neg_edge  =    2;


  count = 0;
  N_generate_i = 0;
  S1_addsub_i = 0;
  S2_presdbl_i = 0;
  S3_zero_i = 0;
  D_print_i = 0;
  start_simulation();
  }
  {
  while (1) {
    while_2_continue: /* CIL Label */ ;
    {
    main_clk_val_t = 1;
    main_clk_req_up = 1;
    start_simulation();
    count += 1;
    }
    if (count == 5) {
      if ((D_z == 0)) {
        {
        error();
        }
      } else {

      }
      count = 0;
    } else {

    }
    {
    main_clk_val_t = 0;
    main_clk_req_up = 1;
    start_simulation();
    }
  }
  while_2_break: /* CIL Label */ ;
  }
  __retres2 = 0;
  return (__retres2);
}
}
int main()
{

	try {

		const clock_t begin_time = clock();

		start_simulation();

		const clock_t after_init_time = clock();
		/*************************************************
		* STimulus here:
		**************************************************/
#if TEST_TEST_CASE == LUT6_TEST
		run_LUT6_test_stumulus();
#endif
#if TEST_TEST_CASE == TEST_DUT_TEST
		run_TEST_DUT_test_stimulus();
#endif

#if (TEST_TEST_CASE == CARRY4_TEST)
		run_CARRY4_test_stumulus();
#endif


		const clock_t after_run_time = clock();

		VCDWiter vcdWriter("parsimony.vcd");
		vcdWriter.write_vcd();

		delete engine;
		printf("Exiting... \n By");
		fflush(stdout);


		const clock_t finish_time = clock();

		printf("Summary of time of running:\n");
		printf(" Init     :  %.0f ms\n", float(after_init_time - begin_time) / CLOCKS_PER_MSEC);
		printf(" Run      :  %.0f ms\n", float(after_run_time - after_init_time) / CLOCKS_PER_MSEC);
		printf(" VCD write:  %.0f ms\n", float(finish_time - after_run_time) / CLOCKS_PER_MSEC);
		printf("Sum       :  %.0f ms\n", float(finish_time - begin_time) / CLOCKS_PER_MSEC);
	}
	catch (const std::exception &exc)
	{
		// catch anything thrown within try block that derives from std::exception
		std::cerr << "SimulatorEngine::run: start sim: " << exc.what() << std::endl;
		exit(-1);
	}
	catch (const char * ex)
	{
		// catch anything thrown within try block that derives from std::exception
		std::cerr << ex << std::endl;
		exit(-1);
	}
	catch (...)
	{
		// catch anything thrown within try block that derives from std::exception
		std::cerr << "Semi Unhandled EX in main" << std::endl;
		exit(-1);
	}

	return 0;
}