├── src ├── FANN-2.2.0-Source │ ├── examples │ │ ├── data.mif │ │ ├── a.out │ │ ├── MIF_convert.class │ │ ├── .gitignore │ │ ├── scaling_test.c │ │ ├── scaling_train.c │ │ ├── simple_test.c │ │ ├── love_fixed.net │ │ ├── simple_train.c │ │ ├── momentums.c │ │ ├── robot.c │ │ ├── mushroom.c │ │ ├── love_float.net │ │ ├── love_test.c │ │ ├── love_test.cpp │ │ ├── MIF_convert.java │ │ ├── love_train.c │ │ ├── steepness_train.c │ │ └── cascade_train.c │ ├── src │ │ ├── libfann.dylib │ │ ├── libfann.2.dylib │ │ ├── libdoublefann.dylib │ │ ├── libfixedfann.dylib │ │ ├── libfloatfann.dylib │ │ ├── libdoublefann.2.dylib │ │ ├── libfixedfann.2.dylib │ │ ├── libfloatfann.2.dylib │ │ ├── libfann.2.2.0.dylib │ │ ├── libfixedfann.2.2.0.dylib │ │ ├── libfloatfann.2.2.0.dylib │ │ ├── libdoublefann.2.2.0.dylib │ │ ├── include │ │ │ ├── config.h │ │ │ ├── CMakeLists.txt │ │ │ ├── fixedfann.h │ │ │ ├── floatfann.h │ │ │ ├── doublefann.h │ │ │ ├── fann_io.h │ │ │ └── compat_time.h │ │ ├── doublefann.c │ │ ├── fixedfann.c │ │ ├── floatfann.c │ │ └── CMakeLists.txt │ ├── bin │ │ ├── .gitignore │ │ ├── xor.data │ │ ├── fanndouble.dll │ │ ├── fanndouble.lib │ │ ├── fannfixed.dll │ │ ├── fannfixed.lib │ │ ├── fannfloat.dll │ │ ├── fannfloat.lib │ │ ├── xor_train.exe │ │ ├── xor_test_fixed.exe │ │ ├── xor_test_float.exe │ │ ├── simple_train_double.exe │ │ └── simple_train_float.exe │ ├── cmake │ │ ├── config.h.cmake │ │ ├── fann.pc.cmake │ │ └── Modules │ │ │ └── DefineInstallationPaths.cmake │ ├── VS2010 │ │ ├── robot │ │ │ ├── robot.vcxproj.filters │ │ │ └── robot.vcxproj │ │ ├── momentums │ │ │ ├── momentums.vcxproj.filters │ │ │ └── momentums.vcxproj │ │ ├── mushroom │ │ │ ├── mushroom.vcxproj.filters │ │ │ └── mushroom.vcxproj │ │ ├── xor_train │ │ │ └── xor_train.vcxproj.filters │ │ ├── cascade_train │ │ │ ├── cascade_train.vcxproj.filters │ │ │ └── cascade_train.vcxproj │ │ ├── xor_test_fixed │ │ │ ├── xor_test_fixed.vcxproj.filters │ │ │ └── xor_test_fixed.vcxproj │ │ ├── xor_test_float │ │ │ └── xor_test_float.vcxproj.filters │ │ ├── scaling_test │ │ │ ├── scaling_test.vcxproj.filters │ │ │ └── scaling_test.vcxproj │ │ ├── scaling_train │ │ │ ├── scaling_train.vcxproj.filters │ │ │ └── scaling_train.vcxproj │ │ ├── simple_train_float │ │ │ └── simple_train_float.vcxproj.filters │ │ ├── xor_cpp_sample │ │ │ ├── xor_cpp_sample.vcxproj.filters │ │ │ └── xor_cpp_sample.vcxproj │ │ ├── simple_train_double │ │ │ ├── simple_train_double.vcxproj.filters │ │ │ └── simple_train_double.vcxproj │ │ ├── steepness_train │ │ │ ├── steepness_train.vcxproj.filters │ │ │ └── steepness_train.vcxproj │ │ ├── fannfixed │ │ │ └── fannfixed.filters │ │ ├── fannfloat │ │ │ └── fannfloat.vcxproj.filters │ │ └── fanndouble │ │ │ └── fanndouble.vcxproj.filters │ ├── fann.pc │ ├── .gitignore │ ├── CMakeLists.txt │ ├── README.txt │ ├── CPackConfig.cmake │ └── CPackSourceConfig.cmake ├── java │ ├── collaboration.txt │ ├── neuralFPGA │ │ ├── neuralComputer_description.txt │ │ ├── greybox_tmp │ │ │ ├── cbx_args.txt │ │ │ └── greybox_tmp │ │ │ │ └── mg90f.v │ │ ├── multiplier_16.qip │ │ ├── fixed_point_multiplier.sv │ │ ├── ChipInterface.sv │ │ ├── neuralComputer.qpf │ │ ├── SevenSegmentDigit.sv │ │ ├── multiplier_16.bsf │ │ ├── BCHtoSevenSegment.sv │ │ └── multiplier_16_bb.v │ ├── NN_music.class │ ├── MIF_convert.class │ ├── NN_education.class │ ├── music_dev_keys.txt │ ├── education_dev_keys.txt │ ├── music_dev.csv │ ├── education_dev.csv │ ├── MIF_convert.java~ │ ├── MIF_convert.java │ ├── music_train.csv │ ├── NN_education.java~ │ ├── love.java │ └── NN_education.java └── neuralFPGA │ ├── neuralComputer_description.txt │ ├── db │ ├── neuralComputer.sld_design_entry.sci │ └── neuralComputer.db_info │ ├── adder4_32.qip │ ├── romBlock.qip │ ├── greybox_tmp │ ├── cbx_args.txt │ └── greybox_tmp │ │ └── mg90f.v │ ├── fixed_point_multiplier.sv │ ├── multiplier_16.qip │ ├── multiplier_32.qip │ ├── sigmoid.sv │ ├── neuralComputer.qpf │ ├── SevenSegmentDigit.sv │ ├── datagen.py │ ├── multiplier_16.bsf │ ├── multiplier_32.bsf │ ├── BCHtoSevenSegment.sv │ ├── love_train.cpp │ ├── adder4_32_bb.v │ ├── multiplier_16_bb.v │ └── multiplier_32_bb.v ├── .gitignore └── LICENSE /src/FANN-2.2.0-Source/examples/data.mif: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/java/collaboration.txt: -------------------------------------------------------------------------------- 1 | 1.No 2 | 2.No 3 | -------------------------------------------------------------------------------- /src/neuralFPGA/neuralComputer_description.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/neuralComputer_description.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfann.dylib: -------------------------------------------------------------------------------- 1 | libfann.2.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfann.2.dylib: -------------------------------------------------------------------------------- 1 | libfann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.pdb 3 | *.exp 4 | *.ilk -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libdoublefann.dylib: -------------------------------------------------------------------------------- 1 | libdoublefann.2.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfixedfann.dylib: -------------------------------------------------------------------------------- 1 | libfixedfann.2.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfloatfann.dylib: -------------------------------------------------------------------------------- 1 | libfloatfann.2.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libdoublefann.2.dylib: -------------------------------------------------------------------------------- 1 | libdoublefann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfixedfann.2.dylib: -------------------------------------------------------------------------------- 1 | libfixedfann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfloatfann.2.dylib: -------------------------------------------------------------------------------- 1 | libfloatfann.2.2.0.dylib -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | #Quartus files 3 | db/ 4 | output_files/ 5 | incremental_db 6 | greybox_tmp 7 | -------------------------------------------------------------------------------- /src/java/NN_music.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/java/NN_music.class -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/xor.data: -------------------------------------------------------------------------------- 1 | 4 2 1 2 | -1 -1 3 | -1 4 | -1 1 5 | 1 6 | 1 -1 7 | 1 8 | 1 1 9 | -1 10 | -------------------------------------------------------------------------------- /src/java/MIF_convert.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/java/MIF_convert.class -------------------------------------------------------------------------------- /src/java/NN_education.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/java/NN_education.class -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/examples/a.out -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fanndouble.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fanndouble.dll -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fanndouble.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fanndouble.lib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fannfixed.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fannfixed.dll -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fannfixed.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fannfixed.lib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fannfloat.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fannfloat.dll -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/fannfloat.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/fannfloat.lib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/xor_train.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/xor_train.exe -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/xor_test_fixed.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/xor_test_fixed.exe -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/xor_test_float.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/xor_test_float.exe -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfann.2.2.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/src/libfann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/simple_train_double.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/simple_train_double.exe -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/bin/simple_train_float.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/bin/simple_train_float.exe -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/MIF_convert.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/examples/MIF_convert.class -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfixedfann.2.2.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/src/libfixedfann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libfloatfann.2.2.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/src/libfloatfann.2.2.0.dylib -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/libdoublefann.2.2.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/FANN-2.2.0-Source/src/libdoublefann.2.2.0.dylib -------------------------------------------------------------------------------- /src/neuralFPGA/db/neuralComputer.sld_design_entry.sci: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/darrinwillis/neuralHardware/HEAD/src/neuralFPGA/db/neuralComputer.sld_design_entry.sci -------------------------------------------------------------------------------- /src/neuralFPGA/db/neuralComputer.db_info: -------------------------------------------------------------------------------- 1 | Quartus_Version = Version 15.0.0 Build 145 04/22/2015 SJ Web Edition 2 | Version_Index = 369135872 3 | Creation_Time = Thu May 07 17:55:06 2015 4 | -------------------------------------------------------------------------------- /src/java/music_dev_keys.txt: -------------------------------------------------------------------------------- 1 | no 2 | no 3 | no 4 | yes 5 | no 6 | yes 7 | no 8 | yes 9 | no 10 | yes 11 | yes 12 | yes 13 | yes 14 | yes 15 | yes 16 | no 17 | yes 18 | no 19 | yes 20 | yes 21 | no 22 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/config.h: -------------------------------------------------------------------------------- 1 | /* Name of package */ 2 | /* #undef PACKAGE */ 3 | 4 | /* Version number of package */ 5 | #define VERSION "2.2.0" 6 | 7 | /* Define for the x86_64 CPU famyly */ 8 | /* #undef X86_64 */ 9 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/cmake/config.h.cmake: -------------------------------------------------------------------------------- 1 | /* Name of package */ 2 | #cmakedefine PACKAGE "@PACKAGE@" 3 | 4 | /* Version number of package */ 5 | #cmakedefine VERSION "@VERSION@" 6 | 7 | /* Define for the x86_64 CPU famyly */ 8 | #cmakedefine X86_64 "@X86_64@" 9 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/robot/robot.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/momentums/momentums.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/mushroom/mushroom.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_train/xor_train.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ########### install files ############### 2 | 3 | INSTALL_FILES( /include FILES fann.h doublefann.h fann_internal.h floatfann.h fann_data.h fixedfann.h compat_time.h fann_activation.h fann_cascade.h fann_error.h fann_train.h fann_io.h fann_cpp.h ) 4 | 5 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/fann.pc: -------------------------------------------------------------------------------- 1 | prefix=/usr/local 2 | exec_prefix=/usr/local/bin 3 | libdir=/usr/local/lib 4 | includedir=/usr/local/include 5 | 6 | Name: fann 7 | Description: Fast Artificial Neural Network Library 8 | Version: 2.2.0 9 | Libs: -L${libdir} -lm -lfann 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/cascade_train/cascade_train.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_test_fixed/xor_test_fixed.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_test_float/xor_test_float.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/greybox_tmp/cbx_args.txt: -------------------------------------------------------------------------------- 1 | MSW_SUBTRACT=NO 2 | PIPELINE=0 3 | REPRESENTATION=UNSIGNED 4 | RESULT_ALIGNMENT=LSB 5 | SHIFT=0 6 | SIZE=8 7 | WIDTH=8 8 | WIDTHR=11 9 | DEVICE_FAMILY="Cyclone IV E" 10 | data 11 | data 12 | data 13 | data 14 | data 15 | data 16 | data 17 | data 18 | result 19 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/scaling_test/scaling_test.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/scaling_train/scaling_train.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/simple_train_float/simple_train_float.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_cpp_sample/xor_cpp_sample.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/simple_train_double/simple_train_double.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/steepness_train/steepness_train.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/cmake/fann.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@BIN_INSTALL_DIR@ 3 | libdir=@LIB_INSTALL_DIR@ 4 | includedir=@INCLUDE_INSTALL_DIR@ 5 | 6 | Name: fann 7 | Description: Fast Artificial Neural Network Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lm -lfann 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/.gitignore: -------------------------------------------------------------------------------- 1 | cascade_train 2 | mushroom 3 | robot 4 | scaling_test 5 | scaling_train 6 | simple_test 7 | simple_train 8 | steepness_train 9 | xor_fixed.data 10 | xor_fixed.net 11 | xor_float.net 12 | xor_test 13 | xor_test_fixed 14 | xor_train 15 | cascade_train_debug 16 | xor_test_debug 17 | xor_test_fixed_debug 18 | xor_train_debug 19 | -------------------------------------------------------------------------------- /src/neuralFPGA/adder4_32.qip: -------------------------------------------------------------------------------- 1 | set_global_assignment -name IP_TOOL_NAME "PARALLEL_ADD" 2 | set_global_assignment -name IP_TOOL_VERSION "15.0" 3 | set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" 4 | set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "adder4_32.v"] 5 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "adder4_32_bb.v"] 6 | -------------------------------------------------------------------------------- /src/neuralFPGA/romBlock.qip: -------------------------------------------------------------------------------- 1 | set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT" 2 | set_global_assignment -name IP_TOOL_VERSION "15.0" 3 | set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" 4 | set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "romBlock.v"] 5 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "romBlock_bb.v"] 6 | -------------------------------------------------------------------------------- /src/neuralFPGA/greybox_tmp/cbx_args.txt: -------------------------------------------------------------------------------- 1 | ADDRESS_ACLR_A=NONE 2 | CLOCK_ENABLE_INPUT_A=BYPASS 3 | CLOCK_ENABLE_OUTPUT_A=BYPASS 4 | INIT_FILE= 5 | INTENDED_DEVICE_FAMILY="Cyclone IV E" 6 | NUMWORDS_A=1041 7 | OPERATION_MODE=ROM 8 | OUTDATA_ACLR_A=NONE 9 | OUTDATA_REG_A=CLOCK0 10 | WIDTHAD_A=11 11 | WIDTH_A=32 12 | WIDTH_BYTEENA_A=1 13 | DEVICE_FAMILY="Cyclone IV E" 14 | address_a 15 | clock0 16 | q_a 17 | -------------------------------------------------------------------------------- /src/neuralFPGA/fixed_point_multiplier.sv: -------------------------------------------------------------------------------- 1 | module fixed_point_multiplier ( 2 | input bit[31:0] dataa, datab, 3 | output bit[31:0] result); 4 | 5 | bit[63:0] rawResult; 6 | 7 | multiplier_32 int1int2( 8 | .dataa(dataa), 9 | .datab(datab), 10 | .result(rawResult)); 11 | 12 | 13 | // Shift over all bits appropriately and add 14 | 15 | assign result = rawResult[47:16]; 16 | 17 | endmodule: fixed_point_multiplier -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_16.qip: -------------------------------------------------------------------------------- 1 | set_global_assignment -name IP_TOOL_NAME "LPM_MULT" 2 | set_global_assignment -name IP_TOOL_VERSION "15.0" 3 | set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" 4 | set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "multiplier_16.v"] 5 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_16.bsf"] 6 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_16_bb.v"] 7 | -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_32.qip: -------------------------------------------------------------------------------- 1 | set_global_assignment -name IP_TOOL_NAME "LPM_MULT" 2 | set_global_assignment -name IP_TOOL_VERSION "15.0" 3 | set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" 4 | set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "multiplier_32.v"] 5 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_32.bsf"] 6 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_32_bb.v"] 7 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/multiplier_16.qip: -------------------------------------------------------------------------------- 1 | set_global_assignment -name IP_TOOL_NAME "LPM_MULT" 2 | set_global_assignment -name IP_TOOL_VERSION "15.0" 3 | set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}" 4 | set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "multiplier_16.v"] 5 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_16.bsf"] 6 | set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "multiplier_16_bb.v"] 7 | -------------------------------------------------------------------------------- /src/java/education_dev_keys.txt: -------------------------------------------------------------------------------- 1 | 43.0 2 | 34.0 3 | 26.0 4 | 43.0 5 | 22.0 6 | 47.0 7 | 44.0 8 | 72.0 9 | 58.0 10 | 78.0 11 | 13.0 12 | 31.0 13 | 47.0 14 | 35.0 15 | 49.0 16 | 74.0 17 | 46.0 18 | 33.0 19 | 58.0 20 | 43.0 21 | 72.0 22 | 39.0 23 | 64.0 24 | 61.0 25 | 43.0 26 | 41.0 27 | 62.0 28 | 51.0 29 | 47.0 30 | 78.0 31 | 49.0 32 | 32.0 33 | 66.0 34 | 48.0 35 | 32.0 36 | 35.0 37 | 47.0 38 | 58.0 39 | 33.0 40 | 58.0 41 | 63.0 42 | 40.0 43 | 40.0 44 | 57.0 45 | 20.0 46 | 64.0 47 | 55.0 48 | 36.0 49 | 19.0 50 | 62.0 51 | -------------------------------------------------------------------------------- /src/java/music_dev.csv: -------------------------------------------------------------------------------- 1 | Year,Length,Jazz,Rock 2 | 1960.0,6.22,yes,no 3 | 1987.0,6.17,yes,no 4 | 1979.0,6.91,yes,no 5 | 1956.0,6.69,yes,yes 6 | 1932.0,5.30,no,yes 7 | 1964.0,5.83,yes,yes 8 | 1954.0,6.90,yes,no 9 | 1998.0,4.59,no,no 10 | 1974.0,4.03,yes,no 11 | 1951.0,5.64,no,yes 12 | 1946.0,4.85,yes,no 13 | 1915.0,5.97,yes,no 14 | 1911.0,5.83,yes,no 15 | 1971.0,6.99,yes,yes 16 | 1981.0,4.86,yes,yes 17 | 1942.0,5.85,no,yes 18 | 1958.0,4.42,yes,no 19 | 1983.0,5.43,yes,no 20 | 1907.0,6.91,yes,no 21 | 1918.0,6.34,yes,no 22 | 1984.0,6.72,no,no 23 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/.gitignore: -------------------------------------------------------------------------------- 1 | *.sdf 2 | *.suo 3 | *.user 4 | *.opensdf 5 | ipch 6 | Debug 7 | Release 8 | /bin/fanndoubled.dll 9 | /bin/fanndoubled.lib 10 | /bin/fannfixedd.dll 11 | /bin/fannfixedd.lib 12 | /bin/fannfloatd.dll 13 | /bin/fannfloatd.lib 14 | /bin/simple_train_doubled.exe 15 | /bin/simple_train_floatd.exe 16 | /bin/xor_test_fixedd.exe 17 | /bin/xor_test_floatd.exe 18 | /bin/xor_traind.exe 19 | Makefile 20 | CMakeFiles 21 | CMakeCache.txt 22 | cmake_install.cmake 23 | install_manifest.txt 24 | *~ 25 | /bin/cascade_traind.exe 26 | /bin/momentumsd.exe 27 | /bin/mushroomd.exe 28 | /bin/robotd.exe 29 | /bin/scaling_testd.exe 30 | /bin/scaling_traind.exe 31 | /bin/steepness_traind.exe 32 | /bin/xor_cpp_sampled.exe -------------------------------------------------------------------------------- /src/java/neuralFPGA/fixed_point_multiplier.sv: -------------------------------------------------------------------------------- 1 | 2 | module fixed_point_multiplier ( 3 | input bit[31:0] dataa, datab, 4 | output bit[31:0] result); 5 | 6 | bit[15:0] intA, fracA, intB, fracB; 7 | bit[31:0] iAiB, iAfB, fAiB, fAfB; 8 | 9 | assign intA = dataa[31:16]; 10 | assign fracA = {dataa[31], dataa[15:1]}; 11 | assign intB = datab[31:16]; 12 | assign fracB = {datab[31], datab[15:1]}; 13 | 14 | multiplier_16 int1int2( 15 | .dataa(intA), 16 | .datab(intB), 17 | .result(iAiB)); 18 | 19 | multiplier_16 int1frac2( 20 | .dataa(intA), 21 | .datab(fracB), 22 | .result(iAfB)); 23 | 24 | multiplier_16 frac1int2( 25 | .dataa(fracA), 26 | .datab(intB), 27 | .result(fAiB)); 28 | 29 | multiplier_16 frac1frac2( 30 | .dataa(fracA), 31 | .datab(fracB), 32 | .result(fAfB)); 33 | 34 | // Shift over all bits appropriately and add 35 | 36 | assign result = {iAiB, 16'd0} + 37 | iAfB + 38 | fAiB + 39 | {fAfB[31] ? 16'hffff : 16'h0000, fAfB[30:15]}; 40 | 41 | endmodule: fixed_point_multiplier -------------------------------------------------------------------------------- /src/neuralFPGA/sigmoid.sv: -------------------------------------------------------------------------------- 1 | module sigmoid ( 2 | input bit[31:0] data, 3 | output bit[31:0] result); 4 | 5 | bit[31:0] abs_data, mult_val, add_val, mult_result, lin_result; 6 | 7 | assign abs_data = data[31] ? (~data + 1) : data; 8 | 9 | assign mult_val = (abs_data < 32'h0001_0000) ? 32'h0000_4000 : // 0.25 10 | (abs_data < 32'h0002_6000) ? 32'h0000_2000 : // 0.125 11 | (abs_data < 32'h0005_0000) ? 32'h0000_0800 : // 0.03125 12 | 32'h0000_0000; // 0.0 13 | assign add_val = (abs_data < 32'h0001_0000) ? 32'h0000_8000 : // 0.5 14 | (abs_data < 32'h0002_6000) ? 32'h0000_A000 : // 0.625 15 | (abs_data < 32'h0005_0000) ? 32'h0000_0800 : // 0.84375 16 | 32'h0001_0000; // 1.0 17 | 18 | fixed_point_multiplier fpm( 19 | .dataa(data), 20 | .datab(mult_val), 21 | .result(mult_result)); 22 | 23 | // Shift over all bits appropriately and add 24 | 25 | assign lin_result = mult_result + add_val; 26 | 27 | assign result = (data < 32'd0) ? 1 - lin_result : lin_result; 28 | 29 | endmodule: sigmoid -------------------------------------------------------------------------------- /src/java/neuralFPGA/ChipInterface.sv: -------------------------------------------------------------------------------- 1 | module ChipInterface 2 | (input logic CLOCK_50, 3 | input logic[9:0] SW, 4 | input logic[2:0] KEY, 5 | output logic[6:0] HEX7, HEX6 ,HEX5, HEX4, HEX3, HEX2, HEX1, HEX0); 6 | 7 | SimpleTest st( 8 | .clk(CLOCK_50), 9 | .sw(SW), 10 | .key(KEY), 11 | .hexDisplays({HEX7, HEX6 ,HEX5, HEX4, HEX3, HEX2, HEX1, HEX0})); 12 | 13 | endmodule: ChipInterface 14 | 15 | module SimpleTest 16 | (input bit clk, 17 | input bit[9:0] sw, 18 | input bit[2:0] key, 19 | output bit [7:0][6:0] hexDisplays); 20 | 21 | bit [7:0][3:0] values; 22 | assign values = {4'd1, 4'd2, 4'd3, 4'd4, 4'd5, 4'd6, 4'd7, 4'd8}; 23 | 24 | //Generate the seven segment display 25 | genvar k; 26 | generate 27 | for (k = 0; k < 8; k=k+1) begin : SEV_SEG 28 | SevenSegmentDigit ssd( 29 | .bch(values[k]), 30 | .segment(hexDisplays[k]), 31 | .blank(1'b0)); 32 | end 33 | endgenerate 34 | 35 | endmodule: SimpleTest -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/scaling_test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "fann.h" 3 | 4 | int main( int argc, char** argv ) 5 | { 6 | fann_type *calc_out; 7 | unsigned int i; 8 | int ret = 0; 9 | struct fann *ann; 10 | struct fann_train_data *data; 11 | printf("Creating network.\n"); 12 | ann = fann_create_from_file("scaling.net"); 13 | if(!ann) 14 | { 15 | printf("Error creating ann --- ABORTING.\n"); 16 | return 0; 17 | } 18 | fann_print_connections(ann); 19 | fann_print_parameters(ann); 20 | printf("Testing network.\n"); 21 | data = fann_read_train_from_file("../datasets/scaling.data"); 22 | for(i = 0; i < fann_length_train_data(data); i++) 23 | { 24 | fann_reset_MSE(ann); 25 | fann_scale_input( ann, data->input[i] ); 26 | calc_out = fann_run( ann, data->input[i] ); 27 | fann_descale_output( ann, calc_out ); 28 | printf("Result %f original %f error %f\n", 29 | calc_out[0], data->output[i][0], 30 | (float) fann_abs(calc_out[0] - data->output[i][0])); 31 | } 32 | printf("Cleaning up.\n"); 33 | fann_destroy_train(data); 34 | fann_destroy(ann); 35 | return ret; 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 darrinwillis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/fixedfann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __fixedfann_h__ 21 | #define __fixedfann_h__ 22 | 23 | typedef int fann_type; 24 | 25 | #undef FIXEDFANN 26 | #define FIXEDFANN 27 | #define FANNPRINTF "%d" 28 | #define FANNSCANF "%d" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/floatfann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __floatfann_h__ 21 | #define __floatfann_h__ 22 | 23 | typedef float fann_type; 24 | 25 | #undef FLOATFANN 26 | #define FLOATFANN 27 | #define FANNPRINTF "%.20e" 28 | #define FANNSCANF "%f" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/doublefann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __doublefann_h__ 21 | #define __doublefann_h__ 22 | 23 | typedef double fann_type; 24 | 25 | #undef DOUBLEFANN 26 | #define DOUBLEFANN 27 | #define FANNPRINTF "%.20e" 28 | #define FANNSCANF "%le" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/doublefann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "doublefann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/fixedfann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "fixedfann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/floatfann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "floatfann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/scaling_train.c: -------------------------------------------------------------------------------- 1 | #include "fann.h" 2 | 3 | int main( int argc, char** argv ) 4 | { 5 | const unsigned int num_input = 3; 6 | const unsigned int num_output = 1; 7 | const unsigned int num_layers = 4; 8 | const unsigned int num_neurons_hidden = 5; 9 | const float desired_error = (const float) 0.0001; 10 | const unsigned int max_epochs = 5000; 11 | const unsigned int epochs_between_reports = 1000; 12 | struct fann_train_data * data = NULL; 13 | struct fann *ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_neurons_hidden, num_output); 14 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 15 | fann_set_activation_function_output(ann, FANN_LINEAR); 16 | fann_set_training_algorithm(ann, FANN_TRAIN_RPROP); 17 | data = fann_read_train_from_file("../datasets/scaling.data"); 18 | fann_set_scaling_params( 19 | ann, 20 | data, 21 | -1, /* New input minimum */ 22 | 1, /* New input maximum */ 23 | -1, /* New output minimum */ 24 | 1); /* New output maximum */ 25 | 26 | fann_scale_train( ann, data ); 27 | 28 | fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error); 29 | fann_destroy_train( data ); 30 | fann_save(ann, "scaling.net"); 31 | fann_destroy(ann); 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/simple_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | #include "floatfann.h" 22 | 23 | int main() 24 | { 25 | fann_type *calc_out; 26 | fann_type input[2]; 27 | 28 | struct fann *ann = fann_create_from_file("xor_float.net"); 29 | 30 | input[0] = -1; 31 | input[1] = 1; 32 | calc_out = fann_run(ann, input); 33 | 34 | printf("xor test (%f,%f) -> %f\n", input[0], input[1], calc_out[0]); 35 | 36 | fann_destroy(ann); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /src/neuralFPGA/neuralComputer.qpf: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- # 2 | # 3 | # Copyright (C) 1991-2012 Altera Corporation 4 | # Your use of Altera Corporation's design tools, logic functions 5 | # and other software and tools, and its AMPP partner logic 6 | # functions, and any output files from any of the foregoing 7 | # (including device programming or simulation files), and any 8 | # associated documentation or information are expressly subject 9 | # to the terms and conditions of the Altera Program License 10 | # Subscription Agreement, Altera MegaCore Function License 11 | # Agreement, or other applicable license agreement, including, 12 | # without limitation, that your use is for the sole purpose of 13 | # programming logic devices manufactured by Altera and sold by 14 | # Altera or its authorized distributors. Please refer to the 15 | # applicable agreement for further details. 16 | # 17 | # -------------------------------------------------------------------------- # 18 | # 19 | # Quartus II 64-Bit 20 | # Version 12.1 Build 177 11/07/2012 SJ Web Edition 21 | # Date created = 15:18:26 May 04, 2015 22 | # 23 | # -------------------------------------------------------------------------- # 24 | 25 | QUARTUS_VERSION = "12.1" 26 | DATE = "15:18:26 May 04, 2015" 27 | 28 | # Revisions 29 | 30 | PROJECT_REVISION = "neuralComputer" 31 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/neuralComputer.qpf: -------------------------------------------------------------------------------- 1 | # -------------------------------------------------------------------------- # 2 | # 3 | # Copyright (C) 1991-2012 Altera Corporation 4 | # Your use of Altera Corporation's design tools, logic functions 5 | # and other software and tools, and its AMPP partner logic 6 | # functions, and any output files from any of the foregoing 7 | # (including device programming or simulation files), and any 8 | # associated documentation or information are expressly subject 9 | # to the terms and conditions of the Altera Program License 10 | # Subscription Agreement, Altera MegaCore Function License 11 | # Agreement, or other applicable license agreement, including, 12 | # without limitation, that your use is for the sole purpose of 13 | # programming logic devices manufactured by Altera and sold by 14 | # Altera or its authorized distributors. Please refer to the 15 | # applicable agreement for further details. 16 | # 17 | # -------------------------------------------------------------------------- # 18 | # 19 | # Quartus II 64-Bit 20 | # Version 12.1 Build 177 11/07/2012 SJ Web Edition 21 | # Date created = 15:18:26 May 04, 2015 22 | # 23 | # -------------------------------------------------------------------------- # 24 | 25 | QUARTUS_VERSION = "12.1" 26 | DATE = "15:18:26 May 04, 2015" 27 | 28 | # Revisions 29 | 30 | PROJECT_REVISION = "neuralComputer" 31 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY( include ) 2 | 3 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include) 4 | ADD_DEFINITIONS(-D_REENTRANT) 5 | ########### next target ############### 6 | 7 | SET(floatfann_LIB_SRCS 8 | floatfann.c 9 | ) 10 | 11 | ADD_LIBRARY(floatfann SHARED ${floatfann_LIB_SRCS}) 12 | 13 | SET_TARGET_PROPERTIES(floatfann PROPERTIES VERSION ${VERSION} SOVERSION 2 ) 14 | INSTALL(TARGETS floatfann DESTINATION ${LIB_INSTALL_DIR} ) 15 | 16 | 17 | ########### next target ############### 18 | 19 | SET(doublefann_LIB_SRCS 20 | doublefann.c 21 | ) 22 | 23 | ADD_LIBRARY(doublefann SHARED ${doublefann_LIB_SRCS}) 24 | 25 | SET_TARGET_PROPERTIES(doublefann PROPERTIES VERSION ${VERSION} SOVERSION 2 ) 26 | INSTALL(TARGETS doublefann DESTINATION ${LIB_INSTALL_DIR} ) 27 | 28 | 29 | ########### next target ############### 30 | 31 | SET(fixedfann_LIB_SRCS 32 | fixedfann.c 33 | ) 34 | 35 | ADD_LIBRARY(fixedfann SHARED ${fixedfann_LIB_SRCS}) 36 | 37 | SET_TARGET_PROPERTIES(fixedfann PROPERTIES VERSION ${VERSION} SOVERSION 2 ) 38 | INSTALL(TARGETS fixedfann DESTINATION ${LIB_INSTALL_DIR} ) 39 | 40 | 41 | ########### next target ############### 42 | 43 | SET(fann_LIB_SRCS 44 | floatfann.c 45 | ) 46 | 47 | ADD_LIBRARY(fann SHARED ${fann_LIB_SRCS}) 48 | 49 | SET_TARGET_PROPERTIES(fann PROPERTIES VERSION ${VERSION} SOVERSION 2 ) 50 | INSTALL(TARGETS fann DESTINATION ${LIB_INSTALL_DIR} ) 51 | 52 | -------------------------------------------------------------------------------- /src/java/education_dev.csv: -------------------------------------------------------------------------------- 1 | M1,M2,P1,P2,F 2 | 5.0,24.0,2.0,25.0,83.0 3 | 43.0,48.0,12.0,85.0,7.0 4 | 49.0,24.0,25.0,15.0,28.0 5 | 51.0,18.0,71.0,56.0,40.0 6 | 31.0,14.0,50.0,13.0,22.0 7 | 23.0,67.0,68.0,87.0,19.0 8 | 89.0,22.0,56.0,31.0,49.0 9 | 20.0,41.0,74.0,98.0,89.0 10 | 53.0,23.0,94.0,43.0,77.0 11 | 46.0,81.0,51.0,93.0,85.0 12 | 50.0,18.0,9.0,14.0,2.0 13 | 10.0,91.0,29.0,15.0,17.0 14 | 19.0,63.0,28.0,55.0,48.0 15 | 29.0,97.0,17.0,56.0,1.0 16 | 73.0,95.0,80.0,38.0,19.0 17 | 46.0,82.0,19.0,86.0,86.0 18 | 62.0,12.0,28.0,15.0,79.0 19 | 67.0,10.0,29.0,11.0,50.0 20 | 22.0,59.0,60.0,39.0,76.0 21 | 13.0,95.0,96.0,2.0,32.0 22 | 56.0,93.0,76.0,33.0,85.0 23 | 15.0,41.0,73.0,31.0,41.0 24 | 72.0,96.0,42.0,29.0,69.0 25 | 94.0,86.0,85.0,85.0,24.0 26 | 41.0,61.0,81.0,5.0,46.0 27 | 28.0,57.0,39.0,95.0,12.0 28 | 39.0,68.0,46.0,68.0,67.0 29 | 53.0,28.0,50.0,54.0,62.0 30 | 61.0,18.0,12.0,89.0,47.0 31 | 29.0,90.0,67.0,60.0,98.0 32 | 65.0,32.0,85.0,22.0,59.0 33 | 23.0,23.0,12.0,53.0,35.0 34 | 25.0,80.0,28.0,56.0,85.0 35 | 3.0,11.0,63.0,46.0,76.0 36 | 59.0,67.0,21.0,11.0,23.0 37 | 51.0,66.0,18.0,26.0,26.0 38 | 82.0,56.0,15.0,17.0,58.0 39 | 2.0,55.0,29.0,55.0,84.0 40 | 95.0,41.0,9.0,32.0,21.0 41 | 83.0,98.0,75.0,59.0,28.0 42 | 24.0,59.0,83.0,77.0,64.0 43 | 29.0,96.0,13.0,45.0,19.0 44 | 54.0,69.0,77.0,25.0,22.0 45 | 80.0,65.0,63.0,68.0,42.0 46 | 39.0,7.0,49.0,8.0,22.0 47 | 89.0,93.0,85.0,20.0,61.0 48 | 66.0,28.0,76.0,54.0,62.0 49 | 85.0,12.0,71.0,34.0,30.0 50 | 54.0,24.0,8.0,25.0,9.0 51 | 47.0,33.0,83.0,62.0,77.0 52 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/love_fixed.net: -------------------------------------------------------------------------------- 1 | FANN_FIX_2.0 2 | decimal_point=13 3 | num_layers=3 4 | learning_rate=0.700000 5 | connection_rate=1.000000 6 | network_type=0 7 | learning_momentum=0.000000 8 | training_algorithm=1 9 | train_error_function=1 10 | train_stop_function=1 11 | cascade_output_change_fraction=0.010000 12 | quickprop_decay=-0.000100 13 | quickprop_mu=1.750000 14 | rprop_increase_factor=1.200000 15 | rprop_decrease_factor=0.500000 16 | rprop_delta_min=0.000000 17 | rprop_delta_max=50.000000 18 | rprop_delta_zero=0.100000 19 | cascade_output_stagnation_epochs=12 20 | cascade_candidate_change_fraction=0.010000 21 | cascade_candidate_stagnation_epochs=12 22 | cascade_max_out_epochs=150 23 | cascade_min_out_epochs=50 24 | cascade_max_cand_epochs=150 25 | cascade_min_cand_epochs=50 26 | cascade_num_candidate_groups=2 27 | bit_fail_limit=82 28 | cascade_candidate_limit=8192000 29 | cascade_weight_multiplier=3277 30 | cascade_activation_functions_count=10 31 | cascade_activation_functions=3 5 7 8 10 11 14 15 16 17 32 | cascade_activation_steepnesses_count=4 33 | cascade_activation_steepnesses=2048 4096 6144 8192 34 | layer_sizes=5 5 2 35 | neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0, 0) (0, 0, 0) (5, 5, 8192) (5, 5, 8192) (5, 5, 8192) (5, 5, 8192) (0, 5, 8192) (5, 5, 8192) (0, 5, 8192) 36 | connections (connected_to_neuron, weight)=(0, 4490) (1, 7190) (2, 9734) (3, 9019) (4, 9883) (0, 9178) (1, 8143) (2, 4403) (3, 3832) (4, -11718) (0, 2796) (1, 4641) (2, 5837) (3, 7368) (4, -9678) (0, 2301) (1, 4137) (2, 3455) (3, 3806) (4, -8205) (5, 11325) (6, 4162) (7, 10720) (8, 3018) (9, -3136) 37 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/simple_train.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "fann.h" 21 | 22 | int main() 23 | { 24 | const unsigned int num_input = 2; 25 | const unsigned int num_output = 1; 26 | const unsigned int num_layers = 3; 27 | const unsigned int num_neurons_hidden = 3; 28 | const float desired_error = (const float) 0.001; 29 | const unsigned int max_epochs = 500000; 30 | const unsigned int epochs_between_reports = 1000; 31 | 32 | struct fann *ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_output); 33 | 34 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 35 | fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); 36 | 37 | fann_train_on_file(ann, "love.data", max_epochs, epochs_between_reports, desired_error); 38 | 39 | fann_save(ann, "xor_float.net"); 40 | 41 | fann_destroy(ann); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /src/neuralFPGA/SevenSegmentDigit.sv: -------------------------------------------------------------------------------- 1 | module SevenSegmentDigit 2 | (input logic [3:0] bch, 3 | output logic [6:0] segment, 4 | input logic blank); 5 | 6 | logic [6:0] decoded; 7 | 8 | BCHtoSevenSegment b2ss(bch, decoded); 9 | 10 | assign segment = blank ? 7'b1111111 : decoded; 11 | 12 | endmodule: SevenSegmentDigit 13 | 14 | module SevenSegmentDigitTestBench 15 | (output logic [3:0] bch, 16 | input logic [6:0] segment, 17 | output logic blank); 18 | 19 | initial begin 20 | $display("Starting tests for SevenSegmentDigit"); 21 | bch = 4'd0; 22 | blank = 0; 23 | #10 if (segment != 7'b1000000) 24 | $display("incorrect output at input 0, not blank"); 25 | 26 | bch = 4'd0; 27 | blank = 1; 28 | #10 if (segment != 7'b1111111) 29 | $display("incorrect output at input 0, blank"); 30 | 31 | bch = 4'd5; 32 | blank = 0; 33 | #10 if (segment != 7'b0010010) 34 | $display("incorrect output at input 5, not blank"); 35 | 36 | bch = 4'd5; 37 | blank = 1; 38 | #10 if (segment != 7'b1111111) 39 | $display("incorrect output at input 5, blank"); 40 | 41 | bch = 4'd8; 42 | blank = 0; 43 | #10 if (segment != 7'b0000000) 44 | $display("incorrect output at input 8, not blank"); 45 | 46 | bch = 4'd8; 47 | blank = 1; 48 | #10 if (segment != 7'b1111111) 49 | $display("incorrect output at input 8, blank"); 50 | $display("Finished tests for SevenSegmentDigit"); 51 | end 52 | endmodule: SevenSegmentDigitTestBench 53 | 54 | module ssdtop; 55 | logic [3:0] bch; 56 | logic [6:0] segment; 57 | logic blank; 58 | 59 | SevenSegmentDigit(.*); 60 | SevenSegmentDigitTestBench(.*); 61 | 62 | endmodule: ssdtop 63 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/SevenSegmentDigit.sv: -------------------------------------------------------------------------------- 1 | module SevenSegmentDigit 2 | (input logic [3:0] bch, 3 | output logic [6:0] segment, 4 | input logic blank); 5 | 6 | logic [6:0] decoded; 7 | 8 | BCHtoSevenSegment b2ss(bch, decoded); 9 | 10 | assign segment = blank ? 7'b1111111 : decoded; 11 | 12 | endmodule: SevenSegmentDigit 13 | 14 | module SevenSegmentDigitTestBench 15 | (output logic [3:0] bch, 16 | input logic [6:0] segment, 17 | output logic blank); 18 | 19 | initial begin 20 | $display("Starting tests for SevenSegmentDigit"); 21 | bch = 4'd0; 22 | blank = 0; 23 | #10 if (segment != 7'b1000000) 24 | $display("incorrect output at input 0, not blank"); 25 | 26 | bch = 4'd0; 27 | blank = 1; 28 | #10 if (segment != 7'b1111111) 29 | $display("incorrect output at input 0, blank"); 30 | 31 | bch = 4'd5; 32 | blank = 0; 33 | #10 if (segment != 7'b0010010) 34 | $display("incorrect output at input 5, not blank"); 35 | 36 | bch = 4'd5; 37 | blank = 1; 38 | #10 if (segment != 7'b1111111) 39 | $display("incorrect output at input 5, blank"); 40 | 41 | bch = 4'd8; 42 | blank = 0; 43 | #10 if (segment != 7'b0000000) 44 | $display("incorrect output at input 8, not blank"); 45 | 46 | bch = 4'd8; 47 | blank = 1; 48 | #10 if (segment != 7'b1111111) 49 | $display("incorrect output at input 8, blank"); 50 | $display("Finished tests for SevenSegmentDigit"); 51 | end 52 | endmodule: SevenSegmentDigitTestBench 53 | 54 | module ssdtop; 55 | logic [3:0] bch; 56 | logic [6:0] segment; 57 | logic blank; 58 | 59 | SevenSegmentDigit(.*); 60 | SevenSegmentDigitTestBench(.*); 61 | 62 | endmodule: ssdtop 63 | -------------------------------------------------------------------------------- /src/java/MIF_convert.java~: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class MIF_convert { 5 | public static void main(String[] args) throws Exception{ 6 | BufferedReader test = new BufferedReader(new FileReader(args[0])); 7 | String line = test.readLine(); 8 | List lines = new ArrayList(); 9 | 10 | PrintWriter writer = new PrintWriter("data.mif", "UTF-8"); 11 | writer.println("DEPTH = 4096;"); 12 | writer.println("WIDTH = 8;"); 13 | writer.println("ADDRESS_RADIX = HEX;"); 14 | writer.println("DATA_RADIX = HEX;"); 15 | writer.println(); 16 | writer.println("CONTENT BEGIN"); 17 | writer.println(); 18 | 19 | int size = 0; 20 | line = test.readLine(); 21 | while(line != null) { 22 | String[] words = line.split(","); 23 | if (size == 0) 24 | System.out.println("Training data has " + words.length - 1 + " inputs and 1 output"); 25 | double[] vals = new double[words.length]; 26 | for(int i = 0; i < words.length; i ++) { 27 | String val = 28 | String.format("%02X", (int)Double.parseDouble(words[i])).toLowerCase(); 29 | String index = String.format("%03X", size).toLowerCase(); 30 | writer.println(index + " : " + val + ";"); 31 | size++; 32 | } 33 | line = test.readLine(); 34 | } 35 | 36 | String index = String.format("%03X", size).toLowerCase(); 37 | System.out.println("Testing data starts at " + index); 38 | test = new BufferedReader(new FileReader(args[1])); 39 | line = test.readLine(); 40 | line = test.readLine(); 41 | while(line != null) { 42 | String[] words = line.split(","); 43 | double[] vals = new double[words.length]; 44 | for(int i = 0; i < words.length; i ++) { 45 | String val = 46 | String.format("%02X", (int)Double.parseDouble(words[i])).toLowerCase(); 47 | index = String.format("%03X", size).toLowerCase(); 48 | writer.println(index + " : " + val + ";"); 49 | size++; 50 | } 51 | line = test.readLine(); 52 | } 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/momentums.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | int main() 25 | { 26 | const unsigned int num_layers = 3; 27 | const unsigned int num_neurons_hidden = 96; 28 | const float desired_error = (const float) 0.001; 29 | struct fann *ann; 30 | struct fann_train_data *train_data, *test_data; 31 | 32 | float momentum; 33 | 34 | train_data = fann_read_train_from_file("../datasets/robot.train"); 35 | test_data = fann_read_train_from_file("../datasets/robot.test"); 36 | 37 | for ( momentum = 0.0f; momentum < 0.7f; momentum += 0.1f ) 38 | { 39 | printf("============= momentum = %f =============\n", momentum); 40 | 41 | ann = fann_create_standard(num_layers, 42 | train_data->num_input, num_neurons_hidden, train_data->num_output); 43 | 44 | fann_set_training_algorithm(ann, FANN_TRAIN_INCREMENTAL); 45 | 46 | fann_set_learning_momentum(ann, momentum); 47 | 48 | fann_train_on_data(ann, train_data, 2000, 500, desired_error); 49 | 50 | printf("MSE error on train data: %f\n", fann_test_data(ann, train_data)); 51 | printf("MSE error on test data : %f\n", fann_test_data(ann, test_data)); 52 | 53 | fann_destroy(ann); 54 | } 55 | 56 | fann_destroy_train(train_data); 57 | fann_destroy_train(test_data); 58 | return 0; 59 | } 60 | -------------------------------------------------------------------------------- /src/neuralFPGA/greybox_tmp/greybox_tmp/mg90f.v: -------------------------------------------------------------------------------- 1 | //parallel_add CBX_SINGLE_OUTPUT_FILE="ON" MSW_SUBTRACT="NO" PIPELINE=0 REPRESENTATION="UNSIGNED" RESULT_ALIGNMENT="LSB" SHIFT=0 SIZE=8 WIDTH=8 WIDTHR=11 data result 2 | //VERSION_BEGIN 15.0 cbx_mgl 2015:04:22:18:06:50:SJ cbx_stratixii 2015:04:22:18:04:08:SJ cbx_util_mgl 2015:04:22:18:04:08:SJ VERSION_END 3 | // synthesis VERILOG_INPUT_VERSION VERILOG_2001 4 | // altera message_off 10463 5 | 6 | 7 | 8 | // Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 9 | // Your use of Altera Corporation's design tools, logic functions 10 | // and other software and tools, and its AMPP partner logic 11 | // functions, and any output files from any of the foregoing 12 | // (including device programming or simulation files), and any 13 | // associated documentation or information are expressly subject 14 | // to the terms and conditions of the Altera Program License 15 | // Subscription Agreement, the Altera Quartus II License Agreement, 16 | // the Altera MegaCore Function License Agreement, or other 17 | // applicable license agreement, including, without limitation, 18 | // that your use is for the sole purpose of programming logic 19 | // devices manufactured by Altera and sold by Altera or its 20 | // authorized distributors. Please refer to the applicable 21 | // agreement for further details. 22 | 23 | 24 | 25 | //synthesis_resources = parallel_add 1 26 | //synopsys translate_off 27 | `timescale 1 ps / 1 ps 28 | //synopsys translate_on 29 | module mg90f 30 | ( 31 | data, 32 | result) /* synthesis synthesis_clearbox=1 */; 33 | input [63:0] data; 34 | output [10:0] result; 35 | 36 | wire [10:0] wire_mgl_prim1_result; 37 | 38 | parallel_add mgl_prim1 39 | ( 40 | .data(data), 41 | .result(wire_mgl_prim1_result)); 42 | defparam 43 | mgl_prim1.msw_subtract = "NO", 44 | mgl_prim1.pipeline = 0, 45 | mgl_prim1.representation = "UNSIGNED", 46 | mgl_prim1.result_alignment = "LSB", 47 | mgl_prim1.shift = 0, 48 | mgl_prim1.size = 8, 49 | mgl_prim1.width = 8, 50 | mgl_prim1.widthr = 11; 51 | assign 52 | result = wire_mgl_prim1_result; 53 | endmodule //mg90f 54 | //VALID FILE 55 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/greybox_tmp/greybox_tmp/mg90f.v: -------------------------------------------------------------------------------- 1 | //parallel_add CBX_SINGLE_OUTPUT_FILE="ON" MSW_SUBTRACT="NO" PIPELINE=0 REPRESENTATION="UNSIGNED" RESULT_ALIGNMENT="LSB" SHIFT=0 SIZE=8 WIDTH=8 WIDTHR=11 data result 2 | //VERSION_BEGIN 15.0 cbx_mgl 2015:04:22:18:06:50:SJ cbx_stratixii 2015:04:22:18:04:08:SJ cbx_util_mgl 2015:04:22:18:04:08:SJ VERSION_END 3 | // synthesis VERILOG_INPUT_VERSION VERILOG_2001 4 | // altera message_off 10463 5 | 6 | 7 | 8 | // Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 9 | // Your use of Altera Corporation's design tools, logic functions 10 | // and other software and tools, and its AMPP partner logic 11 | // functions, and any output files from any of the foregoing 12 | // (including device programming or simulation files), and any 13 | // associated documentation or information are expressly subject 14 | // to the terms and conditions of the Altera Program License 15 | // Subscription Agreement, the Altera Quartus II License Agreement, 16 | // the Altera MegaCore Function License Agreement, or other 17 | // applicable license agreement, including, without limitation, 18 | // that your use is for the sole purpose of programming logic 19 | // devices manufactured by Altera and sold by Altera or its 20 | // authorized distributors. Please refer to the applicable 21 | // agreement for further details. 22 | 23 | 24 | 25 | //synthesis_resources = parallel_add 1 26 | //synopsys translate_off 27 | `timescale 1 ps / 1 ps 28 | //synopsys translate_on 29 | module mg90f 30 | ( 31 | data, 32 | result) /* synthesis synthesis_clearbox=1 */; 33 | input [63:0] data; 34 | output [10:0] result; 35 | 36 | wire [10:0] wire_mgl_prim1_result; 37 | 38 | parallel_add mgl_prim1 39 | ( 40 | .data(data), 41 | .result(wire_mgl_prim1_result)); 42 | defparam 43 | mgl_prim1.msw_subtract = "NO", 44 | mgl_prim1.pipeline = 0, 45 | mgl_prim1.representation = "UNSIGNED", 46 | mgl_prim1.result_alignment = "LSB", 47 | mgl_prim1.shift = 0, 48 | mgl_prim1.size = 8, 49 | mgl_prim1.width = 8, 50 | mgl_prim1.widthr = 11; 51 | assign 52 | result = wire_mgl_prim1_result; 53 | endmodule //mg90f 54 | //VALID FILE 55 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/robot.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | int main() 25 | { 26 | const unsigned int num_layers = 3; 27 | const unsigned int num_neurons_hidden = 96; 28 | const float desired_error = (const float) 0.001; 29 | struct fann *ann; 30 | struct fann_train_data *train_data, *test_data; 31 | 32 | unsigned int i = 0; 33 | 34 | printf("Creating network.\n"); 35 | 36 | train_data = fann_read_train_from_file("../datasets/robot.train"); 37 | 38 | ann = fann_create_standard(num_layers, 39 | train_data->num_input, num_neurons_hidden, train_data->num_output); 40 | 41 | printf("Training network.\n"); 42 | 43 | fann_set_training_algorithm(ann, FANN_TRAIN_INCREMENTAL); 44 | fann_set_learning_momentum(ann, 0.4f); 45 | 46 | fann_train_on_data(ann, train_data, 3000, 10, desired_error); 47 | 48 | printf("Testing network.\n"); 49 | 50 | test_data = fann_read_train_from_file("../datasets/robot.test"); 51 | 52 | fann_reset_MSE(ann); 53 | for(i = 0; i < fann_length_train_data(test_data); i++) 54 | { 55 | fann_test(ann, test_data->input[i], test_data->output[i]); 56 | } 57 | printf("MSE error on test data: %f\n", fann_get_MSE(ann)); 58 | 59 | printf("Saving network.\n"); 60 | 61 | fann_save(ann, "robot_float.net"); 62 | 63 | printf("Cleaning up.\n"); 64 | fann_destroy_train(train_data); 65 | fann_destroy_train(test_data); 66 | fann_destroy(ann); 67 | 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | PROJECT (FANN) 2 | #SET(CMAKE_VERBOSE_MAKEFILE ON) 3 | cmake_minimum_required(VERSION 2.8) 4 | 5 | SET(CMAKE_MODULE_PATH 6 | ${CMAKE_SOURCE_DIR}/cmake/Modules 7 | ) 8 | 9 | SET(VERSION 2.2.0) 10 | 11 | INCLUDE(DefineInstallationPaths) 12 | 13 | 14 | configure_file( ${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/include/config.h ) 15 | INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/include/) 16 | 17 | configure_file( ${CMAKE_SOURCE_DIR}/cmake/fann.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/fann.pc @ONLY ) 18 | 19 | SET(PKGCONFIG_INSTALL_DIR /lib/pkgconfig) 20 | 21 | ########### install files ############### 22 | 23 | INSTALL_FILES( ${PKGCONFIG_INSTALL_DIR} FILES fann.pc ) 24 | 25 | ADD_SUBDIRECTORY( src ) 26 | 27 | ################# cpack ################ 28 | 29 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast Artificial Neural Network Library (FANN)") 30 | SET(CPACK_PACKAGE_VENDOR "Steffen Nissen") 31 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt") 32 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt") 33 | SET(CPACK_PACKAGE_VERSION_MAJOR "2") 34 | SET(CPACK_PACKAGE_VERSION_MINOR "2") 35 | SET(CPACK_PACKAGE_VERSION_PATCH "0") 36 | SET(CPACK_GENERATOR "TGZ;ZIP") 37 | SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP") 38 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Steffen Nissen") 39 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") 40 | IF(WIN32 AND NOT UNIX) 41 | # There is a bug in NSI that does not handle full unix paths properly. Make 42 | # sure there is at least one set of four (4) backlasshes. 43 | # SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp") 44 | # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") 45 | # SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project") 46 | SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\leenissen.dk/fann/") 47 | SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\leenissen.dk/fann/") 48 | SET(CPACK_NSIS_CONTACT "sn@leenissen.dk") 49 | SET(CPACK_NSIS_MODIFY_PATH ON) 50 | ELSE(WIN32 AND NOT UNIX) 51 | # SET(CPACK_STRIP_FILES "bin/MyExecutable") 52 | # SET(CPACK_SOURCE_STRIP_FILES "") 53 | ENDIF(WIN32 AND NOT UNIX) 54 | #SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable") 55 | INCLUDE(CPack) 56 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/README.txt: -------------------------------------------------------------------------------- 1 | Fast Artificial Neural Network Library (FANN) 2 | 3 | Fast Artificial Neural Network Library is a free open source neural network 4 | library, which implements multilayer artificial neural networks in C with 5 | support for both fully connected and sparsely connected networks. 6 | Cross-platform execution in both fixed and floating point are supported. 7 | It includes a framework for easy handling of training data sets. It is easy to 8 | use, versatile, well documented, and fast. Bindings to more than 15 programming 9 | languages are available. An easy to read introduction article and a reference 10 | manual accompanies the library with examples and recommendations on how to use 11 | the library. Several graphical user interfaces are also available for the 12 | library. 13 | 14 | FANN Features: 15 | * Multilayer Artificial Neural Network Library in C 16 | * Backpropagation training (RPROP, Quickprop, Batch, Incremental) 17 | * Evolving topology training which dynamically builds and trains the ANN (Cascade2) 18 | * Easy to use (create, train and run an ANN with just three function calls) 19 | * Fast (up to 150 times faster execution than other libraries) 20 | * Versatile (possible to adjust many parameters and features on-the-fly) 21 | * Well documented (An easy to read introduction article, a thorough reference manual, and a 50+ page university report describing the implementation considerations etc.) 22 | * Cross-platform (configure script for linux and unix, dll files for windows, project files for MSVC++ and Borland compilers are also reported to work) 23 | * Several different activation functions implemented (including stepwise linear functions for that extra bit of speed) 24 | * Easy to save and load entire ANNs 25 | * Several easy to use examples 26 | * Can use both floating point and fixed point numbers (actually both float, double and int are available) 27 | * Cache optimized (for that extra bit of speed) 28 | * Open source, but can still be used in commercial applications (licenced under LGPL) 29 | * Framework for easy handling of training data sets 30 | * Graphical Interfaces 31 | * Language Bindings to a large number of different programming languages 32 | * Widely used (approximately 100 downloads a day) 33 | 34 | To get started with FANN, go to the FANN help site (http://leenissen.dk/fann/wp/help/), which will include links to all the available resources. 35 | 36 | For more information about FANN, please refer to the FANN website: 37 | http://leenissen.dk/fann/wp/ 38 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/mushroom.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | int main() 25 | { 26 | const unsigned int num_layers = 3; 27 | const unsigned int num_neurons_hidden = 32; 28 | const float desired_error = (const float) 0.0001; 29 | const unsigned int max_epochs = 300; 30 | const unsigned int epochs_between_reports = 10; 31 | struct fann *ann; 32 | struct fann_train_data *train_data, *test_data; 33 | 34 | unsigned int i = 0; 35 | 36 | printf("Creating network.\n"); 37 | 38 | train_data = fann_read_train_from_file("../datasets/mushroom.train"); 39 | 40 | ann = fann_create_standard(num_layers, 41 | train_data->num_input, num_neurons_hidden, train_data->num_output); 42 | 43 | printf("Training network.\n"); 44 | 45 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC_STEPWISE); 46 | fann_set_activation_function_output(ann, FANN_SIGMOID_STEPWISE); 47 | 48 | /*fann_set_training_algorithm(ann, FANN_TRAIN_INCREMENTAL); */ 49 | 50 | fann_train_on_data(ann, train_data, max_epochs, epochs_between_reports, desired_error); 51 | 52 | printf("Testing network.\n"); 53 | 54 | test_data = fann_read_train_from_file("../datasets/mushroom.test"); 55 | 56 | fann_reset_MSE(ann); 57 | for(i = 0; i < fann_length_train_data(test_data); i++) 58 | { 59 | fann_test(ann, test_data->input[i], test_data->output[i]); 60 | } 61 | 62 | printf("MSE error on test data: %f\n", fann_get_MSE(ann)); 63 | 64 | printf("Saving network.\n"); 65 | 66 | fann_save(ann, "mushroom_float.net"); 67 | 68 | printf("Cleaning up.\n"); 69 | fann_destroy_train(train_data); 70 | fann_destroy_train(test_data); 71 | fann_destroy(ann); 72 | 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/love_float.net: -------------------------------------------------------------------------------- 1 | FANN_FLO_2.1 2 | num_layers=3 3 | learning_rate=0.700000 4 | connection_rate=1.000000 5 | network_type=0 6 | learning_momentum=0.000000 7 | training_algorithm=1 8 | train_error_function=1 9 | train_stop_function=1 10 | cascade_output_change_fraction=0.010000 11 | quickprop_decay=-0.000100 12 | quickprop_mu=1.750000 13 | rprop_increase_factor=1.200000 14 | rprop_decrease_factor=0.500000 15 | rprop_delta_min=0.000000 16 | rprop_delta_max=50.000000 17 | rprop_delta_zero=0.100000 18 | cascade_output_stagnation_epochs=12 19 | cascade_candidate_change_fraction=0.010000 20 | cascade_candidate_stagnation_epochs=12 21 | cascade_max_out_epochs=150 22 | cascade_min_out_epochs=50 23 | cascade_max_cand_epochs=150 24 | cascade_min_cand_epochs=50 25 | cascade_num_candidate_groups=2 26 | bit_fail_limit=9.99999977648258209229e-03 27 | cascade_candidate_limit=1.00000000000000000000e+03 28 | cascade_weight_multiplier=4.00000005960464477539e-01 29 | cascade_activation_functions_count=10 30 | cascade_activation_functions=3 5 7 8 10 11 14 15 16 17 31 | cascade_activation_steepnesses_count=4 32 | cascade_activation_steepnesses=2.50000000000000000000e-01 5.00000000000000000000e-01 7.50000000000000000000e-01 1.00000000000000000000e+00 33 | layer_sizes=5 5 2 34 | scale_included=0 35 | neurons (num_inputs, activation_function, activation_steepness)=(0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (0, 0, 0.00000000000000000000e+00) (5, 5, 1.00000000000000000000e+00) (5, 5, 1.00000000000000000000e+00) (5, 5, 1.00000000000000000000e+00) (5, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00) (5, 5, 1.00000000000000000000e+00) (0, 5, 1.00000000000000000000e+00) 36 | connections (connected_to_neuron, weight)=(0, 5.48145771026611328125e-01) (1, 8.77715170383453369141e-01) (2, 1.18826258182525634766e+00) (3, 1.10098564624786376953e+00) (4, 1.20640194416046142578e+00) (0, 1.12032723426818847656e+00) (1, 9.94018137454986572266e-01) (2, 5.37451744079589843750e-01) (3, 4.67716872692108154297e-01) (4, -1.43043529987335205078e+00) (0, 3.41331541538238525391e-01) (1, 5.66565990447998046875e-01) (2, 7.12529838085174560547e-01) (3, 8.99450302124023437500e-01) (4, -1.18141281604766845703e+00) (0, 2.80870288610458374023e-01) (1, 5.05038797855377197266e-01) (2, 4.21716570854187011719e-01) (3, 4.64593440294265747070e-01) (4, -1.00160980224609375000e+00) (5, 1.38241589069366455078e+00) (6, 5.08065521717071533203e-01) (7, 1.30855131149291992188e+00) (8, 3.68365317583084106445e-01) (9, -3.82822543382644653320e-01) 37 | -------------------------------------------------------------------------------- /src/neuralFPGA/datagen.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | trains = 200; 4 | tests = 10; 5 | depth = trains * 5 + tests * 5 + 2; 6 | 7 | target = open("data.mif", 'w') 8 | target.truncate() 9 | 10 | train = open("../java/train", 'w') 11 | train.truncate() 12 | 13 | dev = open("../java/dev", 'w') 14 | dev.truncate() 15 | 16 | test = open("love.data", 'w') 17 | test.truncate() 18 | 19 | test.write(str(trains) + " 4 1\n") 20 | train.write("label\n"); 21 | dev.write("label\n"); 22 | 23 | parameters = [] 24 | parameters.append(random.random()/4 + .1) 25 | parameters.append(random.random()/4 + .1) 26 | parameters.append(random.random()/4 + .1) 27 | parameters.append(random.random()/4 + .1) 28 | 29 | target.write("DEPTH = " + str(depth) + ";\n"); 30 | target.write("WIDTH = 32;\n"); 31 | target.write("ADDRESS_RADIX = HEX;\n"); 32 | target.write("DATA_RADIX = HEX;\n"); 33 | target.write('\n'); 34 | target.write("CONTENT BEGIN\n"); 35 | target.write('\n'); 36 | 37 | size = 0; 38 | 39 | val = "%08x" % trains 40 | index = "%03x" % size 41 | size+=1 42 | target.write(index + " : " + val + ";\n") 43 | 44 | val = "%08x" % tests 45 | index = "%03x" % size 46 | size+=1 47 | target.write(index + " : " + val + ";\n") 48 | 49 | for i in range(0, trains): 50 | sum = 0; 51 | for j in range(0, 4): 52 | value = random.random() 53 | val = "%08x" % (int)(value * 65536) 54 | index = "%03x" % size 55 | size+=1 56 | target.write(index + " : " + val + ";\n") 57 | train.write(str(value) + ",") 58 | test.write(str(value) + " ") 59 | sum += value * parameters[j]; 60 | if(sum < .5): 61 | output = 0 62 | else: 63 | output = 1 64 | val = "%08x" % (int)(output * 65536) 65 | index = "%03x" % size 66 | size+=1 67 | target.write(index + " : " + val + ";\n") 68 | train.write(str(output) + '\n') 69 | test.write("\n" + str(output) + "\n") 70 | 71 | for i in range(0, tests): 72 | sum = 0 73 | for j in range(0, 4): 74 | value = random.random() 75 | val = "%08x" % (int)(value * 65536) 76 | index = "%03x" % size 77 | size+=1 78 | target.write(index + " : " + val + ";\n") 79 | dev.write(str(value) + ",") 80 | sum += value * parameters[j]; 81 | if(sum < .5): 82 | output = 0 83 | else: 84 | output = 1 85 | val = "%08x" % (int)(output * 65536) 86 | index = "%03x" % size 87 | size+=1 88 | target.write(index + " : " + val + ";\n") 89 | dev.write(str(output) + '\n') 90 | 91 | target.write("\nEND;\n") 92 | 93 | print "And finally, we close it." 94 | target.close() 95 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/love_test.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | int main() 25 | { 26 | fann_type *calc_out; 27 | unsigned int i; 28 | int ret = 0; 29 | 30 | struct fann *ann; 31 | struct fann_train_data *data; 32 | 33 | printf("Creating network.\n"); 34 | 35 | #ifdef FIXEDFANN 36 | ann = fann_create_from_file("love_fixed.net"); 37 | #else 38 | ann = fann_create_from_file("love_float.net"); 39 | #endif 40 | 41 | if(!ann) 42 | { 43 | printf("Error creating ann --- ABORTING.\n"); 44 | return -1; 45 | } 46 | 47 | fann_print_connections(ann); 48 | fann_print_parameters(ann); 49 | 50 | printf("Testing network.\n"); 51 | 52 | #ifdef FIXEDFANN 53 | data = fann_read_train_from_file("love_fixed.data"); 54 | #else 55 | data = fann_read_train_from_file("love.data"); 56 | #endif 57 | 58 | for(i = 0; i < fann_length_train_data(data); i++) 59 | { 60 | fann_reset_MSE(ann); 61 | calc_out = fann_test(ann, data->input[i], data->output[i]); 62 | #ifdef FIXEDFANN 63 | printf("LOVE test (%d, %d) -> %d, should be %d, difference=%f\n", 64 | data->input[i][0], data->input[i][1], calc_out[0], data->output[i][0], 65 | (float) fann_abs(calc_out[0] - data->output[i][0]) / fann_get_multiplier(ann)); 66 | 67 | if((float) fann_abs(calc_out[0] - data->output[i][0]) / fann_get_multiplier(ann) > 0.2) 68 | { 69 | printf("Test failed\n"); 70 | ret = -1; 71 | } 72 | #else 73 | printf("LOVE test (%f, %f) -> %f, should be %f, difference=%f\n", 74 | data->input[i][0], data->input[i][1], calc_out[0], data->output[i][0], 75 | (float) fann_abs(calc_out[0] - data->output[i][0])); 76 | #endif 77 | } 78 | 79 | printf("Cleaning up.\n"); 80 | fann_destroy_train(data); 81 | fann_destroy(ann); 82 | 83 | return ret; 84 | } 85 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/love_test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | int main() 25 | { 26 | fann_type *calc_out; 27 | unsigned int i; 28 | int ret = 0; 29 | 30 | struct fann *ann; 31 | struct fann_train_data *data; 32 | 33 | printf("Creating network.\n"); 34 | 35 | #ifdef FIXEDFANN 36 | ann = fann_create_from_file("love_fixed.net"); 37 | #else 38 | ann = fann_create_from_file("love_float.net"); 39 | #endif 40 | 41 | if(!ann) 42 | { 43 | printf("Error creating ann --- ABORTING.\n"); 44 | return -1; 45 | } 46 | 47 | fann_print_connections(ann); 48 | fann_print_parameters(ann); 49 | 50 | printf("Testing network.\n"); 51 | 52 | #ifdef FIXEDFANN 53 | data = fann_read_train_from_file("love_fixed.data"); 54 | #else 55 | data = fann_read_train_from_file("love.data"); 56 | #endif 57 | 58 | for(i = 0; i < fann_length_train_data(data); i++) 59 | { 60 | fann_reset_MSE(ann); 61 | calc_out = fann_test(ann, data->input[i], data->output[i]); 62 | #ifdef FIXEDFANN 63 | printf("LOVE test (%d, %d) -> %d, should be %d, difference=%f\n", 64 | data->input[i][0], data->input[i][1], calc_out[0], data->output[i][0], 65 | (float) fann_abs(calc_out[0] - data->output[i][0]) / fann_get_multiplier(ann)); 66 | 67 | if((float) fann_abs(calc_out[0] - data->output[i][0]) / fann_get_multiplier(ann) > 0.2) 68 | { 69 | printf("Test failed\n"); 70 | ret = -1; 71 | } 72 | #else 73 | printf("LOVE test (%f, %f) -> %f, should be %f, difference=%f\n", 74 | data->input[i][0], data->input[i][1], calc_out[0], data->output[i][0], 75 | (float) fann_abs(calc_out[0] - data->output[i][0])); 76 | #endif 77 | } 78 | 79 | printf("Cleaning up.\n"); 80 | fann_destroy_train(data); 81 | fann_destroy(ann); 82 | 83 | return ret; 84 | } 85 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/MIF_convert.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class MIF_convert { 5 | public static void main(String[] args) throws Exception{ 6 | PrintWriter test = new PrintWriter(new FileWriter("love.data")); 7 | PrintWriter train = new PrintWriter(new FileWriter("train")); 8 | PrintWriter dev = new PrintWriter(new FileWriter("dev")); 9 | test.println("200 4 1"); 10 | PrintWriter writer = new PrintWriter("data.mif", "UTF-8"); 11 | writer.println("DEPTH = 302;"); 12 | writer.println("WIDTH = 32;"); 13 | writer.println("ADDRESS_RADIX = HEX;"); 14 | writer.println("DATA_RADIX = HEX;"); 15 | writer.println(); 16 | writer.println("CONTENT BEGIN"); 17 | writer.println(); 18 | 19 | double[] parameters = new double[4]; 20 | String label = "Tone,Eye Contact,Body Language,Proximity,Hit?"; 21 | train.println(label); 22 | test.println(label); 23 | 24 | Random rand = new Random(); 25 | parameters[0] = rand.nextDouble()/5 + .1; 26 | parameters[1] = rand.nextDouble()/5 + .1; 27 | parameters[2] = rand.nextDouble()/5 + .1; 28 | parameters[3] = rand.nextDouble()/5 + .1; 29 | 30 | double[] values = new double[4]; 31 | double output; 32 | int size = 0; 33 | 34 | String val = 35 | String.format("%08X", 200).toLowerCase(); 36 | String index = String.format("%03X", size).toLowerCase(); 37 | writer.println(index + " : " + val + ";"); 38 | size++; 39 | 40 | val = String.format("%08X", 100).toLowerCase(); 41 | index = String.format("%03X", size).toLowerCase(); 42 | writer.println(index + " : " + val + ";"); 43 | size++; 44 | 45 | for(int i = 0; i < 300; i++) { 46 | double sum = 0; 47 | for(int j = 0; j < 4; j++) { 48 | values[j] = rand.nextDouble(); 49 | val = String.format("%08X", (int)(values[j] * 65536)).toLowerCase(); 50 | index = String.format("%03X", size).toLowerCase(); 51 | if (i < 200) 52 | test.print(values[j] + " "); 53 | if (i < 200) 54 | train.print(values[j] + ","); 55 | else 56 | dev.print(values[j] + ","); 57 | 58 | writer.println(index + " : " + val + ";"); 59 | size++; 60 | sum += values[j] * parameters[j]; 61 | } 62 | if (i < 200) { 63 | if (sum < .5) 64 | output = 0; 65 | else 66 | output = 1; 67 | 68 | val = String.format("%08X", (int)(output * 65536)).toLowerCase(); 69 | index = String.format("%03X", size).toLowerCase(); 70 | writer.println(index + " : " + val + ";"); 71 | train.print(output); 72 | train.println(); 73 | test.println(); 74 | test.print(output); 75 | test.println(); 76 | } 77 | else { 78 | dev.print(output); 79 | dev.println(); 80 | } 81 | } 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_16.bsf: -------------------------------------------------------------------------------- 1 | /* 2 | WARNING: Do NOT edit the input and output ports in this file in a text 3 | editor if you plan to continue editing the block that represents it in 4 | the Block Editor! File corruption is VERY likely to occur. 5 | */ 6 | /* 7 | Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 8 | Your use of Altera Corporation's design tools, logic functions 9 | and other software and tools, and its AMPP partner logic 10 | functions, and any output files from any of the foregoing 11 | (including device programming or simulation files), and any 12 | associated documentation or information are expressly subject 13 | to the terms and conditions of the Altera Program License 14 | Subscription Agreement, the Altera Quartus II License Agreement, 15 | the Altera MegaCore Function License Agreement, or other 16 | applicable license agreement, including, without limitation, 17 | that your use is for the sole purpose of programming logic 18 | devices manufactured by Altera and sold by Altera or its 19 | authorized distributors. Please refer to the applicable 20 | agreement for further details. 21 | */ 22 | (header "symbol" (version "1.2")) 23 | (symbol 24 | (rect 0 0 168 96) 25 | (text "multiplier_16" (rect 48 0 134 16)(font "Arial" (font_size 10))) 26 | (text "inst" (rect 8 80 25 92)(font "Arial" )) 27 | (port 28 | (pt 0 40) 29 | (input) 30 | (text "dataa[15..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 31 | (text "dataa[15..0]" (rect 4 26 59 39)(font "Arial" (font_size 8))) 32 | (line (pt 0 40)(pt 72 40)(line_width 3)) 33 | ) 34 | (port 35 | (pt 0 72) 36 | (input) 37 | (text "datab[15..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 38 | (text "datab[15..0]" (rect 4 58 59 71)(font "Arial" (font_size 8))) 39 | (line (pt 0 72)(pt 72 72)(line_width 3)) 40 | ) 41 | (port 42 | (pt 168 56) 43 | (output) 44 | (text "result[31..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 45 | (text "result[31..0]" (rect 108 42 163 55)(font "Arial" (font_size 8))) 46 | (line (pt 168 56)(pt 104 56)(line_width 3)) 47 | ) 48 | (drawing 49 | (text "Signed" (rect 104 56 234 123)(font "Arial" )) 50 | (text "multiplication" (rect 104 66 260 143)(font "Arial" )) 51 | (line (pt 82 50)(pt 94 62)(line_width 3)) 52 | (line (pt 82 62)(pt 94 50)(line_width 3)) 53 | (line (pt 72 40)(pt 77 45)(line_width 3)) 54 | (line (pt 72 72)(pt 77 67)(line_width 3)) 55 | (line (pt 0 0)(pt 169 0)) 56 | (line (pt 169 0)(pt 169 98)) 57 | (line (pt 0 98)(pt 169 98)) 58 | (line (pt 0 0)(pt 0 98)) 59 | (line (pt 0 0)(pt 0 0)) 60 | (line (pt 0 0)(pt 0 0)) 61 | (line (pt 0 0)(pt 0 0)) 62 | (line (pt 0 0)(pt 0 0)) 63 | (circle (rect 72 40 104 72)) 64 | ) 65 | ) 66 | -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_32.bsf: -------------------------------------------------------------------------------- 1 | /* 2 | WARNING: Do NOT edit the input and output ports in this file in a text 3 | editor if you plan to continue editing the block that represents it in 4 | the Block Editor! File corruption is VERY likely to occur. 5 | */ 6 | /* 7 | Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 8 | Your use of Altera Corporation's design tools, logic functions 9 | and other software and tools, and its AMPP partner logic 10 | functions, and any output files from any of the foregoing 11 | (including device programming or simulation files), and any 12 | associated documentation or information are expressly subject 13 | to the terms and conditions of the Altera Program License 14 | Subscription Agreement, the Altera Quartus II License Agreement, 15 | the Altera MegaCore Function License Agreement, or other 16 | applicable license agreement, including, without limitation, 17 | that your use is for the sole purpose of programming logic 18 | devices manufactured by Altera and sold by Altera or its 19 | authorized distributors. Please refer to the applicable 20 | agreement for further details. 21 | */ 22 | (header "symbol" (version "1.2")) 23 | (symbol 24 | (rect 0 0 168 96) 25 | (text "multiplier_32" (rect 48 0 134 16)(font "Arial" (font_size 10))) 26 | (text "inst" (rect 8 80 25 92)(font "Arial" )) 27 | (port 28 | (pt 0 40) 29 | (input) 30 | (text "dataa[31..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 31 | (text "dataa[31..0]" (rect 4 26 59 39)(font "Arial" (font_size 8))) 32 | (line (pt 0 40)(pt 72 40)(line_width 3)) 33 | ) 34 | (port 35 | (pt 0 72) 36 | (input) 37 | (text "datab[31..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 38 | (text "datab[31..0]" (rect 4 58 59 71)(font "Arial" (font_size 8))) 39 | (line (pt 0 72)(pt 72 72)(line_width 3)) 40 | ) 41 | (port 42 | (pt 168 56) 43 | (output) 44 | (text "result[63..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 45 | (text "result[63..0]" (rect 108 42 163 55)(font "Arial" (font_size 8))) 46 | (line (pt 168 56)(pt 104 56)(line_width 3)) 47 | ) 48 | (drawing 49 | (text "Signed" (rect 104 56 234 123)(font "Arial" )) 50 | (text "multiplication" (rect 104 66 260 143)(font "Arial" )) 51 | (line (pt 82 50)(pt 94 62)(line_width 3)) 52 | (line (pt 82 62)(pt 94 50)(line_width 3)) 53 | (line (pt 72 40)(pt 77 45)(line_width 3)) 54 | (line (pt 72 72)(pt 77 67)(line_width 3)) 55 | (line (pt 0 0)(pt 169 0)) 56 | (line (pt 169 0)(pt 169 98)) 57 | (line (pt 0 98)(pt 169 98)) 58 | (line (pt 0 0)(pt 0 98)) 59 | (line (pt 0 0)(pt 0 0)) 60 | (line (pt 0 0)(pt 0 0)) 61 | (line (pt 0 0)(pt 0 0)) 62 | (line (pt 0 0)(pt 0 0)) 63 | (circle (rect 72 40 104 72)) 64 | ) 65 | ) 66 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/multiplier_16.bsf: -------------------------------------------------------------------------------- 1 | /* 2 | WARNING: Do NOT edit the input and output ports in this file in a text 3 | editor if you plan to continue editing the block that represents it in 4 | the Block Editor! File corruption is VERY likely to occur. 5 | */ 6 | /* 7 | Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 8 | Your use of Altera Corporation's design tools, logic functions 9 | and other software and tools, and its AMPP partner logic 10 | functions, and any output files from any of the foregoing 11 | (including device programming or simulation files), and any 12 | associated documentation or information are expressly subject 13 | to the terms and conditions of the Altera Program License 14 | Subscription Agreement, the Altera Quartus II License Agreement, 15 | the Altera MegaCore Function License Agreement, or other 16 | applicable license agreement, including, without limitation, 17 | that your use is for the sole purpose of programming logic 18 | devices manufactured by Altera and sold by Altera or its 19 | authorized distributors. Please refer to the applicable 20 | agreement for further details. 21 | */ 22 | (header "symbol" (version "1.2")) 23 | (symbol 24 | (rect 0 0 168 96) 25 | (text "multiplier_16" (rect 48 0 134 16)(font "Arial" (font_size 10))) 26 | (text "inst" (rect 8 80 25 92)(font "Arial" )) 27 | (port 28 | (pt 0 40) 29 | (input) 30 | (text "dataa[15..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 31 | (text "dataa[15..0]" (rect 4 26 59 39)(font "Arial" (font_size 8))) 32 | (line (pt 0 40)(pt 72 40)(line_width 3)) 33 | ) 34 | (port 35 | (pt 0 72) 36 | (input) 37 | (text "datab[15..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 38 | (text "datab[15..0]" (rect 4 58 59 71)(font "Arial" (font_size 8))) 39 | (line (pt 0 72)(pt 72 72)(line_width 3)) 40 | ) 41 | (port 42 | (pt 168 56) 43 | (output) 44 | (text "result[31..0]" (rect 0 0 67 14)(font "Arial" (font_size 8))) 45 | (text "result[31..0]" (rect 108 42 163 55)(font "Arial" (font_size 8))) 46 | (line (pt 168 56)(pt 104 56)(line_width 3)) 47 | ) 48 | (drawing 49 | (text "Signed" (rect 104 56 234 123)(font "Arial" )) 50 | (text "multiplication" (rect 104 66 260 143)(font "Arial" )) 51 | (line (pt 82 50)(pt 94 62)(line_width 3)) 52 | (line (pt 82 62)(pt 94 50)(line_width 3)) 53 | (line (pt 72 40)(pt 77 45)(line_width 3)) 54 | (line (pt 72 72)(pt 77 67)(line_width 3)) 55 | (line (pt 0 0)(pt 169 0)) 56 | (line (pt 169 0)(pt 169 98)) 57 | (line (pt 0 98)(pt 169 98)) 58 | (line (pt 0 0)(pt 0 98)) 59 | (line (pt 0 0)(pt 0 0)) 60 | (line (pt 0 0)(pt 0 0)) 61 | (line (pt 0 0)(pt 0 0)) 62 | (line (pt 0 0)(pt 0 0)) 63 | (circle (rect 72 40 104 72)) 64 | ) 65 | ) 66 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/fannfixed/fannfixed.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/fannfloat/fannfloat.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/fanndouble/fanndouble.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | 14 | 15 | Source Files 16 | 17 | 18 | Source Files 19 | 20 | 21 | Source Files 22 | 23 | 24 | Source Files 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | 34 | 35 | Header Files 36 | 37 | 38 | Header Files 39 | 40 | 41 | Header Files 42 | 43 | 44 | Header Files 45 | 46 | 47 | Header Files 48 | 49 | 50 | Header Files 51 | 52 | 53 | Header Files 54 | 55 | 56 | Header Files 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/java/MIF_convert.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class MIF_convert { 5 | public static void main(String[] args) throws Exception{ 6 | File fout = new File("love.data"); 7 | FileOutputStream fos = new FileOutputStream(fout); 8 | BufferedWriter test = new BufferedWriter(new OutputStreamWriter(fos)); 9 | 10 | fout = new File("train"); 11 | fos = new FileOutputStream(fout); 12 | BufferedWriter train = new BufferedWriter(new OutputStreamWriter(fos)); 13 | 14 | PrintWriter dev = new PrintWriter(new FileWriter("dev")); 15 | String label = "Tone,Eye Contact,Body Language,Proximity,Hit?"; 16 | train.write(label); train.newLine(); 17 | System.out.println(label); 18 | 19 | test.write("200 4 1"); 20 | test.newLine(); 21 | PrintWriter writer = new PrintWriter("data.mif", "UTF-8"); 22 | writer.println("DEPTH = 302;"); 23 | writer.println("WIDTH = 32;"); 24 | writer.println("ADDRESS_RADIX = HEX;"); 25 | writer.println("DATA_RADIX = HEX;"); 26 | writer.println(); 27 | writer.println("CONTENT BEGIN"); 28 | writer.println(); 29 | 30 | double[] parameters = new double[4]; 31 | 32 | Random rand = new Random(); 33 | parameters[0] = rand.nextDouble()/5 + .1; 34 | parameters[1] = rand.nextDouble()/5 + .1; 35 | parameters[2] = rand.nextDouble()/5 + .1; 36 | parameters[3] = rand.nextDouble()/5 + .1; 37 | 38 | double[] values = new double[4]; 39 | double output; 40 | int size = 0; 41 | 42 | String val = 43 | String.format("%08X", 200).toLowerCase(); 44 | String index = String.format("%03X", size).toLowerCase(); 45 | writer.println(index + " : " + val + ";"); 46 | size++; 47 | 48 | val = String.format("%08X", 100).toLowerCase(); 49 | index = String.format("%03X", size).toLowerCase(); 50 | writer.println(index + " : " + val + ";"); 51 | size++; 52 | 53 | for(int i = 0; i < 210; i++) { 54 | double sum = 0; 55 | for(int j = 0; j < 4; j++) { 56 | values[j] = rand.nextDouble(); 57 | val = String.format("%08X", (int)(values[j] * 65536)).toLowerCase(); 58 | index = String.format("%03X", size).toLowerCase(); 59 | if (i < 200) 60 | test.write(values[j] + " "); 61 | if (i < 200) 62 | train.write(values[j] + ","); 63 | else 64 | System.out.print(values[j] + ","); 65 | 66 | writer.println(index + " : " + val + ";"); 67 | size++; 68 | sum += values[j] * parameters[j]; 69 | } 70 | if (sum < .5) 71 | output = 0; 72 | else 73 | output = 1; 74 | 75 | if (i < 200) { 76 | val = String.format("%08X", (int)(output * 65536)).toLowerCase(); 77 | index = String.format("%03X", size).toLowerCase(); 78 | writer.println(index + " : " + val + ";"); 79 | train.write(output + ""); 80 | train.newLine(); 81 | test.newLine(); 82 | test.write(output + ""); 83 | test.newLine(); 84 | } 85 | else { 86 | System.out.print(output); 87 | System.out.println(); 88 | } 89 | } 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/java/music_train.csv: -------------------------------------------------------------------------------- 1 | Year,Length,Jazz,Rock,Hit? 2 | 1913.0,5.88,yes,no,yes 3 | 1918.0,6.55,yes,no,yes 4 | 1999.0,6.23,no,no,no 5 | 1969.0,4.41,no,no,no 6 | 1930.0,6.86,yes,no,yes 7 | 1935.0,5.72,no,yes,no 8 | 1941.0,4.86,yes,no,yes 9 | 1966.0,4.34,yes,yes,yes 10 | 1922.0,5.80,yes,no,yes 11 | 1932.0,6.69,yes,no,yes 12 | 1929.0,1.05,yes,no,yes 13 | 1972.0,4.94,yes,yes,yes 14 | 1909.0,4.97,yes,no,yes 15 | 1902.0,5.26,yes,no,yes 16 | 1935.0,2.50,yes,no,yes 17 | 1948.0,6.76,yes,no,yes 18 | 1969.0,2.23,yes,no,no 19 | 1988.0,4.81,yes,no,no 20 | 1976.0,5.56,yes,no,yes 21 | 1918.0,3.58,no,yes,no 22 | 1981.0,4.25,yes,no,yes 23 | 1945.0,6.58,yes,no,yes 24 | 1954.0,5.98,yes,no,no 25 | 1983.0,2.20,yes,no,no 26 | 1944.0,6.77,yes,no,yes 27 | 1936.0,6.17,yes,no,no 28 | 1914.0,3.00,yes,no,yes 29 | 1931.0,4.40,yes,no,yes 30 | 1955.0,5.41,yes,no,no 31 | 1952.0,4.37,no,no,no 32 | 1944.0,5.08,yes,no,yes 33 | 1999.0,1.12,no,no,no 34 | 1955.0,6.99,yes,no,no 35 | 1995.0,4.52,no,no,no 36 | 1957.0,1.91,yes,no,no 37 | 1918.0,6.61,yes,no,yes 38 | 1973.0,6.50,yes,no,no 39 | 1967.0,5.22,yes,no,no 40 | 1955.0,5.94,yes,yes,yes 41 | 1923.0,4.78,yes,no,yes 42 | 1956.0,4.35,yes,yes,yes 43 | 1906.0,3.95,yes,no,yes 44 | 1924.0,4.50,yes,no,yes 45 | 1997.0,5.32,yes,yes,yes 46 | 1959.0,4.78,no,no,no 47 | 1932.0,4.08,yes,no,yes 48 | 1974.0,4.80,no,no,no 49 | 1921.0,4.25,yes,no,yes 50 | 1986.0,6.41,yes,no,no 51 | 1996.0,4.33,yes,yes,yes 52 | 1914.0,4.29,yes,no,yes 53 | 1958.0,6.74,yes,no,no 54 | 1939.0,5.90,yes,no,yes 55 | 1945.0,5.64,yes,no,yes 56 | 1962.0,6.94,yes,no,no 57 | 1960.0,4.22,no,no,yes 58 | 1945.0,5.30,yes,no,yes 59 | 1910.0,6.28,yes,no,yes 60 | 1968.0,1.24,yes,no,no 61 | 1983.0,4.05,no,no,no 62 | 1941.0,6.94,yes,no,yes 63 | 1908.0,5.80,no,yes,no 64 | 1957.0,6.85,yes,yes,yes 65 | 1921.0,6.61,no,yes,no 66 | 1983.0,6.15,yes,yes,yes 67 | 1985.0,3.63,yes,no,no 68 | 1913.0,5.98,yes,no,yes 69 | 1934.0,5.32,no,yes,yes 70 | 1935.0,1.33,yes,no,yes 71 | 1920.0,6.44,yes,no,yes 72 | 1920.0,6.85,yes,no,no 73 | 1948.0,4.30,no,yes,no 74 | 1961.0,4.36,yes,no,no 75 | 1995.0,4.52,no,no,no 76 | 1920.0,4.17,yes,no,no 77 | 1904.0,4.29,yes,no,yes 78 | 1922.0,5.56,no,yes,no 79 | 1989.0,6.96,no,yes,yes 80 | 1911.0,3.26,yes,no,yes 81 | 1963.0,6.57,yes,no,no 82 | 1967.0,6.32,yes,no,no 83 | 1980.0,6.67,yes,no,no 84 | 1985.0,6.14,yes,yes,yes 85 | 1945.0,4.42,no,yes,no 86 | 1995.0,4.68,yes,yes,yes 87 | 1970.0,4.83,yes,no,no 88 | 1964.0,5.25,no,no,yes 89 | 1982.0,5.62,yes,no,no 90 | 1990.0,6.79,no,yes,yes 91 | 1946.0,6.65,yes,no,yes 92 | 1932.0,6.66,yes,no,yes 93 | 1919.0,6.70,yes,no,yes 94 | 1980.0,5.32,yes,yes,yes 95 | 1982.0,6.16,yes,yes,yes 96 | 1900.0,5.67,no,yes,no 97 | 1991.0,4.71,yes,no,yes 98 | 1969.0,5.77,yes,no,no 99 | 1945.0,6.04,yes,no,yes 100 | 1925.0,5.46,yes,no,yes 101 | 1974.0,5.82,no,no,no 102 | -------------------------------------------------------------------------------- /src/neuralFPGA/BCHtoSevenSegment.sv: -------------------------------------------------------------------------------- 1 | module BCHtoSevenSegment 2 | (input logic [3:0] bch, 3 | output logic [6:0] segment); 4 | 5 | always_comb 6 | case(bch) 7 | 4'h0: segment = 7'b1000000; //0 8 | 4'h1: segment = 7'b1111001; //1 9 | 4'h2: segment = 7'b0100100; //2 10 | 4'h3: segment = 7'b0110000; //3 11 | 4'h4: segment = 7'b0011001; //4 12 | 4'h5: segment = 7'b0010010; //5 13 | 4'h6: segment = 7'b0000010; //6 14 | 4'h7: segment = 7'b1111000; //7 15 | 4'h8: segment = 7'b0000000; //8 16 | 4'h9: segment = 7'b0010000; //9 17 | 4'ha: segment = 7'b0001000; //a 18 | 4'hb: segment = 7'b0000011; //b 19 | 4'hc: segment = 7'b1000110; //c 20 | 4'hd: segment = 7'b0100001; //d 21 | 4'he: segment = 7'b0000110; //e 22 | 4'hf: segment = 7'b0001110; //f 23 | default: segment = 7'b0000000; 24 | endcase 25 | endmodule: BCHtoSevenSegment 26 | 27 | module BCHtoSevenSegmentTestBench 28 | (output logic [3:0] bch, 29 | input logic [6:0] segment); 30 | 31 | initial begin 32 | bch = 4'd0; 33 | 34 | $display("Starting tests"); 35 | // 0 36 | #10 if (segment != 7'b1000000) 37 | $display("incorrect output at input 0"); 38 | 39 | bch = 4'd1; 40 | #10 if (segment != 7'b1111001) 41 | $display("incorrect output at input 1"); 42 | 43 | bch = 4'd2; 44 | #10 if (segment != 7'b0100100) 45 | $display("incorrect output at input 2"); 46 | 47 | bch = 4'd3; 48 | #10 if (segment != 7'b0110000) 49 | $display("incorrect output at input 3"); 50 | 51 | bch = 4'd4; 52 | #10 if (segment != 7'b0011001) 53 | $display("incorrect output at input 4"); 54 | 55 | bch = 4'd5; 56 | #10 if (segment != 7'b0010010) 57 | $display("incorrect output at input 5"); 58 | 59 | bch = 4'd6; 60 | #10 if (segment != 7'b0000010) 61 | $display("incorrect output at input 6"); 62 | 63 | bch = 4'd7; 64 | #10 if (segment != 7'b1111000) 65 | $display("incorrect output at input 7"); 66 | 67 | bch = 4'd8; 68 | #10 if (segment != 7'b0000000) 69 | $display("incorrect output at input 8"); 70 | 71 | bch = 4'd9; 72 | #10 if (segment != 7'b0010000) 73 | $display("incorrect output at input 9"); 74 | $display("Finished tests"); 75 | end 76 | 77 | endmodule: BCHtoSevenSegmentTestBench 78 | 79 | module top; 80 | logic [3:0] bch; 81 | logic [6:0] segment; 82 | 83 | BCHtoSevenSegment(.*); 84 | BCHtoSevenSegmentTestBench(.*); 85 | 86 | endmodule: top 87 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/BCHtoSevenSegment.sv: -------------------------------------------------------------------------------- 1 | module BCHtoSevenSegment 2 | (input logic [3:0] bch, 3 | output logic [6:0] segment); 4 | 5 | always_comb 6 | case(bch) 7 | 4'h0: segment = 7'b1000000; //0 8 | 4'h1: segment = 7'b1111001; //1 9 | 4'h2: segment = 7'b0100100; //2 10 | 4'h3: segment = 7'b0110000; //3 11 | 4'h4: segment = 7'b0011001; //4 12 | 4'h5: segment = 7'b0010010; //5 13 | 4'h6: segment = 7'b0000010; //6 14 | 4'h7: segment = 7'b1111000; //7 15 | 4'h8: segment = 7'b0000000; //8 16 | 4'h9: segment = 7'b0010000; //9 17 | 4'ha: segment = 7'b0001000; //a 18 | 4'hb: segment = 7'b0000011; //b 19 | 4'hc: segment = 7'b1000110; //c 20 | 4'hd: segment = 7'b0100001; //d 21 | 4'he: segment = 7'b0000110; //e 22 | 4'hf: segment = 7'b0001110; //f 23 | default: segment = 7'b0000000; 24 | endcase 25 | endmodule: BCHtoSevenSegment 26 | 27 | module BCHtoSevenSegmentTestBench 28 | (output logic [3:0] bch, 29 | input logic [6:0] segment); 30 | 31 | initial begin 32 | bch = 4'd0; 33 | 34 | $display("Starting tests"); 35 | // 0 36 | #10 if (segment != 7'b1000000) 37 | $display("incorrect output at input 0"); 38 | 39 | bch = 4'd1; 40 | #10 if (segment != 7'b1111001) 41 | $display("incorrect output at input 1"); 42 | 43 | bch = 4'd2; 44 | #10 if (segment != 7'b0100100) 45 | $display("incorrect output at input 2"); 46 | 47 | bch = 4'd3; 48 | #10 if (segment != 7'b0110000) 49 | $display("incorrect output at input 3"); 50 | 51 | bch = 4'd4; 52 | #10 if (segment != 7'b0011001) 53 | $display("incorrect output at input 4"); 54 | 55 | bch = 4'd5; 56 | #10 if (segment != 7'b0010010) 57 | $display("incorrect output at input 5"); 58 | 59 | bch = 4'd6; 60 | #10 if (segment != 7'b0000010) 61 | $display("incorrect output at input 6"); 62 | 63 | bch = 4'd7; 64 | #10 if (segment != 7'b1111000) 65 | $display("incorrect output at input 7"); 66 | 67 | bch = 4'd8; 68 | #10 if (segment != 7'b0000000) 69 | $display("incorrect output at input 8"); 70 | 71 | bch = 4'd9; 72 | #10 if (segment != 7'b0010000) 73 | $display("incorrect output at input 9"); 74 | $display("Finished tests"); 75 | end 76 | 77 | endmodule: BCHtoSevenSegmentTestBench 78 | 79 | module top; 80 | logic [3:0] bch; 81 | logic [6:0] segment; 82 | 83 | BCHtoSevenSegment(.*); 84 | BCHtoSevenSegmentTestBench(.*); 85 | 86 | endmodule: top 87 | -------------------------------------------------------------------------------- /src/neuralFPGA/love_train.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | #include 22 | #include "fann.h" 23 | #include "cycleTimer.h" 24 | 25 | int FANN_API test_callback(struct fann *ann, struct fann_train_data *train, 26 | unsigned int max_epochs, unsigned int epochs_between_reports, 27 | float desired_error, unsigned int epochs) 28 | { 29 | printf("Epochs %8d. MSE: %.5f. Desired-MSE: %.5f\n", epochs, fann_get_MSE(ann), desired_error); 30 | return 0; 31 | } 32 | 33 | int main() 34 | { 35 | long start = clock(); 36 | double startTime = CycleTimer::currentSeconds(); 37 | fann_type *calc_out; 38 | const unsigned int num_input = 4; 39 | const unsigned int num_output = 1; 40 | const unsigned int num_layers = 3; 41 | const unsigned int num_neurons_hidden = 4; 42 | const float desired_error = (const float) 0; 43 | const unsigned int max_epochs = 200; 44 | const unsigned int epochs_between_reports = 10; 45 | struct fann *ann; 46 | struct fann_train_data *data; 47 | 48 | unsigned int i = 0; 49 | unsigned int decimal_point; 50 | 51 | printf("Creating network.\n"); 52 | ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_output); 53 | 54 | data = fann_read_train_from_file("love.data"); 55 | 56 | fann_set_activation_steepness_hidden(ann, 1); 57 | fann_set_activation_steepness_output(ann, 1); 58 | 59 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 60 | fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); 61 | 62 | fann_set_train_stop_function(ann, FANN_STOPFUNC_BIT); 63 | fann_set_bit_fail_limit(ann, 0.01f); 64 | 65 | fann_set_training_algorithm(ann, FANN_TRAIN_BATCH); 66 | 67 | fann_init_weights(ann, data); 68 | 69 | long setup = clock(); 70 | printf("Setup took %lu clocks\n", setup - start); 71 | printf("Training network.\n"); 72 | fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error); 73 | 74 | long end = clock(); 75 | double endTime = CycleTimer::currentSeconds(); 76 | printf("Training took %lu clocks, total: %lu clocks\n", end - setup, end - start); 77 | printf("Total: %.3f ms\n", 1000.f * (endTime - startTime)); 78 | // printf("Testing network. %f\n", fann_test_data(ann, data)); 79 | 80 | for(i = 0; i < fann_length_train_data(data); i++) 81 | { 82 | calc_out = fann_run(ann, data->input[i]); 83 | calc_out[0] = round(calc_out[0]); 84 | /*printf("LOVE test (%f,%f,%f,%f) -> %f, should be %f, difference=%f\n", 85 | data->input[i][0], data->input[i][1], data->input[i][2], data->input[i][3], 86 | calc_out[0], data->output[i][0], fann_abs(calc_out[0] - data->output[i][0]));*/ 87 | } 88 | printf("Cleaning up.\n"); 89 | fann_destroy_train(data); 90 | fann_destroy(ann); 91 | 92 | return 0; 93 | } 94 | -------------------------------------------------------------------------------- /src/neuralFPGA/adder4_32_bb.v: -------------------------------------------------------------------------------- 1 | // megafunction wizard: %PARALLEL_ADD%VBB% 2 | // GENERATION: STANDARD 3 | // VERSION: WM1.0 4 | // MODULE: parallel_add 5 | 6 | // ============================================================ 7 | // File Name: adder4_32.v 8 | // Megafunction Name(s): 9 | // parallel_add 10 | // 11 | // Simulation Library Files(s): 12 | // altera_mf 13 | // ============================================================ 14 | // ************************************************************ 15 | // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! 16 | // 17 | // 15.0.0 Build 145 04/22/2015 SJ Web Edition 18 | // ************************************************************ 19 | 20 | //Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 21 | //Your use of Altera Corporation's design tools, logic functions 22 | //and other software and tools, and its AMPP partner logic 23 | //functions, and any output files from any of the foregoing 24 | //(including device programming or simulation files), and any 25 | //associated documentation or information are expressly subject 26 | //to the terms and conditions of the Altera Program License 27 | //Subscription Agreement, the Altera Quartus II License Agreement, 28 | //the Altera MegaCore Function License Agreement, or other 29 | //applicable license agreement, including, without limitation, 30 | //that your use is for the sole purpose of programming logic 31 | //devices manufactured by Altera and sold by Altera or its 32 | //authorized distributors. Please refer to the applicable 33 | //agreement for further details. 34 | 35 | module adder4_32 ( 36 | data0x, 37 | data1x, 38 | data2x, 39 | data3x, 40 | result); 41 | 42 | input [31:0] data0x; 43 | input [31:0] data1x; 44 | input [31:0] data2x; 45 | input [31:0] data3x; 46 | output [33:0] result; 47 | 48 | endmodule 49 | 50 | // ============================================================ 51 | // CNX file retrieval info 52 | // ============================================================ 53 | // Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" 54 | // Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" 55 | // Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all 56 | // Retrieval info: CONSTANT: MSW_SUBTRACT STRING "NO" 57 | // Retrieval info: CONSTANT: PIPELINE NUMERIC "0" 58 | // Retrieval info: CONSTANT: REPRESENTATION STRING "SIGNED" 59 | // Retrieval info: CONSTANT: RESULT_ALIGNMENT STRING "LSB" 60 | // Retrieval info: CONSTANT: SHIFT NUMERIC "0" 61 | // Retrieval info: CONSTANT: SIZE NUMERIC "4" 62 | // Retrieval info: CONSTANT: WIDTH NUMERIC "32" 63 | // Retrieval info: CONSTANT: WIDTHR NUMERIC "34" 64 | // Retrieval info: USED_PORT: data0x 0 0 32 0 INPUT NODEFVAL "data0x[31..0]" 65 | // Retrieval info: USED_PORT: data1x 0 0 32 0 INPUT NODEFVAL "data1x[31..0]" 66 | // Retrieval info: USED_PORT: data2x 0 0 32 0 INPUT NODEFVAL "data2x[31..0]" 67 | // Retrieval info: USED_PORT: data3x 0 0 32 0 INPUT NODEFVAL "data3x[31..0]" 68 | // Retrieval info: USED_PORT: result 0 0 34 0 OUTPUT NODEFVAL "result[33..0]" 69 | // Retrieval info: CONNECT: @data 0 0 32 0 data0x 0 0 32 0 70 | // Retrieval info: CONNECT: @data 0 0 32 32 data1x 0 0 32 0 71 | // Retrieval info: CONNECT: @data 0 0 32 64 data2x 0 0 32 0 72 | // Retrieval info: CONNECT: @data 0 0 32 96 data3x 0 0 32 0 73 | // Retrieval info: CONNECT: result 0 0 34 0 @result 0 0 34 0 74 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32.v TRUE 75 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32.inc FALSE 76 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32.cmp FALSE 77 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32.bsf FALSE 78 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32_inst.v FALSE 79 | // Retrieval info: GEN_FILE: TYPE_NORMAL adder4_32_bb.v TRUE 80 | // Retrieval info: LIB_FILE: altera_mf 81 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/CPackConfig.cmake: -------------------------------------------------------------------------------- 1 | # This file will be configured to contain variables for CPack. These variables 2 | # should be set in the CMake list file of the project before CPack module is 3 | # included. The list of available CPACK_xxx variables and their associated 4 | # documentation may be obtained using 5 | # cpack --help-variable-list 6 | # 7 | # Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) 8 | # and some are specific to a generator 9 | # (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables 10 | # usually begin with CPACK__xxxx. 11 | 12 | 13 | SET(CPACK_BINARY_7Z "") 14 | SET(CPACK_BINARY_BUNDLE "") 15 | SET(CPACK_BINARY_CYGWIN "") 16 | SET(CPACK_BINARY_DEB "") 17 | SET(CPACK_BINARY_DRAGNDROP "") 18 | SET(CPACK_BINARY_IFW "") 19 | SET(CPACK_BINARY_NSIS "") 20 | SET(CPACK_BINARY_OSXX11 "") 21 | SET(CPACK_BINARY_PACKAGEMAKER "") 22 | SET(CPACK_BINARY_RPM "") 23 | SET(CPACK_BINARY_STGZ "") 24 | SET(CPACK_BINARY_TBZ2 "") 25 | SET(CPACK_BINARY_TGZ "") 26 | SET(CPACK_BINARY_TXZ "") 27 | SET(CPACK_BINARY_TZ "") 28 | SET(CPACK_BINARY_WIX "") 29 | SET(CPACK_BINARY_ZIP "") 30 | SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") 31 | SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE") 32 | SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE") 33 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Steffen Nissen") 34 | SET(CPACK_GENERATOR "TGZ;ZIP") 35 | SET(CPACK_INSTALL_CMAKE_PROJECTS "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source;FANN;ALL;/") 36 | SET(CPACK_INSTALL_PREFIX "/usr/local") 37 | SET(CPACK_MODULE_PATH "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/cmake/Modules") 38 | SET(CPACK_NSIS_DISPLAY_NAME "CMake .") 39 | SET(CPACK_NSIS_INSTALLER_ICON_CODE "") 40 | SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") 41 | SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") 42 | SET(CPACK_NSIS_PACKAGE_NAME "CMake .") 43 | SET(CPACK_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk") 44 | SET(CPACK_OUTPUT_CONFIG_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackConfig.cmake") 45 | SET(CPACK_PACKAGE_DEFAULT_LOCATION "/") 46 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/README.txt") 47 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast Artificial Neural Network Library (FANN)") 48 | SET(CPACK_PACKAGE_FILE_NAME "FANN-2.2.0-Darwin") 49 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake .") 50 | SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "CMake .") 51 | SET(CPACK_PACKAGE_NAME "FANN") 52 | SET(CPACK_PACKAGE_RELOCATABLE "true") 53 | SET(CPACK_PACKAGE_VENDOR "Steffen Nissen") 54 | SET(CPACK_PACKAGE_VERSION "2.2.0") 55 | SET(CPACK_PACKAGE_VERSION_MAJOR "2") 56 | SET(CPACK_PACKAGE_VERSION_MINOR "2") 57 | SET(CPACK_PACKAGE_VERSION_PATCH "0") 58 | SET(CPACK_RESOURCE_FILE_LICENSE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/COPYING.txt") 59 | SET(CPACK_RESOURCE_FILE_README "/Applications/CMake.app/Contents/share/cmake-3.2/Templates/CPack.GenericDescription.txt") 60 | SET(CPACK_RESOURCE_FILE_WELCOME "/Applications/CMake.app/Contents/share/cmake-3.2/Templates/CPack.GenericWelcome.txt") 61 | SET(CPACK_SET_DESTDIR "OFF") 62 | SET(CPACK_SOURCE_7Z "") 63 | SET(CPACK_SOURCE_CYGWIN "") 64 | SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP") 65 | SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackSourceConfig.cmake") 66 | SET(CPACK_SOURCE_TBZ2 "") 67 | SET(CPACK_SOURCE_TGZ "") 68 | SET(CPACK_SOURCE_TXZ "") 69 | SET(CPACK_SOURCE_TZ "") 70 | SET(CPACK_SOURCE_ZIP "") 71 | SET(CPACK_SYSTEM_NAME "Darwin") 72 | SET(CPACK_TOPLEVEL_TAG "Darwin") 73 | SET(CPACK_WIX_SIZEOF_VOID_P "8") 74 | 75 | if(NOT CPACK_PROPERTIES_FILE) 76 | set(CPACK_PROPERTIES_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackProperties.cmake") 77 | endif() 78 | 79 | if(EXISTS ${CPACK_PROPERTIES_FILE}) 80 | include(${CPACK_PROPERTIES_FILE}) 81 | endif() 82 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/love_train.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | #include 22 | #include "fann.h" 23 | #include "cycleTimer.h" 24 | 25 | int FANN_API test_callback(struct fann *ann, struct fann_train_data *train, 26 | unsigned int max_epochs, unsigned int epochs_between_reports, 27 | float desired_error, unsigned int epochs) 28 | { 29 | printf("Epochs %8d. MSE: %.5f. Desired-MSE: %.5f\n", epochs, fann_get_MSE(ann), desired_error); 30 | return 0; 31 | } 32 | 33 | int main() 34 | { 35 | long start = clock(); 36 | double startTime = CycleTimer::currentSeconds(); 37 | fann_type *calc_out; 38 | const unsigned int num_input = 4; 39 | const unsigned int num_output = 1; 40 | const unsigned int num_layers = 3; 41 | const unsigned int num_neurons_hidden = 4; 42 | const float desired_error = (const float) 0; 43 | const unsigned int max_epochs = 200; 44 | const unsigned int epochs_between_reports = 10; 45 | struct fann *ann; 46 | struct fann_train_data *data; 47 | 48 | unsigned int i = 0; 49 | unsigned int decimal_point; 50 | 51 | printf("Creating network.\n"); 52 | ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_output); 53 | 54 | data = fann_read_train_from_file("love.data"); 55 | 56 | fann_set_activation_steepness_hidden(ann, 1); 57 | fann_set_activation_steepness_output(ann, 1); 58 | 59 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 60 | fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); 61 | 62 | fann_set_train_stop_function(ann, FANN_STOPFUNC_BIT); 63 | fann_set_bit_fail_limit(ann, 0.01f); 64 | 65 | fann_set_training_algorithm(ann, FANN_TRAIN_RPROP); 66 | 67 | fann_init_weights(ann, data); 68 | 69 | long setup = clock(); 70 | printf("Setup took %lu clocks\n", setup - start); 71 | printf("Training network.\n"); 72 | fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error); 73 | 74 | long end = clock(); 75 | double endTime = CycleTimer::currentSeconds(); 76 | printf("Training took %lu clocks, total: %lu clocks\n", end - setup, end - start); 77 | printf("Total: %.3f ms\n", 1000.f * (endTime - startTime)); 78 | // printf("Testing network. %f\n", fann_test_data(ann, data)); 79 | 80 | for(i = 0; i < fann_length_train_data(data); i++) 81 | { 82 | calc_out = fann_run(ann, data->input[i]); 83 | calc_out[0] = round(calc_out[0]); 84 | /*printf("LOVE test (%f,%f,%f,%f) -> %f, should be %f, difference=%f\n", 85 | data->input[i][0], data->input[i][1], data->input[i][2], data->input[i][3], 86 | calc_out[0], data->output[i][0], fann_abs(calc_out[0] - data->output[i][0]));*/ 87 | } 88 | 89 | // printf("Saving network.\n"); 90 | 91 | fann_save(ann, "love_float.net"); 92 | 93 | decimal_point = fann_save_to_fixed(ann, "love_fixed.net"); 94 | fann_save_train_to_fixed(data, "love_fixed.data", decimal_point); 95 | 96 | printf("Cleaning up.\n"); 97 | fann_destroy_train(data); 98 | fann_destroy(ann); 99 | 100 | return 0; 101 | } 102 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/fann_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __fann_io_h__ 21 | #define __fann_io_h__ 22 | 23 | /* Section: FANN File Input/Output 24 | 25 | It is possible to save an entire ann to a file with for future loading with . 26 | */ 27 | 28 | /* Group: File Input and Output */ 29 | 30 | /* Function: fann_create_from_file 31 | 32 | Constructs a backpropagation neural network from a configuration file, which have been saved by . 33 | 34 | See also: 35 | , 36 | 37 | This function appears in FANN >= 1.0.0. 38 | */ 39 | FANN_EXTERNAL struct fann *FANN_API fann_create_from_file(const char *configuration_file); 40 | 41 | 42 | /* Function: fann_save 43 | 44 | Save the entire network to a configuration file. 45 | 46 | The configuration file contains all information about the neural network and enables 47 | to create an exact copy of the neural network and all of the 48 | parameters associated with the neural network. 49 | 50 | These three parameters (, , 51 | ) are *NOT* saved to the file because they cannot safely be 52 | ported to a different location. Also temporary parameters generated during training 53 | like is not saved. 54 | 55 | Return: 56 | The function returns 0 on success and -1 on failure. 57 | 58 | See also: 59 | , 60 | 61 | This function appears in FANN >= 1.0.0. 62 | */ 63 | FANN_EXTERNAL int FANN_API fann_save(struct fann *ann, const char *configuration_file); 64 | 65 | 66 | /* Function: fann_save_to_fixed 67 | 68 | Saves the entire network to a configuration file. 69 | But it is saved in fixed point format no matter which 70 | format it is currently in. 71 | 72 | This is usefull for training a network in floating points, 73 | and then later executing it in fixed point. 74 | 75 | The function returns the bit position of the fix point, which 76 | can be used to find out how accurate the fixed point network will be. 77 | A high value indicates high precision, and a low value indicates low 78 | precision. 79 | 80 | A negative value indicates very low precision, and a very 81 | strong possibility for overflow. 82 | (the actual fix point will be set to 0, since a negative 83 | fix point does not make sence). 84 | 85 | Generally, a fix point lower than 6 is bad, and should be avoided. 86 | The best way to avoid this, is to have less connections to each neuron, 87 | or just less neurons in each layer. 88 | 89 | The fixed point use of this network is only intended for use on machines that 90 | have no floating point processor, like an iPAQ. On normal computers the floating 91 | point version is actually faster. 92 | 93 | See also: 94 | , 95 | 96 | This function appears in FANN >= 1.0.0. 97 | */ 98 | FANN_EXTERNAL int FANN_API fann_save_to_fixed(struct fann *ann, const char *configuration_file); 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/steepness_train.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include "fann.h" 21 | #include 22 | 23 | void train_on_steepness_file(struct fann *ann, char *filename, 24 | unsigned int max_epochs, unsigned int epochs_between_reports, 25 | float desired_error, float steepness_start, 26 | float steepness_step, float steepness_end) 27 | { 28 | float error; 29 | unsigned int i; 30 | 31 | struct fann_train_data *data = fann_read_train_from_file(filename); 32 | 33 | if(epochs_between_reports) 34 | { 35 | printf("Max epochs %8d. Desired error: %.10f\n", max_epochs, desired_error); 36 | } 37 | 38 | fann_set_activation_steepness_hidden(ann, steepness_start); 39 | fann_set_activation_steepness_output(ann, steepness_start); 40 | for(i = 1; i <= max_epochs; i++) 41 | { 42 | /* train */ 43 | error = fann_train_epoch(ann, data); 44 | 45 | /* print current output */ 46 | if(epochs_between_reports && 47 | (i % epochs_between_reports == 0 || i == max_epochs || i == 1 || error < desired_error)) 48 | { 49 | printf("Epochs %8d. Current error: %.10f\n", i, error); 50 | } 51 | 52 | if(error < desired_error) 53 | { 54 | steepness_start += steepness_step; 55 | if(steepness_start <= steepness_end) 56 | { 57 | printf("Steepness: %f\n", steepness_start); 58 | fann_set_activation_steepness_hidden(ann, steepness_start); 59 | fann_set_activation_steepness_output(ann, steepness_start); 60 | } 61 | else 62 | { 63 | break; 64 | } 65 | } 66 | } 67 | fann_destroy_train(data); 68 | } 69 | 70 | int main() 71 | { 72 | const unsigned int num_input = 2; 73 | const unsigned int num_output = 1; 74 | const unsigned int num_layers = 3; 75 | const unsigned int num_neurons_hidden = 3; 76 | const float desired_error = (const float) 0.001; 77 | const unsigned int max_epochs = 500000; 78 | const unsigned int epochs_between_reports = 1000; 79 | unsigned int i; 80 | fann_type *calc_out; 81 | 82 | struct fann_train_data *data; 83 | 84 | struct fann *ann = fann_create_standard(num_layers, 85 | num_input, num_neurons_hidden, num_output); 86 | 87 | data = fann_read_train_from_file("love.data"); 88 | 89 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 90 | fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); 91 | 92 | fann_set_training_algorithm(ann, FANN_TRAIN_QUICKPROP); 93 | 94 | train_on_steepness_file(ann, "love.data", max_epochs, 95 | epochs_between_reports, desired_error, (float) 1.0, (float) 0.1, 96 | (float) 20.0); 97 | 98 | fann_set_activation_function_hidden(ann, FANN_THRESHOLD_SYMMETRIC); 99 | fann_set_activation_function_output(ann, FANN_THRESHOLD_SYMMETRIC); 100 | 101 | for(i = 0; i != fann_length_train_data(data); i++) 102 | { 103 | calc_out = fann_run(ann, data->input[i]); 104 | printf("XOR test (%f, %f) -> %f, should be %f, difference=%f\n", 105 | data->input[i][0], data->input[i][1], calc_out[0], data->output[i][0], 106 | (float) fann_abs(calc_out[0] - data->output[i][0])); 107 | } 108 | 109 | 110 | fann_save(ann, "xor_float.net"); 111 | 112 | fann_destroy(ann); 113 | fann_destroy_train(data); 114 | 115 | return 0; 116 | } 117 | -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_16_bb.v: -------------------------------------------------------------------------------- 1 | // megafunction wizard: %LPM_MULT%VBB% 2 | // GENERATION: STANDARD 3 | // VERSION: WM1.0 4 | // MODULE: lpm_mult 5 | 6 | // ============================================================ 7 | // File Name: multiplier_16.v 8 | // Megafunction Name(s): 9 | // lpm_mult 10 | // 11 | // Simulation Library Files(s): 12 | // lpm 13 | // ============================================================ 14 | // ************************************************************ 15 | // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! 16 | // 17 | // 15.0.0 Build 145 04/22/2015 SJ Web Edition 18 | // ************************************************************ 19 | 20 | //Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 21 | //Your use of Altera Corporation's design tools, logic functions 22 | //and other software and tools, and its AMPP partner logic 23 | //functions, and any output files from any of the foregoing 24 | //(including device programming or simulation files), and any 25 | //associated documentation or information are expressly subject 26 | //to the terms and conditions of the Altera Program License 27 | //Subscription Agreement, the Altera Quartus II License Agreement, 28 | //the Altera MegaCore Function License Agreement, or other 29 | //applicable license agreement, including, without limitation, 30 | //that your use is for the sole purpose of programming logic 31 | //devices manufactured by Altera and sold by Altera or its 32 | //authorized distributors. Please refer to the applicable 33 | //agreement for further details. 34 | 35 | module multiplier_16 ( 36 | dataa, 37 | datab, 38 | result); 39 | 40 | input [15:0] dataa; 41 | input [15:0] datab; 42 | output [31:0] result; 43 | 44 | endmodule 45 | 46 | // ============================================================ 47 | // CNX file retrieval info 48 | // ============================================================ 49 | // Retrieval info: PRIVATE: AutoSizeResult NUMERIC "1" 50 | // Retrieval info: PRIVATE: B_isConstant NUMERIC "0" 51 | // Retrieval info: PRIVATE: ConstantB NUMERIC "0" 52 | // Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" 53 | // Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "0" 54 | // Retrieval info: PRIVATE: Latency NUMERIC "0" 55 | // Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" 56 | // Retrieval info: PRIVATE: SignedMult NUMERIC "1" 57 | // Retrieval info: PRIVATE: USE_MULT NUMERIC "1" 58 | // Retrieval info: PRIVATE: ValidConstant NUMERIC "0" 59 | // Retrieval info: PRIVATE: WidthA NUMERIC "16" 60 | // Retrieval info: PRIVATE: WidthB NUMERIC "16" 61 | // Retrieval info: PRIVATE: WidthP NUMERIC "32" 62 | // Retrieval info: PRIVATE: aclr NUMERIC "0" 63 | // Retrieval info: PRIVATE: clken NUMERIC "0" 64 | // Retrieval info: PRIVATE: new_diagram STRING "1" 65 | // Retrieval info: PRIVATE: optimize NUMERIC "0" 66 | // Retrieval info: LIBRARY: lpm lpm.lpm_components.all 67 | // Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=5" 68 | // Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "SIGNED" 69 | // Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT" 70 | // Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "16" 71 | // Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "16" 72 | // Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "32" 73 | // Retrieval info: USED_PORT: dataa 0 0 16 0 INPUT NODEFVAL "dataa[15..0]" 74 | // Retrieval info: USED_PORT: datab 0 0 16 0 INPUT NODEFVAL "datab[15..0]" 75 | // Retrieval info: USED_PORT: result 0 0 32 0 OUTPUT NODEFVAL "result[31..0]" 76 | // Retrieval info: CONNECT: @dataa 0 0 16 0 dataa 0 0 16 0 77 | // Retrieval info: CONNECT: @datab 0 0 16 0 datab 0 0 16 0 78 | // Retrieval info: CONNECT: result 0 0 32 0 @result 0 0 32 0 79 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.v TRUE 80 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.inc FALSE 81 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.cmp FALSE 82 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.bsf TRUE 83 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16_inst.v FALSE 84 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16_bb.v TRUE 85 | // Retrieval info: LIB_FILE: lpm 86 | -------------------------------------------------------------------------------- /src/neuralFPGA/multiplier_32_bb.v: -------------------------------------------------------------------------------- 1 | // megafunction wizard: %LPM_MULT%VBB% 2 | // GENERATION: STANDARD 3 | // VERSION: WM1.0 4 | // MODULE: lpm_mult 5 | 6 | // ============================================================ 7 | // File Name: multiplier_32.v 8 | // Megafunction Name(s): 9 | // lpm_mult 10 | // 11 | // Simulation Library Files(s): 12 | // lpm 13 | // ============================================================ 14 | // ************************************************************ 15 | // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! 16 | // 17 | // 15.0.0 Build 145 04/22/2015 SJ Web Edition 18 | // ************************************************************ 19 | 20 | //Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 21 | //Your use of Altera Corporation's design tools, logic functions 22 | //and other software and tools, and its AMPP partner logic 23 | //functions, and any output files from any of the foregoing 24 | //(including device programming or simulation files), and any 25 | //associated documentation or information are expressly subject 26 | //to the terms and conditions of the Altera Program License 27 | //Subscription Agreement, the Altera Quartus II License Agreement, 28 | //the Altera MegaCore Function License Agreement, or other 29 | //applicable license agreement, including, without limitation, 30 | //that your use is for the sole purpose of programming logic 31 | //devices manufactured by Altera and sold by Altera or its 32 | //authorized distributors. Please refer to the applicable 33 | //agreement for further details. 34 | 35 | module multiplier_32 ( 36 | dataa, 37 | datab, 38 | result); 39 | 40 | input [31:0] dataa; 41 | input [31:0] datab; 42 | output [63:0] result; 43 | 44 | endmodule 45 | 46 | // ============================================================ 47 | // CNX file retrieval info 48 | // ============================================================ 49 | // Retrieval info: PRIVATE: AutoSizeResult NUMERIC "1" 50 | // Retrieval info: PRIVATE: B_isConstant NUMERIC "0" 51 | // Retrieval info: PRIVATE: ConstantB NUMERIC "0" 52 | // Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" 53 | // Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "0" 54 | // Retrieval info: PRIVATE: Latency NUMERIC "0" 55 | // Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" 56 | // Retrieval info: PRIVATE: SignedMult NUMERIC "1" 57 | // Retrieval info: PRIVATE: USE_MULT NUMERIC "1" 58 | // Retrieval info: PRIVATE: ValidConstant NUMERIC "0" 59 | // Retrieval info: PRIVATE: WidthA NUMERIC "32" 60 | // Retrieval info: PRIVATE: WidthB NUMERIC "32" 61 | // Retrieval info: PRIVATE: WidthP NUMERIC "64" 62 | // Retrieval info: PRIVATE: aclr NUMERIC "0" 63 | // Retrieval info: PRIVATE: clken NUMERIC "0" 64 | // Retrieval info: PRIVATE: new_diagram STRING "1" 65 | // Retrieval info: PRIVATE: optimize NUMERIC "0" 66 | // Retrieval info: LIBRARY: lpm lpm.lpm_components.all 67 | // Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=5" 68 | // Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "SIGNED" 69 | // Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT" 70 | // Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "32" 71 | // Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "32" 72 | // Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "64" 73 | // Retrieval info: USED_PORT: dataa 0 0 32 0 INPUT NODEFVAL "dataa[31..0]" 74 | // Retrieval info: USED_PORT: datab 0 0 32 0 INPUT NODEFVAL "datab[31..0]" 75 | // Retrieval info: USED_PORT: result 0 0 64 0 OUTPUT NODEFVAL "result[63..0]" 76 | // Retrieval info: CONNECT: @dataa 0 0 32 0 dataa 0 0 32 0 77 | // Retrieval info: CONNECT: @datab 0 0 32 0 datab 0 0 32 0 78 | // Retrieval info: CONNECT: result 0 0 64 0 @result 0 0 64 0 79 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32.v TRUE 80 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32.inc FALSE 81 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32.cmp FALSE 82 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32.bsf TRUE 83 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32_inst.v FALSE 84 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_32_bb.v TRUE 85 | // Retrieval info: LIB_FILE: lpm 86 | -------------------------------------------------------------------------------- /src/java/neuralFPGA/multiplier_16_bb.v: -------------------------------------------------------------------------------- 1 | // megafunction wizard: %LPM_MULT%VBB% 2 | // GENERATION: STANDARD 3 | // VERSION: WM1.0 4 | // MODULE: lpm_mult 5 | 6 | // ============================================================ 7 | // File Name: multiplier_16.v 8 | // Megafunction Name(s): 9 | // lpm_mult 10 | // 11 | // Simulation Library Files(s): 12 | // lpm 13 | // ============================================================ 14 | // ************************************************************ 15 | // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! 16 | // 17 | // 15.0.0 Build 145 04/22/2015 SJ Web Edition 18 | // ************************************************************ 19 | 20 | //Copyright (C) 1991-2015 Altera Corporation. All rights reserved. 21 | //Your use of Altera Corporation's design tools, logic functions 22 | //and other software and tools, and its AMPP partner logic 23 | //functions, and any output files from any of the foregoing 24 | //(including device programming or simulation files), and any 25 | //associated documentation or information are expressly subject 26 | //to the terms and conditions of the Altera Program License 27 | //Subscription Agreement, the Altera Quartus II License Agreement, 28 | //the Altera MegaCore Function License Agreement, or other 29 | //applicable license agreement, including, without limitation, 30 | //that your use is for the sole purpose of programming logic 31 | //devices manufactured by Altera and sold by Altera or its 32 | //authorized distributors. Please refer to the applicable 33 | //agreement for further details. 34 | 35 | module multiplier_16 ( 36 | dataa, 37 | datab, 38 | result); 39 | 40 | input [15:0] dataa; 41 | input [15:0] datab; 42 | output [31:0] result; 43 | 44 | endmodule 45 | 46 | // ============================================================ 47 | // CNX file retrieval info 48 | // ============================================================ 49 | // Retrieval info: PRIVATE: AutoSizeResult NUMERIC "1" 50 | // Retrieval info: PRIVATE: B_isConstant NUMERIC "0" 51 | // Retrieval info: PRIVATE: ConstantB NUMERIC "0" 52 | // Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" 53 | // Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "0" 54 | // Retrieval info: PRIVATE: Latency NUMERIC "0" 55 | // Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" 56 | // Retrieval info: PRIVATE: SignedMult NUMERIC "1" 57 | // Retrieval info: PRIVATE: USE_MULT NUMERIC "1" 58 | // Retrieval info: PRIVATE: ValidConstant NUMERIC "0" 59 | // Retrieval info: PRIVATE: WidthA NUMERIC "16" 60 | // Retrieval info: PRIVATE: WidthB NUMERIC "16" 61 | // Retrieval info: PRIVATE: WidthP NUMERIC "32" 62 | // Retrieval info: PRIVATE: aclr NUMERIC "0" 63 | // Retrieval info: PRIVATE: clken NUMERIC "0" 64 | // Retrieval info: PRIVATE: new_diagram STRING "1" 65 | // Retrieval info: PRIVATE: optimize NUMERIC "0" 66 | // Retrieval info: LIBRARY: lpm lpm.lpm_components.all 67 | // Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=5" 68 | // Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "SIGNED" 69 | // Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT" 70 | // Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "16" 71 | // Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "16" 72 | // Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "32" 73 | // Retrieval info: USED_PORT: dataa 0 0 16 0 INPUT NODEFVAL "dataa[15..0]" 74 | // Retrieval info: USED_PORT: datab 0 0 16 0 INPUT NODEFVAL "datab[15..0]" 75 | // Retrieval info: USED_PORT: result 0 0 32 0 OUTPUT NODEFVAL "result[31..0]" 76 | // Retrieval info: CONNECT: @dataa 0 0 16 0 dataa 0 0 16 0 77 | // Retrieval info: CONNECT: @datab 0 0 16 0 datab 0 0 16 0 78 | // Retrieval info: CONNECT: result 0 0 32 0 @result 0 0 32 0 79 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.v TRUE 80 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.inc FALSE 81 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.cmp FALSE 82 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16.bsf TRUE 83 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16_inst.v FALSE 84 | // Retrieval info: GEN_FILE: TYPE_NORMAL multiplier_16_bb.v TRUE 85 | // Retrieval info: LIB_FILE: lpm 86 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/examples/cascade_train.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #include 21 | 22 | #include "fann.h" 23 | 24 | 25 | int main() 26 | { 27 | struct fann *ann; 28 | struct fann_train_data *train_data, *test_data; 29 | const float desired_error = (const float)0.0; 30 | unsigned int max_neurons = 30; 31 | unsigned int neurons_between_reports = 1; 32 | unsigned int bit_fail_train, bit_fail_test; 33 | float mse_train, mse_test; 34 | unsigned int i = 0; 35 | fann_type *output; 36 | fann_type steepness; 37 | int multi = 0; 38 | enum fann_activationfunc_enum activation; 39 | enum fann_train_enum training_algorithm = FANN_TRAIN_RPROP; 40 | 41 | printf("Reading data.\n"); 42 | 43 | train_data = fann_read_train_from_file("../datasets/parity8.train"); 44 | test_data = fann_read_train_from_file("../datasets/parity8.test"); 45 | 46 | fann_scale_train_data(train_data, -1, 1); 47 | fann_scale_train_data(test_data, -1, 1); 48 | 49 | printf("Creating network.\n"); 50 | 51 | ann = fann_create_shortcut(2, fann_num_input_train_data(train_data), fann_num_output_train_data(train_data)); 52 | 53 | fann_set_training_algorithm(ann, training_algorithm); 54 | fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); 55 | fann_set_activation_function_output(ann, FANN_LINEAR); 56 | fann_set_train_error_function(ann, FANN_ERRORFUNC_LINEAR); 57 | 58 | if(!multi) 59 | { 60 | /*steepness = 0.5;*/ 61 | steepness = 1; 62 | fann_set_cascade_activation_steepnesses(ann, &steepness, 1); 63 | /*activation = FANN_SIN_SYMMETRIC;*/ 64 | activation = FANN_SIGMOID_SYMMETRIC; 65 | 66 | fann_set_cascade_activation_functions(ann, &activation, 1); 67 | fann_set_cascade_num_candidate_groups(ann, 8); 68 | } 69 | 70 | if(training_algorithm == FANN_TRAIN_QUICKPROP) 71 | { 72 | fann_set_learning_rate(ann, 0.35f); 73 | fann_randomize_weights(ann, -2.0f, 2.0f); 74 | } 75 | 76 | fann_set_bit_fail_limit(ann, (fann_type)0.9); 77 | fann_set_train_stop_function(ann, FANN_STOPFUNC_BIT); 78 | fann_print_parameters(ann); 79 | 80 | fann_save(ann, "cascade_train2.net"); 81 | 82 | printf("Training network.\n"); 83 | 84 | fann_cascadetrain_on_data(ann, train_data, max_neurons, neurons_between_reports, desired_error); 85 | 86 | fann_print_connections(ann); 87 | 88 | mse_train = fann_test_data(ann, train_data); 89 | bit_fail_train = fann_get_bit_fail(ann); 90 | mse_test = fann_test_data(ann, test_data); 91 | bit_fail_test = fann_get_bit_fail(ann); 92 | 93 | printf("\nTrain error: %f, Train bit-fail: %d, Test error: %f, Test bit-fail: %d\n\n", 94 | mse_train, bit_fail_train, mse_test, bit_fail_test); 95 | 96 | for(i = 0; i < train_data->num_data; i++) 97 | { 98 | output = fann_run(ann, train_data->input[i]); 99 | if((train_data->output[i][0] >= 0 && output[0] <= 0) || 100 | (train_data->output[i][0] <= 0 && output[0] >= 0)) 101 | { 102 | printf("ERROR: %f does not match %f\n", train_data->output[i][0], output[0]); 103 | } 104 | } 105 | 106 | printf("Saving network.\n"); 107 | 108 | fann_save(ann, "cascade_train.net"); 109 | 110 | printf("Cleaning up.\n"); 111 | fann_destroy_train(train_data); 112 | fann_destroy_train(test_data); 113 | fann_destroy(ann); 114 | 115 | return 0; 116 | } 117 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/src/include/compat_time.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Originally timeval.h by Wu Yongwei 4 | 5 | Fast Artificial Neural Network Library (fann) 6 | Copyright (C) 2003-2012 Steffen Nissen (sn@leenissen.dk) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 | */ 22 | 23 | /* 24 | * timeval.h 1.0 01/12/19 25 | * 26 | * Defines gettimeofday, timeval, etc. for Win32 27 | * 28 | * By Wu Yongwei 29 | * 30 | */ 31 | 32 | #ifndef _TIMEVAL_H 33 | #define _TIMEVAL_H 34 | 35 | #ifdef _WIN32 36 | 37 | /* Modified to compile as ANSI C without include of windows.h 38 | If this gives problems with future Windows/MSC versions, then 39 | uncomment the USE_WINDOWS_H definition to switch back. */ 40 | /* #define USE_WINDOWS_H */ 41 | #ifdef USE_WINDOWS_H 42 | #define WIN32_LEAN_AND_MEAN 43 | #include 44 | #else /* */ 45 | #ifndef _INC_WINDOWS 46 | #define VOID void 47 | #define WINAPI __stdcall 48 | #define OUT 49 | #define WINBASEAPI 50 | typedef long LONG; 51 | typedef unsigned long DWORD; 52 | typedef __int64 LONGLONG; 53 | typedef struct _FILETIME 54 | { 55 | DWORD dwLowDateTime; 56 | DWORD dwHighDateTime; 57 | } FILETIME, *LPFILETIME; 58 | typedef union _LARGE_INTEGER 59 | { 60 | 61 | /* Removed unnamed struct, 62 | * it is not ANSI C compatible */ 63 | /* struct { 64 | * DWORD LowPart; 65 | * LONG HighPart; 66 | * }; */ 67 | struct 68 | { 69 | DWORD LowPart; 70 | LONG HighPart; 71 | } u; 72 | LONGLONG QuadPart; 73 | } LARGE_INTEGER; 74 | 75 | WINBASEAPI VOID WINAPI GetSystemTimeAsFileTime(OUT LPFILETIME lpSystemTimeAsFileTime); 76 | 77 | #endif /* _INC_WINDOWS */ 78 | #endif /* USE_WINDOWS_H */ 79 | 80 | #include 81 | 82 | #ifndef __GNUC__ 83 | #define EPOCHFILETIME (116444736000000000i64) 84 | #else /* */ 85 | #define EPOCHFILETIME (116444736000000000LL) 86 | #endif /* */ 87 | struct timeval 88 | { 89 | long tv_sec; /* seconds */ 90 | long tv_usec; /* microseconds */ 91 | }; 92 | struct timezone 93 | { 94 | int tz_minuteswest; /* minutes W of Greenwich */ 95 | int tz_dsttime; /* type of dst correction */ 96 | }; 97 | __inline int gettimeofday(struct timeval *tv, struct timezone *tz) 98 | { 99 | FILETIME ft; 100 | LARGE_INTEGER li; 101 | __int64 t; 102 | static int tzflag; 103 | 104 | if(tv) 105 | 106 | { 107 | GetSystemTimeAsFileTime(&ft); 108 | 109 | /* The following two lines have been modified to use the named 110 | * union member. Unnamed members are not ANSI C compatible. */ 111 | li.u.LowPart = ft.dwLowDateTime; 112 | li.u.HighPart = ft.dwHighDateTime; 113 | t = li.QuadPart; /* In 100-nanosecond intervals */ 114 | t -= EPOCHFILETIME; /* Offset to the Epoch time */ 115 | t /= 10; /* In microseconds */ 116 | tv->tv_sec = (long) (t / 1000000); 117 | tv->tv_usec = (long) (t % 1000000); 118 | } 119 | if(tz) 120 | 121 | { 122 | if(!tzflag) 123 | 124 | { 125 | _tzset(); 126 | tzflag++; 127 | } 128 | tz->tz_minuteswest = _timezone / 60; 129 | tz->tz_dsttime = _daylight; 130 | } 131 | return 0; 132 | } 133 | 134 | 135 | #else /* _WIN32 */ 136 | 137 | #include 138 | 139 | #endif /* _WIN32 */ 140 | 141 | #endif /* _TIMEVAL_H */ 142 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/CPackSourceConfig.cmake: -------------------------------------------------------------------------------- 1 | # This file will be configured to contain variables for CPack. These variables 2 | # should be set in the CMake list file of the project before CPack module is 3 | # included. The list of available CPACK_xxx variables and their associated 4 | # documentation may be obtained using 5 | # cpack --help-variable-list 6 | # 7 | # Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME) 8 | # and some are specific to a generator 9 | # (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables 10 | # usually begin with CPACK__xxxx. 11 | 12 | 13 | SET(CPACK_BINARY_7Z "") 14 | SET(CPACK_BINARY_BUNDLE "") 15 | SET(CPACK_BINARY_CYGWIN "") 16 | SET(CPACK_BINARY_DEB "") 17 | SET(CPACK_BINARY_DRAGNDROP "") 18 | SET(CPACK_BINARY_IFW "") 19 | SET(CPACK_BINARY_NSIS "") 20 | SET(CPACK_BINARY_OSXX11 "") 21 | SET(CPACK_BINARY_PACKAGEMAKER "") 22 | SET(CPACK_BINARY_RPM "") 23 | SET(CPACK_BINARY_STGZ "") 24 | SET(CPACK_BINARY_TBZ2 "") 25 | SET(CPACK_BINARY_TGZ "") 26 | SET(CPACK_BINARY_TXZ "") 27 | SET(CPACK_BINARY_TZ "") 28 | SET(CPACK_BINARY_WIX "") 29 | SET(CPACK_BINARY_ZIP "") 30 | SET(CPACK_CMAKE_GENERATOR "Unix Makefiles") 31 | SET(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE") 32 | SET(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE") 33 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Steffen Nissen") 34 | SET(CPACK_GENERATOR "TGZ;ZIP") 35 | SET(CPACK_IGNORE_FILES "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") 36 | SET(CPACK_INSTALLED_DIRECTORIES "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source;/") 37 | SET(CPACK_INSTALL_CMAKE_PROJECTS "") 38 | SET(CPACK_INSTALL_PREFIX "/usr/local") 39 | SET(CPACK_MODULE_PATH "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/cmake/Modules") 40 | SET(CPACK_NSIS_DISPLAY_NAME "CMake .") 41 | SET(CPACK_NSIS_INSTALLER_ICON_CODE "") 42 | SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "") 43 | SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") 44 | SET(CPACK_NSIS_PACKAGE_NAME "CMake .") 45 | SET(CPACK_OSX_SYSROOT "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk") 46 | SET(CPACK_OUTPUT_CONFIG_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackConfig.cmake") 47 | SET(CPACK_PACKAGE_DEFAULT_LOCATION "/") 48 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/README.txt") 49 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast Artificial Neural Network Library (FANN)") 50 | SET(CPACK_PACKAGE_FILE_NAME "FANN-2.2.0-Source") 51 | SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake .") 52 | SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "CMake .") 53 | SET(CPACK_PACKAGE_NAME "FANN") 54 | SET(CPACK_PACKAGE_RELOCATABLE "true") 55 | SET(CPACK_PACKAGE_VENDOR "Steffen Nissen") 56 | SET(CPACK_PACKAGE_VERSION "2.2.0") 57 | SET(CPACK_PACKAGE_VERSION_MAJOR "2") 58 | SET(CPACK_PACKAGE_VERSION_MINOR "2") 59 | SET(CPACK_PACKAGE_VERSION_PATCH "0") 60 | SET(CPACK_RESOURCE_FILE_LICENSE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/COPYING.txt") 61 | SET(CPACK_RESOURCE_FILE_README "/Applications/CMake.app/Contents/share/cmake-3.2/Templates/CPack.GenericDescription.txt") 62 | SET(CPACK_RESOURCE_FILE_WELCOME "/Applications/CMake.app/Contents/share/cmake-3.2/Templates/CPack.GenericWelcome.txt") 63 | SET(CPACK_SET_DESTDIR "OFF") 64 | SET(CPACK_SOURCE_7Z "") 65 | SET(CPACK_SOURCE_CYGWIN "") 66 | SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP") 67 | SET(CPACK_SOURCE_IGNORE_FILES "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") 68 | SET(CPACK_SOURCE_INSTALLED_DIRECTORIES "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source;/") 69 | SET(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackSourceConfig.cmake") 70 | SET(CPACK_SOURCE_PACKAGE_FILE_NAME "FANN-2.2.0-Source") 71 | SET(CPACK_SOURCE_TBZ2 "") 72 | SET(CPACK_SOURCE_TGZ "") 73 | SET(CPACK_SOURCE_TOPLEVEL_TAG "Darwin-Source") 74 | SET(CPACK_SOURCE_TXZ "") 75 | SET(CPACK_SOURCE_TZ "") 76 | SET(CPACK_SOURCE_ZIP "") 77 | SET(CPACK_STRIP_FILES "") 78 | SET(CPACK_SYSTEM_NAME "Darwin") 79 | SET(CPACK_TOPLEVEL_TAG "Darwin-Source") 80 | SET(CPACK_WIX_SIZEOF_VOID_P "8") 81 | 82 | if(NOT CPACK_PROPERTIES_FILE) 83 | set(CPACK_PROPERTIES_FILE "/Users/bohanl/neuralHardware/src/FANN-2.2.0-Source/CPackProperties.cmake") 84 | endif() 85 | 86 | if(EXISTS ${CPACK_PROPERTIES_FILE}) 87 | include(${CPACK_PROPERTIES_FILE}) 88 | endif() 89 | -------------------------------------------------------------------------------- /src/java/NN_education.java~: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class NN_education { 5 | public final int nh = 4; 6 | public final double r = .1; 7 | public final int n = 5; 8 | public final int iterations = 200; 9 | 10 | public double[][] hw = new double[n][nh]; 11 | public double[] ow = new double[nh]; 12 | 13 | public static void main(String[] args) throws Exception{ 14 | BufferedReader test = new BufferedReader(new FileReader(args[0])); 15 | String line = test.readLine(); 16 | List lines = new ArrayList(); 17 | 18 | int size = 0; 19 | line = test.readLine(); 20 | while(line != null) { 21 | String[] words = line.split(","); 22 | double[] vals = new double[words.length]; 23 | for(int i = 0; i < words.length; i ++) 24 | vals[i] = Double.parseDouble(words[i]); 25 | lines.add(vals); 26 | size++; 27 | line = test.readLine(); 28 | } 29 | 30 | NN_education nn = new NN_education(); 31 | nn.BP(lines); 32 | System.out.println("TRAINING COMPLETED! NOW PREDICTING."); 33 | BufferedReader dev = new BufferedReader(new FileReader(args[1])); 34 | lines.clear(); 35 | line = dev.readLine(); 36 | line = dev.readLine(); 37 | while(line != null) { 38 | String[] words = line.split(","); 39 | double[] vals = new double[words.length]; 40 | for(int i = 0; i < words.length; i ++) 41 | vals[i] = Double.parseDouble(words[i]); 42 | lines.add(vals); 43 | size++; 44 | line = dev.readLine(); 45 | } 46 | 47 | nn.run(lines); 48 | } 49 | public void run(List dev) { 50 | for(double[] ex : dev) { 51 | double[] hid = new double[nh]; 52 | double sum; 53 | for(int h = 0; h < nh; h++) { 54 | sum = 0; 55 | for(int i = 0; i < n; i++) 56 | sum += hw[i][h] * ex[i]/100; 57 | hid[h] = 1/(1+Math.exp(-sum)); 58 | } 59 | 60 | sum = 0; 61 | for(int h = 0; h < nh; h++) 62 | sum += ow[h] * hid[h]; 63 | 64 | System.out.println((double)Math.round(1/(1+Math.exp(-sum)) * 100)); 65 | } 66 | } 67 | 68 | public void BP(List test) { 69 | double[] hid = new double[nh]; 70 | double[] hErr = new double[nh]; 71 | double out; 72 | double oErr = 0; 73 | double error = 100000; 74 | double prevError = 100001; 75 | int count = 0; 76 | 77 | //intialize hw and ow 78 | Random rand = new Random(); 79 | double sum; 80 | for(int i = 0; i < hw.length; i++) 81 | for(int j = 0; j < hw[0].length; j++) 82 | hw[i][j] = rand.nextDouble()/10; 83 | 84 | for(int i = 0; i < ow.length; i++) 85 | ow[i] = rand.nextDouble()/10; 86 | 87 | hid[0] = 1; 88 | 89 | while(prevError > error) { 90 | prevError = error; 91 | error = 0; 92 | for(double[] ex : test) { 93 | for(int h = 0; h < nh; h++) { 94 | sum = 0; 95 | for(int i = 0; i < n; i++) 96 | sum += hw[i][h] * ex[i]/100; 97 | hid[h] = 1/(1+Math.exp(-sum)); 98 | } 99 | 100 | sum = 0; 101 | for(int h = 0; h < nh; h++) 102 | sum += ow[h] * hid[h]; 103 | 104 | out = 1/(1+Math.exp(-sum)); 105 | error += (out - ex[n]/100) * (out - ex[n]/100); 106 | 107 | oErr = out * (1 - out) * (ex[n]/100 - out); 108 | 109 | for(int h = 0; h < nh; h++) { 110 | hErr[h] = hid[h] * (1 - hid[h]) * ow[h] * oErr; 111 | for(int i = 0; i < n; i++) 112 | hw[i][h] = hw[i][h] + r*hErr[h]*ex[i]; 113 | ow[h] = ow[h] + r*oErr*hid[h]; 114 | } 115 | } 116 | if (count % 10 == 0) 117 | System.out.println(error/2); 118 | count++; 119 | } 120 | } 121 | } -------------------------------------------------------------------------------- /src/java/love.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class love { 5 | public final int nh = 4; 6 | public final double r = .2; 7 | public final int n = 4; 8 | public final int iterations = 200; 9 | 10 | public double[][] hw = new double[n][nh]; 11 | public double[] ow = new double[nh]; 12 | 13 | public static void main(String[] args) throws Exception{ 14 | long startTime = System.currentTimeMillis(); 15 | BufferedReader test = new BufferedReader(new FileReader(args[0])); 16 | String line = test.readLine(); 17 | List lines = new ArrayList(); 18 | 19 | int size = 0; 20 | line = test.readLine(); 21 | while(line != null) { 22 | String[] words = line.split(","); 23 | double[] vals = new double[words.length]; 24 | for(int i = 0; i < words.length; i ++) 25 | vals[i] = Double.parseDouble(words[i]); 26 | lines.add(vals); 27 | size++; 28 | line = test.readLine(); 29 | } 30 | 31 | NN_music nn = new NN_music(); 32 | nn.BP(lines); 33 | long endTime = System.currentTimeMillis(); 34 | System.out.println("TRAINING COMPLETED in " + (endTime - startTime) + "! NOW PREDICTING."); 35 | BufferedReader dev = new BufferedReader(new FileReader(args[1])); 36 | lines.clear(); 37 | line = dev.readLine(); 38 | line = dev.readLine(); 39 | while(line != null) { 40 | String[] words = line.split(","); 41 | double[] vals = new double[words.length]; 42 | for(int i = 0; i < words.length; i ++) 43 | vals[i] = Double.parseDouble(words[i]); 44 | lines.add(vals); 45 | size++; 46 | line = dev.readLine(); 47 | } 48 | 49 | nn.run(lines); 50 | } 51 | public void run(List dev) { 52 | for(double[] ex : dev) { 53 | double[] hid = new double[nh]; 54 | double sum; 55 | for(int h = 0; h < nh; h++) { 56 | sum = 0; 57 | for(int i = 0; i < n; i++) 58 | sum += hw[i][h] * ex[i]; 59 | hid[h] = 1/(1+Math.exp(-sum)); 60 | } 61 | 62 | sum = 0; 63 | for(int h = 0; h < nh; h++) 64 | sum += ow[h] * hid[h]; 65 | 66 | if (.5 < 1/(1+Math.exp(-sum))) 67 | System.out.println("yes:" + ex[n]); 68 | else 69 | System.out.println("no:" + ex[n]); 70 | } 71 | } 72 | 73 | public void BP(List test) { 74 | double[] hid = new double[nh]; 75 | double[] hErr = new double[nh]; 76 | double out; 77 | double oErr = 0; 78 | double error = 0; 79 | 80 | //intialize hw and ow 81 | Random rand = new Random(); 82 | double sum; 83 | for(int i = 0; i < hw.length; i++) 84 | for(int j = 0; j < hw[0].length; j++) 85 | hw[i][j] = rand.nextDouble()/10; 86 | 87 | for(int i = 0; i < ow.length; i++) 88 | ow[i] = rand.nextDouble()/10; 89 | 90 | hid[0] = 1; 91 | 92 | for(int count = 0; count < iterations; count++) { 93 | error = 0; 94 | for(double[] ex : test) { 95 | for(int h = 0; h < nh; h++) { 96 | sum = 0; 97 | for(int i = 0; i < n; i++) { 98 | sum += hw[i][h] * ex[i]; 99 | } 100 | hid[h] = 1/(1+Math.exp(-sum)); 101 | } 102 | 103 | sum = 0; 104 | for(int h = 0; h < nh; h++) 105 | sum += ow[h] * hid[h]; 106 | 107 | out = 1/(1+Math.exp(-sum)); 108 | 109 | error += (out - ex[n]) * (out - ex[n]); 110 | 111 | oErr = out * (1 - out) * (ex[n] - out); 112 | 113 | for(int h = 0; h < nh; h++) { 114 | hErr[h] = hid[h] * (1 - hid[h]) * ow[h] * oErr; 115 | for(int i = 0; i < n; i++) 116 | hw[i][h] = hw[i][h] + r*hErr[h]*ex[i]; 117 | ow[h] = ow[h] + r*oErr*hid[h]; 118 | } 119 | } 120 | if (count % 10 == 0) 121 | System.out.println(error/2); 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /src/java/NN_education.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class NN_education { 5 | public final int nh = 4; 6 | public final double r = .1; 7 | public final int n = 5; 8 | public final int iterations = 200; 9 | 10 | public double[][] hw = new double[n][nh]; 11 | public double[] ow = new double[nh]; 12 | 13 | public static void main(String[] args) throws Exception{ 14 | BufferedReader test = new BufferedReader(new FileReader(args[0])); 15 | String line = test.readLine(); 16 | List lines = new ArrayList(); 17 | 18 | int size = 0; 19 | line = test.readLine(); 20 | while(line != null) { 21 | String[] words = line.split(","); 22 | double[] vals = new double[words.length]; 23 | for(int i = 0; i < words.length; i ++) 24 | vals[i] = Double.parseDouble(words[i]); 25 | lines.add(vals); 26 | size++; 27 | line = test.readLine(); 28 | } 29 | 30 | NN_education nn = new NN_education(); 31 | nn.BP(lines); 32 | System.out.println("TRAINING COMPLETED! NOW PREDICTING."); 33 | BufferedReader dev = new BufferedReader(new FileReader(args[1])); 34 | lines.clear(); 35 | line = dev.readLine(); 36 | line = dev.readLine(); 37 | while(line != null) { 38 | String[] words = line.split(","); 39 | double[] vals = new double[words.length]; 40 | for(int i = 0; i < words.length; i ++) 41 | vals[i] = Double.parseDouble(words[i]); 42 | lines.add(vals); 43 | size++; 44 | line = dev.readLine(); 45 | } 46 | 47 | nn.run(lines); 48 | } 49 | public void run(List dev) { 50 | for(double[] ex : dev) { 51 | double[] hid = new double[nh]; 52 | double sum; 53 | for(int h = 0; h < nh; h++) { 54 | sum = 0; 55 | for(int i = 0; i < n; i++) 56 | sum += hw[i][h] * ex[i]/100; 57 | hid[h] = 1/(1+Math.exp(-sum)); 58 | } 59 | 60 | sum = 0; 61 | for(int h = 0; h < nh; h++) 62 | sum += ow[h] * hid[h]; 63 | 64 | System.out.println((double)Math.round(1/(1+Math.exp(-sum)) * 100)); 65 | } 66 | } 67 | 68 | public void BP(List test) { 69 | double[] hid = new double[nh]; 70 | double[] hErr = new double[nh]; 71 | double out; 72 | double oErr = 0; 73 | double error = 100000; 74 | double prevError = 100001; 75 | int count = 0; 76 | 77 | //intialize hw and ow 78 | Random rand = new Random(); 79 | double sum; 80 | for(int i = 0; i < hw.length; i++) 81 | for(int j = 0; j < hw[0].length; j++) 82 | hw[i][j] = rand.nextDouble()/10; 83 | 84 | for(int i = 0; i < ow.length; i++) 85 | ow[i] = rand.nextDouble()/10; 86 | 87 | hid[0] = 1; 88 | 89 | while(prevError > error) { 90 | prevError = error; 91 | error = 0; 92 | for(double[] ex : test) { 93 | for(int h = 0; h < nh; h++) { 94 | sum = 0; 95 | for(int i = 0; i < n; i++) 96 | sum += hw[i][h] * ex[i]/100; 97 | hid[h] = 1/(1+Math.exp(-sum)); 98 | } 99 | 100 | sum = 0; 101 | for(int h = 0; h < nh; h++) 102 | sum += ow[h] * hid[h]; 103 | 104 | out = 1/(1+Math.exp(-sum)); 105 | error += (out - ex[n]/100) * (out - ex[n]/100); 106 | 107 | oErr = out * (1 - out) * (ex[n]/100 - out); 108 | 109 | for(int h = 0; h < nh; h++) { 110 | hErr[h] = hid[h] * (1 - hid[h]) * ow[h] * oErr; 111 | for(int i = 0; i < n; i++) 112 | hw[i][h] = hw[i][h] + r*hErr[h]*ex[i]; 113 | ow[h] = ow[h] + r*oErr*hid[h]; 114 | } 115 | } 116 | if (count % 10 == 0) 117 | System.out.println(error/2); 118 | count++; 119 | } 120 | for(int h = 0; h < nh; h++) { 121 | for(int i = 0; i < n; i++) 122 | System.out.println(hw[i][h]); 123 | System.out.println(ow[h]); 124 | } 125 | } 126 | } -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/momentums/momentums.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {993ECF93-83E8-4CD2-8F94-C33B1FB77969} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/cmake/Modules/DefineInstallationPaths.cmake: -------------------------------------------------------------------------------- 1 | if (UNIX) 2 | IF (NOT APPLICATION_NAME) 3 | MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME") 4 | SET(APPLICATION_NAME ${PROJECT_NAME}) 5 | ENDIF (NOT APPLICATION_NAME) 6 | 7 | # Suffix for Linux 8 | SET(LIB_SUFFIX 9 | CACHE STRING "Define suffix of directory name (32/64)" 10 | ) 11 | 12 | SET(EXEC_INSTALL_PREFIX 13 | "${CMAKE_INSTALL_PREFIX}" 14 | CACHE PATH "Base directory for executables and libraries" 15 | FORCE 16 | ) 17 | 18 | SET(SHARE_INSTALL_PREFIX 19 | "${CMAKE_INSTALL_PREFIX}/share" 20 | CACHE PATH "Base directory for files which go to share/" 21 | FORCE 22 | ) 23 | 24 | SET(DATA_INSTALL_PREFIX 25 | "${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}" 26 | CACHE PATH "The parent directory where applications can install their data" FORCE 27 | ) 28 | 29 | # The following are directories where stuff will be installed to 30 | SET(BIN_INSTALL_DIR 31 | "${EXEC_INSTALL_PREFIX}/bin" 32 | CACHE PATH "The ${APPLICATION_NAME} binary install dir (default prefix/bin)" 33 | FORCE 34 | ) 35 | 36 | SET(SBIN_INSTALL_DIR 37 | "${EXEC_INSTALL_PREFIX}/sbin" 38 | CACHE PATH "The ${APPLICATION_NAME} sbin install dir (default prefix/sbin)" 39 | FORCE 40 | ) 41 | 42 | SET(LIB_INSTALL_DIR 43 | "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" 44 | CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)" 45 | FORCE 46 | ) 47 | 48 | SET(LIBEXEC_INSTALL_DIR 49 | "${EXEC_INSTALL_PREFIX}/libexec" 50 | CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)" 51 | FORCE 52 | ) 53 | 54 | SET(PLUGIN_INSTALL_DIR 55 | "${LIB_INSTALL_DIR}/${APPLICATION_NAME}" 56 | CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_NAME})" 57 | FORCE 58 | ) 59 | 60 | SET(INCLUDE_INSTALL_DIR 61 | "${CMAKE_INSTALL_PREFIX}/include" 62 | CACHE PATH "The subdirectory to the header prefix (default prefix/include)" 63 | FORCE 64 | ) 65 | 66 | SET(DATA_INSTALL_DIR 67 | "${DATA_INSTALL_PREFIX}" 68 | CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})" 69 | FORCE 70 | ) 71 | 72 | SET(HTML_INSTALL_DIR 73 | "${DATA_INSTALL_PREFIX}/doc/HTML" 74 | CACHE PATH "The HTML install dir for documentation (default data/doc/html)" 75 | FORCE 76 | ) 77 | 78 | SET(ICON_INSTALL_DIR 79 | "${DATA_INSTALL_PREFIX}/icons" 80 | CACHE PATH "The icon install dir (default data/icons/)" 81 | FORCE 82 | ) 83 | 84 | SET(SOUND_INSTALL_DIR 85 | "${DATA_INSTALL_PREFIX}/sounds" 86 | CACHE PATH "The install dir for sound files (default data/sounds)" 87 | FORCE 88 | ) 89 | 90 | SET(LOCALE_INSTALL_DIR 91 | "${SHARE_INSTALL_PREFIX}/locale" 92 | CACHE PATH "The install dir for translations (default prefix/share/locale)" 93 | FORCE 94 | ) 95 | 96 | SET(XDG_APPS_DIR 97 | "${SHARE_INSTALL_PREFIX}/applications/" 98 | CACHE PATH "The XDG apps dir" 99 | FORCE 100 | ) 101 | 102 | SET(XDG_DIRECTORY_DIR 103 | "${SHARE_INSTALL_PREFIX}/desktop-directories" 104 | CACHE PATH "The XDG directory" 105 | FORCE 106 | ) 107 | 108 | SET(SYSCONF_INSTALL_DIR 109 | "${EXEC_INSTALL_PREFIX}/etc" 110 | CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)" 111 | FORCE 112 | ) 113 | 114 | SET(MAN_INSTALL_DIR 115 | "${SHARE_INSTALL_PREFIX}/man" 116 | CACHE PATH "The ${APPLICATION_NAME} man install dir (default prefix/man)" 117 | FORCE 118 | ) 119 | 120 | SET(INFO_INSTALL_DIR 121 | "${SHARE_INSTALL_PREFIX}/info" 122 | CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)" 123 | FORCE 124 | ) 125 | endif (UNIX) 126 | 127 | if (WIN32) 128 | # Same same 129 | SET(BIN_INSTALL_DIR .) 130 | SET(SBIN_INSTALL_DIR .) 131 | SET(LIB_INSTALL_DIR .) 132 | SET(PLUGIN_INSTALL_DIR plugins) 133 | SET(HTML_INSTALL_DIR doc/HTML) 134 | SET(ICON_INSTALL_DIR .) 135 | SET(SOUND_INSTALL_DIR .) 136 | SET(LOCALE_INSTALL_DIR lang) 137 | endif (WIN32) 138 | 139 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/cascade_train/cascade_train.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CD6C5091-1707-45BA-B315-FAE26681273C} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/robot/robot.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {EBF27BE8-5C32-4B56-BBF2-775C8FDD79CE} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/mushroom/mushroom.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {F778B8E7-5F1A-4FF2-A89F-FDCCDA78D443} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/scaling_test/scaling_test.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {D5BC4B59-3D19-4BDC-A036-48194D5AE648} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/scaling_train/scaling_train.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {D4B30644-C503-4541-9082-17A10A09C2A3} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/simple_train_double/simple_train_double.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {A306D2FD-EE79-46BD-AE87-57FB11F82422} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | ..\..\src\include\doublefann.h 58 | 59 | 60 | Console 61 | true 62 | 63 | 64 | 65 | 66 | Level3 67 | 68 | 69 | MaxSpeed 70 | true 71 | true 72 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 73 | ..\..\src\include 74 | 75 | 76 | Console 77 | true 78 | true 79 | true 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | {7ffd0423-9ee1-4cb9-aaf0-6fc5f82535ff} 88 | 89 | 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_cpp_sample/xor_cpp_sample.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {F556FB08-2D23-450B-AF1F-1E226DE08421} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/steepness_train/steepness_train.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {102CE150-BE1A-4BFF-B505-FF4EDDC0AFC8} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | 58 | 59 | Console 60 | true 61 | 62 | 63 | 64 | 65 | Level3 66 | 67 | 68 | MaxSpeed 69 | true 70 | true 71 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | ..\..\src\include 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | {2f0ec4b6-b3f8-4a05-a884-b935e82e1390} 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /src/FANN-2.2.0-Source/VS2010/xor_test_fixed/xor_test_fixed.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {3A55ED6A-A42D-47A4-9E4A-FB702E7B2F7B} 15 | Win32Proj 16 | simple_train 17 | 18 | 19 | 20 | Application 21 | true 22 | Unicode 23 | 24 | 25 | Application 26 | false 27 | true 28 | Unicode 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | true 42 | $(SolutionDir)..\bin\ 43 | $(ProjectName)d 44 | 45 | 46 | false 47 | $(SolutionDir)..\bin\ 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 56 | ..\..\src\include 57 | ..\..\src\include\fixedfann.h 58 | 59 | 60 | Console 61 | true 62 | 63 | 64 | 65 | 66 | Level3 67 | 68 | 69 | MaxSpeed 70 | true 71 | true 72 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 73 | ..\..\src\include 74 | ..\..\src\include\fixedfann.h 75 | 76 | 77 | Console 78 | true 79 | true 80 | true 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | {80ee4a35-e029-4e6e-914d-899d409f40df} 89 | 90 | 91 | 92 | 93 | 94 | --------------------------------------------------------------------------------