Forum Discussion
Altera_Forum
Honored Contributor
15 years agoHello,
I used C2H to optimize SQR function : This function compute SQRT of 16 bits unsigned integer number. results is on 8 bits. unsigned short sqr(unsigned short Xio){ register unsigned short V= 1<<14; register unsigned short Z=0; register short i; register int temp; register unsigned short X=Xio; for(i=7;i>=0;i--){ Z=Z+V; temp=((X-Z)>=0); X=X-(temp ? Z : 0); Z=Z+(temp ? V : -V); Z=Z/2; V=V/4; }//Fin pour return Z; } After adding sqr function to C2H and configurer in release mode, here is result of make : make -s all includes Compiling board_diag.c... The Nios II C2H Compiler is generating accelerator_hello_world_1_sqr.v... /cygdrive/h/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/c2h-generate/c2h-generate --classpath=/cygdrive/h/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/c2h-generate/com.altera.c2h.jar --classpath=/cygdrive/h/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/c2h-generate/com.altera.widgets.jar --ptf=H:/altera/design/TP_POP5/DE2_70_Basic_Computer/nios_system.ptf --group=hello_world_1 --qpf=H:/altera/design/TP_POP5/DE2_70_Basic_Computer/DE2_70_Basic_Computer --c2h_force_recompile=TRUE --c2h_quartus_compilation=TRUE --c2h_report_only=FALSE --flow_timestamp=h:/altera/design/TP_POP5/DE2_70_Basic_Computer/eclipse_ide2/hello_world_1/Release/c2h_hdl-t --target_cpu_name=CPU --chac_generate_script_location=/cygdrive/h/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/chac-generate --projectname=DE2_70_Basic_Computer --accelerator=sqr,h:/altera/design/TP_POP5/DE2_70_Basic_Computer/eclipse_ide2/hello_world_1/Release/obj/board_diag.c2h_pre,h:/altera/design/TP_POP5/DE2_70_Basic_Computer/eclipse_ide2/hello_world_1/Release/alt_c2h_sqr.c,0sqr Progress: Loading system from fileH:/altera/design/TP_POP5/DE2_70_Basic_Computer/nios_system.sopc... Progress: (reading unnamed) Progress: (reading nios_system) Progress: (adding clk [clock_source 10.0]) Progress: (parameterizing module clk) Progress: (adding CPU [altera_nios2 10.0]) Progress: (building connections) Progress: (parameterizing connections) ...................... Progress: (validating nios_system) Progress: (done reading nios_system) Progress: Removing stale modules from the system... Progress: Adding C2H accelerator component "accelerator_hello_world_1_sqr" to the SOPC Builder system H:/altera/design/TP_POP5/DE2_70_Basic_Computer/nios_system.ptf. No .sopc_builder configuration file(!) # 2010.12.26 13.26.37 (*) mk_custom_sdk starting # 2010.12.26 13.26.37 (*) Reading project H:/altera/design/TP_POP5/DE2_70_Basic_Computer/nios_system.ptf. # 2010.12.26 13.26.37 (*) Finding all CPUs # 2010.12.26 13.26.37 (*) Finding all available components # 2010.12.26 13.26.37 (*) Reading H:/altera/design/TP_POP5/DE2_70_Basic_Computer/.sopc_builder/install.ptf # 2010.12.26 13.26.37 (*) Found 59 components ....... # 2010.12.26 13.26.39 (*) (Legacy SDK Generation Skipped) Error: # 2010.12.26 13.26.39 (*) (All TCL Script Generation Skipped) Error: Generator program # 2010.12.26 13.26.39 (*) (No Libraries Built) for module 'accelerator_hello_world_1_sqr' did NOT run successfully. # 2010.12.26 13.26.39 (*) (Contents Generation Skipped) # 2010.12.26 13.26.39 (*) mk_custom_sdk finishing generator cmd was 'h:/altera/10.0/quartus/bin/perl/bin/perl -Ih:/altera/10.0/quartus/sopc_builder/bin -Ih:/altera/10.0/quartus/sopc_builder/bin/europa -Ih:/altera/10.0/quartus/sopc_builder/bin/perl_lib -I/cygdrive/h/altera/10.0/quartus/sopc_builder/bin/perl_lib:/cygdrive/h/altera/10.0/quartus/sopc_builder/bin/europa:/cygdrive/h/altera/10.0/quartus/sopc_builder/bin::/cygdrive/h/altera/10.0/quartus/sopc_builder/bin:/cygdrive/h/altera/10.0/quartus/sopc_builder/bin/europa:/cygdrive/h/altera/10.0/quartus/sopc_builder/bin/perl_lib -Is:/tools/perl/site-lib -I. -Ih:/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_pio -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_onchip_memory2 -Ih:/altera/10.0/quartus/../ip/altera/nios2_ip/altera_nios_custom_instr_interrupt_vector -Ih:/altera/10.0/quartus/../ip/altera/nios2_ip/altera_nios_custom_instruction -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_onchip_memory -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_mutex -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_burst_adapter -Ih:/altera/10.0/nios2eds/components/altera_plugs_library -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_cf -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_spi -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_user_defined_interface ......... -Ih:/altera/10.0/quartus/../ip/altera/sopc_builder_ip/altera_avalon_clock_crossing -Ih:/altera/10.0/quartus/../ip/altera/nios2_ip/altera_nios_dev_board_stratix_2s60 h:/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/object_scheduler.pl --system_name=nios_system --target_module_name=accelerator_hello_world_1_sqr --system_directory=H:/altera/design/TP_POP5/DE2_70_Basic_Computer --sopc_directory=h:/altera/10.0/quartus/sopc_builder --sopc_lib_path=H:\altera\90\ip\pci_express_compiler\lib\sopc_builder+H:\altera\90\ip\ddr3_high_perf\lib\sopc_builder+H:\altera\90\ip\ddr2_high_perf\lib\sopc_builder+H:\altera\90\ip\ddr_high_perf\lib\sopc_builder+H:\altera\90\ip\sopc_builder_ip+H:\altera\90\ip\nios2_ip+H:\altera\90\ip\triple_speed_ethernet\lib\sopc_builder+H:\altera\90\ip\pci_compiler\lib\sopc_builder+H:\altera\90\ip\ddr_ddr2_sdram\lib\sopc_builder+H:\altera\10.0\nios2eds\bin;+H:\altera\10.0\nios2eds\bin;+h:\altera\10.0\nios2eds++h:/altera/10.0/quartus/sopc_builder/components --generate=1 --verbose=0 --software_only=0 --module_lib_dir=h:/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator --sopc_quartus_dir=h:/altera/10.0/quartus --projectname=DE2_70_Basic_Computer' # 2010.12.26 13.26.39 (*) Starting generation for system: nios_system. . mv: cannot stat `H:/altera/design/TP_POP5/DE2_70_Basic_Computer/nios_system.ptf_c2h': No such file or directory # 2010.12.26 13.26.39 (*) Running Generator Program for accelerator_hello_world_1_sqr ../board_diag.c:71: PARSE ERROR, ../board_diag.c line 71 column 9 Error: Accelerator component generation failed. ERROR: C2H:0: C2H ERROR: "h:/altera/10.0/nios2eds/components/altera_avalon_c_hardware_accelerator/lex_and_yacc/c2h_cparse.exe" "H:/altera/design/TP_POP5/DE2_70_Basic_Computer/eclipse_ide2/hello_world_1/Release/obj/board_diag.c2h_pre" (256)?() at file: , line: Accelerator module generation failed. make: *** [c2h_hdl-t] Error 254 Build completed in 34.453 seconds I am Professor in university of PAris, If I cannot have any information, I think I will cancel my course on C2H and Altera Tools. Thanks for your Help !