int pSim::Update() { #ifdef VERBOSE update_log << "Update no contact" << endl; #endif #ifdef TIMING_CHECK update_start_time = MPI_Wtime(); #endif #ifdef PSIM_TEST max_condition_number = -1.0; max_sigma_ratio = -1.0; max_condition_number_joint = 0; max_sigma_ratio_joint = 0; condition_numbers.resize(n_dof); sigma_ratios.resize(n_dof); condition_numbers.zero(); sigma_ratios.zero(); total_gamma_error = 0.0; #endif /**** assembly ****/ // position-dependent variables update_position(); #if 1 if(do_connect) { // // do collision computation if needed // update_collision(); // don't forget to recompute link velocities CalcVelocity(); do_connect = false; } #endif // velocity-dependent variables update_velocity(); #ifdef TIMING_CHECK cerr << "[" << rank << "] disassembly t = " << MPI_Wtime()-update_start_time << endl; #endif /**** disassembly ****/ disassembly(); #ifdef PSIM_TEST cerr << "--- max condition number = " << max_condition_number << " at " << max_condition_number_joint->name << endl; cerr << "--- max sigma ratio = " << max_sigma_ratio << " at " << max_sigma_ratio_joint->name << endl; cerr << "--- total_gamma_error = " << total_gamma_error << endl; // cerr << "condition_numbers = " << tran(condition_numbers) << endl; // cerr << "sigma_ratios = " << tran(sigma_ratios) << endl; #endif #ifdef USE_MPI // scatter results scatter_acc(); #endif return 0; }
int main(int argc, char* argv[]) { if (argv[1] == NULL) { printf("PLEASE, INPUT BINARY FILE\n"); return READ_FILE_ERR; } FILE* Bin = fopen(argv[1], "rb"); if (Bin == NULL) { printf("FILE READING ERROR\n"); return READ_FILE_ERR; } char* point = argv[1]; while (*point != '.') point++; if (strcmp(point, ".bin") != 0) { printf("INVALID INPUT FILE FORMAT\n"); return INV_INPUT_FILE; } strcpy(point, ".asm"); FILE* Asm = fopen(argv[1], "w"); if (Asm == NULL) { printf("CAN'T CREATE FILE WITH DISASSEBLIED CODE\n"); return 0; } check(disassembly(Bin, Asm)); printf("SUCCESS!\n"); fclose(Bin); fclose(Asm); return 0; }
U32 main () /* definition of main function */ { /* start of main */ nexg_printf ("\n"); nexg_printf ("\t\t\t\t _______________________________________________________________\n"); nexg_printf ("\t\t\t\t|The name of this file is:-%s\t\t\t|\n", __FILE__); /*predefined macros to print the file name */ nexg_printf ("\t\t\t\t|The Current Time is:-%s\t\t\t|\n", __TIMESTAMP__); /*predefined macros to print the time */ nexg_printf ("\t\t\t\t|_______________________________________________________________|\n"); harq (); /* harq function call */ rq (); /* rq function call */ reorder (); /* reorder function call*/ disassembly (); /* disasembly function call */ nexg_printf ("\n\tThe current line is %d\n", __LINE__); /* predefined macro to print number of lines */ return (ZERO); /* returning control to the operating system */ } /* end of main */
void dumpOpcodes(SCMFile* scm, SCMOpcodes* codes, unsigned int offset, unsigned int size) { std::cout << "Offs Opcd " << std::setw(FIELD_DESC_WIDTH) << std::left << "Description" << "Parameters" << std::endl; ScriptDisassembly disassembly(codes, scm); try { disassembly.disassemble(offset); } catch( IllegalInstruction& ex ) { std::cerr << "Error during disassembly: \n" << ex.what() << std::endl; } for( auto& inst : disassembly.getInstructions() ) { ScriptFunctionMeta* code; if(! codes->findOpcode(inst.second.opcode, &code) ) { std::cerr << "Invalid opcode in disassembly (" << inst.second.opcode << ")" << std::endl; } std::cout << std::hex << std::setfill('0') << std::right << std::setw(4) << inst.first << ":" << std::setw(4) << inst.second.opcode << " " << std::setw(FIELD_DESC_WIDTH) << std::setfill(' ') << std::left << code->signature << std::right << "("; for( SCMOpcodeParameter& param : inst.second.parameters ) { switch( param.type ) { case TInt8: std::cout << " i8: " << param.integer; break; case TInt16: std::cout << " i16: " << param.integer; break; case TInt32: std::cout << " i32: " << param.integer; break; case TFloat16: std::cout << " f16: " << param.real; break; case TString: std::cout << " str: " << param.string; break; case TGlobal: std::cout << " g: " << param.globalPtr; break; case TLocal: std::cout << " l: " << param.globalPtr; break; } } std::cout << " )\n"; } }