URL
https://opencores.org/ocsvn/connect-6/connect-6/trunk
Subversion Repositories connect-6
Compare Revisions
- This comparison shows the changes necessary to convert path
/connect-6/trunk/BUILD_SCC
- from Rev 2 to Rev 4
- ↔ Reverse comparison
Rev 2 → Rev 4
/scc_scripts/run_imp_window.tcl
0,0 → 1,48
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_window] { delete_implementation imp_window } |
create_implementation imp_window |
|
set_implementation_params -systemc_source no |
#set_implementation_params -memory_return_path_external_delay 0% |
#set_implementation_params -memory_forward_path_external_delay 0% |
#set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
#set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp" |
set_implementation_params -proc threat_window |
#set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
#set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
#set_implementation_params -force_independent_stalldomain_tcab yes |
set_implementation_params -init_data_registers yes |
#set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
#set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
#set_implementation_params -allow_latency_violation no |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
#csim -synthesize -dump_memory_access_trace -sim_after_synth_phase 5 |
create_rtl_package |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_threat.tcl
0,0 → 1,52
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_threat] { delete_implementation imp_threat } |
create_implementation imp_threat |
|
set_implementation_params -systemc_source no |
set_implementation_params -memory_return_path_external_delay 0% |
set_implementation_params -memory_forward_path_external_delay 0% |
set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -import_tcab "imp_line" |
#imp_line" |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp" |
set_implementation_params -proc ai_threats |
set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never |
set_implementation_params -device ep3c25-ea144-7 |
set_implementation_params -force_independent_stalldomain_tcab yes |
set_implementation_params -init_data_registers yes |
set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
set_implementation_params -allow_latency_violation no |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
#csim -synthesize -dump_memory_access_trace |
#csim -synthesize with -dump_memory_access_trace -sim_after_synth_phase 5 |
create_rtl_package |
csim -synthesize |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_line.tcl
0,0 → 1,49
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_line] { delete_implementation imp_line } |
create_implementation imp_line |
|
set_implementation_params -systemc_source no |
#set_implementation_params -memory_return_path_external_delay 0% |
#set_implementation_params -memory_forward_path_external_delay 0% |
#set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -import_tcab "imp_window" |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
#set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp" |
set_implementation_params -proc threat_line |
#set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
#set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
#set_implementation_params -force_independent_stalldomain_tcab yes |
set_implementation_params -init_data_registers yes |
#set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
#set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
#set_implementation_params -allow_latency_violation no |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
csim -synthesize -dump_memory_access_trace -sim_after_synth_phase 5 |
create_rtl_package |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_adjacent.tcl
0,0 → 1,46
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_adjacent] { delete_implementation imp_adjacent } |
create_implementation imp_adjacent |
|
set_implementation_params -systemc_source no |
set_implementation_params -memory_return_path_external_delay 0% |
set_implementation_params -memory_forward_path_external_delay 0% |
set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles " ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp" |
set_implementation_params -proc ai_adjacent |
set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
set_implementation_params -init_data_registers yes |
set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
set_implementation_params -allow_latency_violation no |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
#csim -synthesize -dump_memory_access_trace |
create_rtl_package |
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_connect.tcl
0,0 → 1,49
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_connect] { delete_implementation imp_connect } |
create_implementation imp_connect |
|
set_implementation_params -systemc_source no |
set_implementation_params -memory_return_path_external_delay 0% |
set_implementation_params -memory_forward_path_external_delay 0% |
set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -import_tcab "imp_threat imp_adjacent" |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/connect6_synth.cpp" |
set_implementation_params -proc connect6ai_synth |
set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
set_implementation_params -init_data_registers yes |
set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
set_implementation_params -allow_latency_violation no |
set_implementation_params -tcab_deployment conditional_outputs:yes |
#setvar preprocess_auxopts "-Xmax_loops_for_jamming=15" |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
csim -synthesize -dump_memory_access_trace -sim_after_synth_phase 5 |
create_rtl_package |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_marks.tcl
0,0 → 1,47
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_marks] { delete_implementation imp_marks } |
create_implementation imp_marks |
|
set_implementation_params -systemc_source no |
set_implementation_params -memory_return_path_external_delay 0% |
set_implementation_params -memory_forward_path_external_delay 0% |
set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp" |
set_implementation_params -proc ai_marks |
set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
set_implementation_params -force_independent_stalldomain_tcab yes |
set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
set_implementation_params -init_data_registers yes |
set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
#csim -synthesize -dump_memory_access_trace |
create_rtl_package |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/scc_scripts/run_imp_choose.tcl
0,0 → 1,48
set SYNTH_SRC "synth_src" |
set_project_params -directory ./ |
set_project_params -results myboard.txt |
set_project_params -sources "${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/main.cpp ${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/util.cpp" |
set_project_params -headers "${SYNTH_SRC}/connect6.h ${SYNTH_SRC}/connect6_synth.h ${SYNTH_SRC}/shared.h ${SYNTH_SRC}/threats.h ${SYNTH_SRC}/util.h" |
|
if [file exists imp_choose] { delete_implementation imp_choose } |
create_implementation imp_choose |
|
set_implementation_params -systemc_source no |
set_implementation_params -memory_return_path_external_delay 0% |
set_implementation_params -memory_forward_path_external_delay 0% |
set_implementation_params -instream_forward_path_external_delay 0% |
set_implementation_params -sccompiler_args "-DDONT_VERIFY_PPAID" |
set_implementation_params -outstream_return_path_external_delay 0% |
set_implementation_params -appfiles "${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/connect6_synth.cpp" |
set_implementation_params -proc aimoves_choose |
set_implementation_params -memory_forward_boundary_register infer |
set_implementation_params -techlib altera-cyclone3 |
set_implementation_params -memory_return_boundary_register infer |
set_implementation_params -cexec_args "-port /dev/ttyS0 -player L" |
set_implementation_params -host_memory_access never,,, |
set_implementation_params -device ep3c25-ea144-7 |
set_implementation_params -init_data_registers yes |
set_implementation_params -outstream_forward_path_external_delay 0% |
set_implementation_params -build_tcab yes |
set_implementation_params -reset_data_registers yes |
set_implementation_params -instream_return_path_external_delay 0% |
set_implementation_params -clock_freq 100 |
set_implementation_params -allow_latency_violation no |
#set_implementation_params -memory_size "moves.data:moves_size" |
#set_implementation_params -user_supplied_fpga_memory_read_write_ports separate |
#set_implementation_params -internal_blockram_memory_read_write_ports separate |
|
|
|
|
csim -golden -cexec_args "-port /dev/ttyS0 -player L" |
preprocess |
csim -preprocess -cexec_args "-port /dev/ttyS0 -player L" |
schedule |
csim -schedule -cexec_args "-port /dev/ttyS0 -player L" |
synthesize |
#csim -synthesize -dump_memory_access_trace |
create_rtl_package |
|
#set_implementation_params -simulator modelsim |
#vlogsim -offline -dotasks 1-30 |
/DE2/constraints.sdc
0,0 → 1,5
# clocks |
|
create_clock -period 20.0 -name clk [get_ports OSC_50] |
# input/output delays |
|
/DE2/RS232_Controller.v
0,0 → 1,18
module RS232_Controller(oDATA,iDATA,oTxD,oTxD_Busy,iTxD_Start, |
iRxD,oRxD_Ready,oRxD_ERROR,oRxD_idle,iCLK,RST_n); |
input [7:0] iDATA; |
input iTxD_Start,iRxD,iCLK,RST_n; |
output [7:0] oDATA; |
output oTxD,oTxD_Busy,oRxD_Ready,oRxD_ERROR,oRxD_idle; |
|
async_receiver u0 ( /*.RST_n(RST_n),*/.clk(iCLK), .RxD(iRxD), |
.RxD_data_ready(oRxD_Ready),/*.RxD_data_error(oRxD_ERROR),*/ |
.RxD_data(oDATA),.RxD_idle(oRxD_idle)); |
//serie u0 ( .n_reset(RST_n),.clk(iCLK), .rx_in(iRxD), |
// .d_rdy(oRxD_Ready),.d_err(oRxD_ERROR), |
// .rx_data(oDATA)); |
async_transmitter u1 ( /*.RST_n(RST_n),*/.clk(iCLK), .TxD_start(iTxD_Start), |
.TxD_data(iDATA), .TxD(oTxD), |
.TxD_busy(oTxD_Busy)); |
|
endmodule |
DE2/RS232_Controller.v
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/CMD_Decode_simple.v
===================================================================
--- DE2/CMD_Decode_simple.v (nonexistent)
+++ DE2/CMD_Decode_simple.v (revision 4)
@@ -0,0 +1,308 @@
+
+module CMD_Decode( // USB JTAG
+ iRXD_DATA,oTXD_DATA,iRXD_Ready,iTXD_Done,oTXD_Start,
+ // AI
+ oAI_DATA,iAI_DATA,oAI_Start,iAI_Done,oCOLOR,
+ // Control
+ iCLK,iRST_n,oAI_RSTn,
+ //Debug
+ d_cmd
+ );
+// USB JTAG
+input [7:0] iRXD_DATA;
+input iRXD_Ready,iTXD_Done;
+output [7:0] oTXD_DATA;
+output oTXD_Start;
+// AI
+input [63:0] iAI_DATA;
+output [63:0] oAI_DATA;
+output reg oAI_Start;
+input iAI_Done;
+output [7:0] oCOLOR;
+// Control
+input iCLK,iRST_n;
+output oAI_RSTn =AI_RSTn;
+//Debug
+output [16:0] d_cmd ;
+// Internal Register
+reg [63:0] CMD_Tmp;
+reg [71:0] AI_RESULT;
+reg [71:0] AI_RESULT_next;
+reg [2:0] mAI_ST;
+reg [2:0] mAI_ST_next;
+
+reg [63:0] AI_INPUT;
+reg [63:0] AI_INPUT_next;
+reg [16:0] AI_INPUT_MOVE;
+reg [16:0] AI_INPUT_MOVE_next;
+// USB JTAG TXD Output
+reg oSR_TXD_Start;
+reg [7:0] oSR_TXD_DATA;
+
+//
+reg AI_RSTn;
+reg [16:0] move_count_me,move_count_you; //maximum no. of moves= 361
+reg [16:0] move_count_me_next; //maximum no. of moves= 361
+wire [16:0] move_count=(move_count_me+move_count_you) >> 2;
+
+reg [7:0] CMD;
+
+reg TXD_Start;
+reg TXD_Start_next;
+reg rst_count;
+assign oTXD_Start =TXD_Start;
+assign d_cmd=AI_INPUT_MOVE;
+assign oCOLOR = CMD;
+
+/////////////////////////////////////////////////////////
+/////// Shift Register For Command Temp /////////////
+always@(posedge iCLK or negedge iRST_n)
+begin
+ if(!iRST_n)
+ begin
+ CMD_Tmp<=0;
+ CMD<=0;
+ move_count_you<=0;
+ AI_RSTn<=1'b0;
+ end
+ else
+ begin
+ CMD_Tmp<=CMD_Tmp;
+ CMD<=CMD;
+ move_count_you<=move_count_you;
+ AI_RSTn<=AI_RSTn;
+ if(iRXD_Ready)
+ begin
+ CMD_Tmp<={CMD_Tmp[55:0],iRXD_DATA};
+
+
+ if(iRXD_DATA !=8'h44 && iRXD_DATA!=8'h4C)
+ begin
+
+ move_count_you<=move_count_you+1;//4 ascii chars == 1 move
+ AI_RSTn<=1'b1;
+ end
+ else
+ begin
+
+ CMD<=iRXD_DATA;
+ move_count_you<=0;
+ AI_RSTn<=1'b0;
+
+ end
+ end
+ else
+
+ AI_RSTn<=1'b1;
+ end
+end
+/////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////
+//////////////// AI Control /////////////////////
+reg [3:0] wait_count;
+reg [3:0] wait_count_next;
+reg [3:0] NO_OF_MOVES;
+reg [3:0] NO_OF_MOVES_next;
+
+
+always@(posedge iCLK or negedge AI_RSTn)
+
+begin
+ if(!AI_RSTn)
+ begin
+ mAI_ST<=0;
+ wait_count <=0;
+ move_count_me<=0;
+ AI_RESULT<=0;
+ TXD_Start<=1'b0;
+ NO_OF_MOVES<=0;
+ AI_INPUT<=0;
+ AI_INPUT_MOVE<=0;
+
+ end
+ else
+ begin
+ mAI_ST<=mAI_ST_next;
+ wait_count <=wait_count_next;
+ move_count_me<=move_count_me_next;
+ AI_RESULT<=AI_RESULT_next;
+ TXD_Start<=TXD_Start_next;
+ NO_OF_MOVES<=NO_OF_MOVES_next;
+ AI_INPUT<=AI_INPUT_next;
+ AI_INPUT_MOVE<=AI_INPUT_MOVE_next;
+
+ end
+end
+
+
+always@*//(mAI_ST,move_count,iTXD_Done,TXD_Start,iAI_Done,iAI_DATA)
+begin
+ mAI_ST_next<=mAI_ST;
+ wait_count_next<=wait_count;
+ move_count_me_next<=move_count_me;
+ AI_RESULT_next<=AI_RESULT;
+ TXD_Start_next<=TXD_Start;
+ NO_OF_MOVES_next<=NO_OF_MOVES;
+ AI_INPUT_next <=AI_INPUT;
+ AI_INPUT_MOVE_next<=AI_INPUT_MOVE;
+ case(mAI_ST)
+
+
+ 0: begin
+ if( (CMD == 8'h44) && (move_count ==0))
+ begin
+ mAI_ST_next <= 1;
+ AI_INPUT_next<=CMD_Tmp;
+ AI_INPUT_MOVE_next<=move_count;
+ end
+ else if ( (CMD == 8'h4C) && (move_count ==1))
+ begin
+ mAI_ST_next <= 4;
+ AI_INPUT_next<=CMD_Tmp;
+ AI_INPUT_MOVE_next<=move_count;
+ end
+
+ else
+ mAI_ST_next <= 0;
+
+
+
+ end
+ 1: begin
+ mAI_ST_next <= 2;
+ end
+ 2: begin
+ if(iAI_Done == 1'b1)
+ begin
+ mAI_ST_next <= 3;
+ NO_OF_MOVES_next<=4;
+ AI_RESULT_next[63:0]<=iAI_DATA;
+
+ end
+ else begin
+ mAI_ST_next <= 2;
+ end
+
+
+ end
+ 3: begin
+
+ if(iTXD_Done == 1'b1 && TXD_Start ==1'b0)
+ begin
+ if(wait_count==NO_OF_MOVES) begin
+ mAI_ST_next <= 4;
+ wait_count_next<=0;
+ TXD_Start_next <=1'b0;
+ end
+ else begin
+ mAI_ST_next <= 3;
+ TXD_Start_next <=1'b1;
+ wait_count_next<=wait_count+1;
+ AI_RESULT_next<={AI_RESULT[63:0],8'h0};
+ move_count_me_next<=move_count_me+1;
+ end
+ end
+ else
+ TXD_Start_next <=1'b0;
+
+ end
+ 4: begin
+ //move_count % 4 == 0 means dark's turn, (move_count % 4 == 1 ) means light's turn
+ if((((move_count % 4) == 3 ) && (CMD ==8'h44))|| (((move_count % 4) == 1 ) && (CMD ==8'h4C)))
+ begin
+ //if(((move_count ==1|| move_count ==5|| move_count ==9) && (CMD ==8'h4C)))
+ mAI_ST_next <= 5;
+ AI_INPUT_next<=CMD_Tmp;
+ AI_INPUT_MOVE_next<=move_count;
+ end
+ else
+ mAI_ST_next <= 4;
+
+ end
+ 5: begin
+ mAI_ST_next <= 6;
+ AI_INPUT_next<=CMD_Tmp;
+ end
+ 6: begin
+ if(iAI_Done == 1'b1) begin
+ mAI_ST_next <= 3;
+ AI_RESULT_next[63:0]<=iAI_DATA;
+ NO_OF_MOVES_next<=8 ;
+ end
+
+ else begin
+ mAI_ST_next <= 6;
+ AI_RESULT_next<=0;
+ NO_OF_MOVES_next<=NO_OF_MOVES;
+ end
+
+ end
+ default:mAI_ST_next <= mAI_ST_next;
+ endcase
+
+
+end
+
+assign oTXD_DATA = AI_RESULT[71:64];
+assign oAI_DATA = AI_INPUT;
+
+always@(mAI_ST)
+begin
+ case(mAI_ST)
+
+
+ 0: begin
+
+ oAI_Start <=1'b0;
+ //oAI_DATA<=0;
+
+
+ end
+ 1: begin
+ oAI_Start <=1'b1;
+ //oAI_DATA<=CMD_Tmp[63:0];
+
+
+ //end
+ end
+ 2: begin
+
+ oAI_Start <=1'b0;
+ //oAI_DATA<=0;
+ //end
+ end
+ 3: begin
+ oAI_Start <=1'b0;
+ //oAI_DATA<=0;
+
+ //end
+ end
+ 4: begin
+ oAI_Start <=1'b0;
+ //oAI_DATA<=CMD_Tmp[63:0];
+
+
+ end
+ 5: begin
+ oAI_Start <=1'b1;
+ //oAI_DATA<=CMD_Tmp[63:0];
+
+
+ //end
+ end
+ 6: begin
+ oAI_Start <=1'b0;
+ //oAI_DATA<=CMD_Tmp[63:0];
+
+
+ //end
+ end
+ default:begin
+ oAI_Start <=1'b0;
+ //oAI_DATA<=CMD_Tmp[63:0];
+ end
+ endcase
+
+
+end
+endmodule
Index: DE2/SEG7_LUT_8.v
===================================================================
--- DE2/SEG7_LUT_8.v (nonexistent)
+++ DE2/SEG7_LUT_8.v (revision 4)
@@ -0,0 +1,14 @@
+module SEG7_LUT_8 ( oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7,iDIG );
+input [31:0] iDIG;
+output [6:0] oSEG0,oSEG1,oSEG2,oSEG3,oSEG4,oSEG5,oSEG6,oSEG7;
+
+SEG7_LUT u0 ( oSEG0,iDIG[3:0] );
+SEG7_LUT u1 ( oSEG1,iDIG[7:4] );
+SEG7_LUT u2 ( oSEG2,iDIG[11:8] );
+SEG7_LUT u3 ( oSEG3,iDIG[15:12] );
+SEG7_LUT u4 ( oSEG4,iDIG[19:16] );
+SEG7_LUT u5 ( oSEG5,iDIG[23:20] );
+SEG7_LUT u6 ( oSEG6,iDIG[27:24] );
+SEG7_LUT u7 ( oSEG7,iDIG[31:28] );
+
+endmodule
\ No newline at end of file
DE2/SEG7_LUT_8.v
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/quartus.tcl
===================================================================
--- DE2/quartus.tcl (nonexistent)
+++ DE2/quartus.tcl (revision 4)
@@ -0,0 +1,549 @@
+
+#set project_name connect6ai_synth_tcab
+#set top_level connect6ai_synth_tcab
+set project_name DE2
+set top_level DE2
+set family "CycloneII"
+set device EP2C35F672C6
+set sdc_constraints ../constraints.sdc
+
+# create new project
+project_new ${project_name}
+
+# project settings
+
+set_global_assignment -name TOP_LEVEL_ENTITY ${top_level}
+set_global_assignment -name family ${family}
+set_global_assignment -name device ${device}
+set_global_assignment -name SDC_FILE ${sdc_constraints}
+set_global_assignment -name ADD_PASS_THROUGH_LOGIC_TO_INFERRED_RAMS OFF
+#set_global_assignment -name AUTO_RESOURCE_SHARING ON
+
+create_base_clock -fmax 50MHz clk -target OSC_50
+#verilog files
+set mcsfiles [glob -directory ../../../macrocells -nocomplain -tails -types f -- {*\.v}]
+foreach mcs ${mcsfiles} {
+ if [ regexp -- {assertions} ${mcs} ] {
+ continue
+}
+ set_global_assignment -name VERILOG_FILE "../../../macrocells/${mcs}"
+}
+
+set rtlfiles [glob -directory ../../../rtl -nocomplain -tails -types f -- {*\.v}]
+foreach rtl ${rtlfiles} {
+ if [ regexp -- {assertions} ${rtl} ] {
+ continue
+ }
+ set_global_assignment -name VERILOG_FILE "../../../rtl/${rtl}"
+}
+
+#DE2 files
+set de2files [glob -directory ../../../../DE2/ -nocomplain -tails -types f -- {*\.v}]
+foreach mcs ${de2files} {
+ if [ regexp -- {assertions} ${mcs} ] {
+ continue
+}
+ set_global_assignment -name VERILOG_FILE "../../../../DE2/${mcs}"
+}
+set de2files [glob -directory ../../../../DE2/ -nocomplain -tails -types f -- {*\.vhd}]
+foreach mcs ${de2files} {
+ if [ regexp -- {assertions} ${mcs} ] {
+ continue
+}
+ set_global_assignment -name VHDL_FILE "../../../../DE2/${mcs}"
+}
+
+# run the flow
+#execute_flow -compile
+
+#load_package flow
+#execute_module -tool map
+#set name_ids [get_names -filter * -node_type pin]
+#foreach_in_collection name_id $name_ids {
+# set pin_name [get_name_info -info full_path $name_id]
+# post_message "Making VIRTUAL_PIN assignment to $pin_name"
+# set_instance_assignment -to $pin_name -name VIRTUAL_PIN ON
+#}
+
+# Pin & Location Assignments
+# ==========================
+set_location_assignment PIN_N25 -to DPDT_SW[0]
+set_location_assignment PIN_N26 -to DPDT_SW[1]
+set_location_assignment PIN_P25 -to DPDT_SW[2]
+set_location_assignment PIN_AE14 -to DPDT_SW[3]
+set_location_assignment PIN_AF14 -to DPDT_SW[4]
+set_location_assignment PIN_AD13 -to DPDT_SW[5]
+set_location_assignment PIN_AC13 -to DPDT_SW[6]
+set_location_assignment PIN_C13 -to DPDT_SW[7]
+set_location_assignment PIN_B13 -to DPDT_SW[8]
+set_location_assignment PIN_A13 -to DPDT_SW[9]
+set_location_assignment PIN_N1 -to DPDT_SW[10]
+set_location_assignment PIN_P1 -to DPDT_SW[11]
+set_location_assignment PIN_P2 -to DPDT_SW[12]
+set_location_assignment PIN_T7 -to DPDT_SW[13]
+set_location_assignment PIN_U3 -to DPDT_SW[14]
+set_location_assignment PIN_U4 -to DPDT_SW[15]
+set_location_assignment PIN_V1 -to DPDT_SW[16]
+set_location_assignment PIN_V2 -to DPDT_SW[17]
+set_location_assignment PIN_T6 -to DRAM_ADDR[0]
+set_location_assignment PIN_V4 -to DRAM_ADDR[1]
+set_location_assignment PIN_V3 -to DRAM_ADDR[2]
+set_location_assignment PIN_W2 -to DRAM_ADDR[3]
+set_location_assignment PIN_W1 -to DRAM_ADDR[4]
+set_location_assignment PIN_U6 -to DRAM_ADDR[5]
+set_location_assignment PIN_U7 -to DRAM_ADDR[6]
+set_location_assignment PIN_U5 -to DRAM_ADDR[7]
+set_location_assignment PIN_W4 -to DRAM_ADDR[8]
+set_location_assignment PIN_W3 -to DRAM_ADDR[9]
+set_location_assignment PIN_Y1 -to DRAM_ADDR[10]
+set_location_assignment PIN_V5 -to DRAM_ADDR[11]
+set_location_assignment PIN_AE2 -to DRAM_BA_0
+set_location_assignment PIN_AE3 -to DRAM_BA_1
+set_location_assignment PIN_AB3 -to DRAM_CAS_N
+set_location_assignment PIN_AA6 -to DRAM_CKE
+set_location_assignment PIN_AA7 -to DRAM_CLK
+set_location_assignment PIN_AC3 -to DRAM_CS_N
+set_location_assignment PIN_V6 -to DRAM_DQ[0]
+set_location_assignment PIN_AA2 -to DRAM_DQ[1]
+set_location_assignment PIN_AA1 -to DRAM_DQ[2]
+set_location_assignment PIN_Y3 -to DRAM_DQ[3]
+set_location_assignment PIN_Y4 -to DRAM_DQ[4]
+set_location_assignment PIN_R8 -to DRAM_DQ[5]
+set_location_assignment PIN_T8 -to DRAM_DQ[6]
+set_location_assignment PIN_V7 -to DRAM_DQ[7]
+set_location_assignment PIN_W6 -to DRAM_DQ[8]
+set_location_assignment PIN_AB2 -to DRAM_DQ[9]
+set_location_assignment PIN_AB1 -to DRAM_DQ[10]
+set_location_assignment PIN_AA4 -to DRAM_DQ[11]
+set_location_assignment PIN_AA3 -to DRAM_DQ[12]
+set_location_assignment PIN_AC2 -to DRAM_DQ[13]
+set_location_assignment PIN_AC1 -to DRAM_DQ[14]
+set_location_assignment PIN_AA5 -to DRAM_DQ[15]
+set_location_assignment PIN_AD2 -to DRAM_LDQM
+set_location_assignment PIN_Y5 -to DRAM_UDQM
+set_location_assignment PIN_AB4 -to DRAM_RAS_N
+set_location_assignment PIN_AD3 -to DRAM_WE_N
+set_location_assignment PIN_AC18 -to FL_ADDR[0]
+set_location_assignment PIN_AB18 -to FL_ADDR[1]
+set_location_assignment PIN_AE19 -to FL_ADDR[2]
+set_location_assignment PIN_AF19 -to FL_ADDR[3]
+set_location_assignment PIN_AE18 -to FL_ADDR[4]
+set_location_assignment PIN_AF18 -to FL_ADDR[5]
+set_location_assignment PIN_Y16 -to FL_ADDR[6]
+set_location_assignment PIN_AA16 -to FL_ADDR[7]
+set_location_assignment PIN_AD17 -to FL_ADDR[8]
+set_location_assignment PIN_AC17 -to FL_ADDR[9]
+set_location_assignment PIN_AE17 -to FL_ADDR[10]
+set_location_assignment PIN_AF17 -to FL_ADDR[11]
+set_location_assignment PIN_W16 -to FL_ADDR[12]
+set_location_assignment PIN_W15 -to FL_ADDR[13]
+set_location_assignment PIN_AC16 -to FL_ADDR[14]
+set_location_assignment PIN_AD16 -to FL_ADDR[15]
+set_location_assignment PIN_AE16 -to FL_ADDR[16]
+set_location_assignment PIN_AC15 -to FL_ADDR[17]
+set_location_assignment PIN_AB15 -to FL_ADDR[18]
+set_location_assignment PIN_AA15 -to FL_ADDR[19]
+set_location_assignment PIN_V17 -to FL_CE_N
+set_location_assignment PIN_W17 -to FL_OE_N
+set_location_assignment PIN_AD19 -to FL_DQ[0]
+set_location_assignment PIN_AC19 -to FL_DQ[1]
+set_location_assignment PIN_AF20 -to FL_DQ[2]
+set_location_assignment PIN_AE20 -to FL_DQ[3]
+set_location_assignment PIN_AB20 -to FL_DQ[4]
+set_location_assignment PIN_AC20 -to FL_DQ[5]
+set_location_assignment PIN_AF21 -to FL_DQ[6]
+set_location_assignment PIN_AE21 -to FL_DQ[7]
+set_location_assignment PIN_AA18 -to FL_RST_N
+set_location_assignment PIN_AA17 -to FL_WE_N
+set_location_assignment PIN_AF10 -to HEX0[0]
+set_location_assignment PIN_AB12 -to HEX0[1]
+set_location_assignment PIN_AC12 -to HEX0[2]
+set_location_assignment PIN_AD11 -to HEX0[3]
+set_location_assignment PIN_AE11 -to HEX0[4]
+set_location_assignment PIN_V14 -to HEX0[5]
+set_location_assignment PIN_V13 -to HEX0[6]
+set_location_assignment PIN_V20 -to HEX1[0]
+set_location_assignment PIN_V21 -to HEX1[1]
+set_location_assignment PIN_W21 -to HEX1[2]
+set_location_assignment PIN_Y22 -to HEX1[3]
+set_location_assignment PIN_AA24 -to HEX1[4]
+set_location_assignment PIN_AA23 -to HEX1[5]
+set_location_assignment PIN_AB24 -to HEX1[6]
+set_location_assignment PIN_AB23 -to HEX2[0]
+set_location_assignment PIN_V22 -to HEX2[1]
+set_location_assignment PIN_AC25 -to HEX2[2]
+set_location_assignment PIN_AC26 -to HEX2[3]
+set_location_assignment PIN_AB26 -to HEX2[4]
+set_location_assignment PIN_AB25 -to HEX2[5]
+set_location_assignment PIN_Y24 -to HEX2[6]
+set_location_assignment PIN_Y23 -to HEX3[0]
+set_location_assignment PIN_AA25 -to HEX3[1]
+set_location_assignment PIN_AA26 -to HEX3[2]
+set_location_assignment PIN_Y26 -to HEX3[3]
+set_location_assignment PIN_Y25 -to HEX3[4]
+set_location_assignment PIN_U22 -to HEX3[5]
+set_location_assignment PIN_W24 -to HEX3[6]
+set_location_assignment PIN_U9 -to HEX4[0]
+set_location_assignment PIN_U1 -to HEX4[1]
+set_location_assignment PIN_U2 -to HEX4[2]
+set_location_assignment PIN_T4 -to HEX4[3]
+set_location_assignment PIN_R7 -to HEX4[4]
+set_location_assignment PIN_R6 -to HEX4[5]
+set_location_assignment PIN_T3 -to HEX4[6]
+set_location_assignment PIN_T2 -to HEX5[0]
+set_location_assignment PIN_P6 -to HEX5[1]
+set_location_assignment PIN_P7 -to HEX5[2]
+set_location_assignment PIN_T9 -to HEX5[3]
+set_location_assignment PIN_R5 -to HEX5[4]
+set_location_assignment PIN_R4 -to HEX5[5]
+set_location_assignment PIN_R3 -to HEX5[6]
+set_location_assignment PIN_R2 -to HEX6[0]
+set_location_assignment PIN_P4 -to HEX6[1]
+set_location_assignment PIN_P3 -to HEX6[2]
+set_location_assignment PIN_M2 -to HEX6[3]
+set_location_assignment PIN_M3 -to HEX6[4]
+set_location_assignment PIN_M5 -to HEX6[5]
+set_location_assignment PIN_M4 -to HEX6[6]
+set_location_assignment PIN_L3 -to HEX7[0]
+set_location_assignment PIN_L2 -to HEX7[1]
+set_location_assignment PIN_L9 -to HEX7[2]
+set_location_assignment PIN_L6 -to HEX7[3]
+set_location_assignment PIN_L7 -to HEX7[4]
+set_location_assignment PIN_P9 -to HEX7[5]
+set_location_assignment PIN_N9 -to HEX7[6]
+set_location_assignment PIN_G26 -to KEY[0]
+set_location_assignment PIN_N23 -to KEY[1]
+set_location_assignment PIN_P23 -to KEY[2]
+set_location_assignment PIN_W26 -to KEY[3]
+set_location_assignment PIN_AE23 -to LED_RED[0]
+set_location_assignment PIN_AF23 -to LED_RED[1]
+set_location_assignment PIN_AB21 -to LED_RED[2]
+set_location_assignment PIN_AC22 -to LED_RED[3]
+set_location_assignment PIN_AD22 -to LED_RED[4]
+set_location_assignment PIN_AD23 -to LED_RED[5]
+set_location_assignment PIN_AD21 -to LED_RED[6]
+set_location_assignment PIN_AC21 -to LED_RED[7]
+set_location_assignment PIN_AA14 -to LED_RED[8]
+set_location_assignment PIN_Y13 -to LED_RED[9]
+set_location_assignment PIN_AA13 -to LED_RED[10]
+set_location_assignment PIN_AC14 -to LED_RED[11]
+set_location_assignment PIN_AD15 -to LED_RED[12]
+set_location_assignment PIN_AE15 -to LED_RED[13]
+set_location_assignment PIN_AF13 -to LED_RED[14]
+set_location_assignment PIN_AE13 -to LED_RED[15]
+set_location_assignment PIN_AE12 -to LED_RED[16]
+set_location_assignment PIN_AD12 -to LED_RED[17]
+set_location_assignment PIN_AE22 -to LED_GREEN[0]
+set_location_assignment PIN_AF22 -to LED_GREEN[1]
+set_location_assignment PIN_W19 -to LED_GREEN[2]
+set_location_assignment PIN_V18 -to LED_GREEN[3]
+set_location_assignment PIN_U18 -to LED_GREEN[4]
+set_location_assignment PIN_U17 -to LED_GREEN[5]
+set_location_assignment PIN_AA20 -to LED_GREEN[6]
+set_location_assignment PIN_Y18 -to LED_GREEN[7]
+set_location_assignment PIN_Y12 -to LED_GREEN[8]
+set_location_assignment PIN_D13 -to OSC_27
+set_location_assignment PIN_N2 -to OSC_50
+set_location_assignment PIN_P26 -to EXT_CLOCK
+set_location_assignment PIN_D26 -to PS2_CLK
+set_location_assignment PIN_C24 -to PS2_DAT
+set_location_assignment PIN_C25 -to UART_RXD
+set_location_assignment PIN_B25 -to UART_TXD
+set_location_assignment PIN_K4 -to LCD_RW
+set_location_assignment PIN_K3 -to LCD_EN
+set_location_assignment PIN_K1 -to LCD_RS
+set_location_assignment PIN_J1 -to LCD_DATA[0]
+set_location_assignment PIN_J2 -to LCD_DATA[1]
+set_location_assignment PIN_H1 -to LCD_DATA[2]
+set_location_assignment PIN_H2 -to LCD_DATA[3]
+set_location_assignment PIN_J4 -to LCD_DATA[4]
+set_location_assignment PIN_J3 -to LCD_DATA[5]
+set_location_assignment PIN_H4 -to LCD_DATA[6]
+set_location_assignment PIN_H3 -to LCD_DATA[7]
+set_location_assignment PIN_L4 -to LCD_ON
+set_location_assignment PIN_K2 -to LCD_BLON
+set_location_assignment PIN_AE4 -to SRAM_ADDR[0]
+set_location_assignment PIN_AF4 -to SRAM_ADDR[1]
+set_location_assignment PIN_AC5 -to SRAM_ADDR[2]
+set_location_assignment PIN_AC6 -to SRAM_ADDR[3]
+set_location_assignment PIN_AD4 -to SRAM_ADDR[4]
+set_location_assignment PIN_AD5 -to SRAM_ADDR[5]
+set_location_assignment PIN_AE5 -to SRAM_ADDR[6]
+set_location_assignment PIN_AF5 -to SRAM_ADDR[7]
+set_location_assignment PIN_AD6 -to SRAM_ADDR[8]
+set_location_assignment PIN_AD7 -to SRAM_ADDR[9]
+set_location_assignment PIN_V10 -to SRAM_ADDR[10]
+set_location_assignment PIN_V9 -to SRAM_ADDR[11]
+set_location_assignment PIN_AC7 -to SRAM_ADDR[12]
+set_location_assignment PIN_W8 -to SRAM_ADDR[13]
+set_location_assignment PIN_W10 -to SRAM_ADDR[14]
+set_location_assignment PIN_Y10 -to SRAM_ADDR[15]
+set_location_assignment PIN_AB8 -to SRAM_ADDR[16]
+set_location_assignment PIN_AC8 -to SRAM_ADDR[17]
+set_location_assignment PIN_AD8 -to SRAM_DQ[0]
+set_location_assignment PIN_AE6 -to SRAM_DQ[1]
+set_location_assignment PIN_AF6 -to SRAM_DQ[2]
+set_location_assignment PIN_AA9 -to SRAM_DQ[3]
+set_location_assignment PIN_AA10 -to SRAM_DQ[4]
+set_location_assignment PIN_AB10 -to SRAM_DQ[5]
+set_location_assignment PIN_AA11 -to SRAM_DQ[6]
+set_location_assignment PIN_Y11 -to SRAM_DQ[7]
+set_location_assignment PIN_AE7 -to SRAM_DQ[8]
+set_location_assignment PIN_AF7 -to SRAM_DQ[9]
+set_location_assignment PIN_AE8 -to SRAM_DQ[10]
+set_location_assignment PIN_AF8 -to SRAM_DQ[11]
+set_location_assignment PIN_W11 -to SRAM_DQ[12]
+set_location_assignment PIN_W12 -to SRAM_DQ[13]
+set_location_assignment PIN_AC9 -to SRAM_DQ[14]
+set_location_assignment PIN_AC10 -to SRAM_DQ[15]
+set_location_assignment PIN_AE10 -to SRAM_WE_N
+set_location_assignment PIN_AD10 -to SRAM_OE_N
+set_location_assignment PIN_AF9 -to SRAM_UB_N
+set_location_assignment PIN_AE9 -to SRAM_LB_N
+set_location_assignment PIN_AC11 -to SRAM_CE_N
+set_location_assignment PIN_K7 -to OTG_ADDR[0]
+set_location_assignment PIN_F2 -to OTG_ADDR[1]
+set_location_assignment PIN_F1 -to OTG_CS_N
+set_location_assignment PIN_G2 -to OTG_RD_N
+set_location_assignment PIN_G1 -to OTG_WR_N
+set_location_assignment PIN_G5 -to OTG_RST_N
+set_location_assignment PIN_F4 -to OTG_DATA[0]
+set_location_assignment PIN_D2 -to OTG_DATA[1]
+set_location_assignment PIN_D1 -to OTG_DATA[2]
+set_location_assignment PIN_F7 -to OTG_DATA[3]
+set_location_assignment PIN_J5 -to OTG_DATA[4]
+set_location_assignment PIN_J8 -to OTG_DATA[5]
+set_location_assignment PIN_J7 -to OTG_DATA[6]
+set_location_assignment PIN_H6 -to OTG_DATA[7]
+set_location_assignment PIN_E2 -to OTG_DATA[8]
+set_location_assignment PIN_E1 -to OTG_DATA[9]
+set_location_assignment PIN_K6 -to OTG_DATA[10]
+set_location_assignment PIN_K5 -to OTG_DATA[11]
+set_location_assignment PIN_G4 -to OTG_DATA[12]
+set_location_assignment PIN_G3 -to OTG_DATA[13]
+set_location_assignment PIN_J6 -to OTG_DATA[14]
+set_location_assignment PIN_K8 -to OTG_DATA[15]
+set_location_assignment PIN_B3 -to OTG_INT0
+set_location_assignment PIN_C3 -to OTG_INT1
+set_location_assignment PIN_C2 -to OTG_DACK0_N
+set_location_assignment PIN_B2 -to OTG_DACK1_N
+set_location_assignment PIN_F6 -to OTG_DREQ0
+set_location_assignment PIN_E5 -to OTG_DREQ1
+set_location_assignment PIN_F3 -to OTG_FSPEED
+set_location_assignment PIN_G6 -to OTG_LSPEED
+set_location_assignment PIN_B14 -to TDI
+set_location_assignment PIN_A14 -to TCS
+set_location_assignment PIN_D14 -to TCK
+set_location_assignment PIN_F14 -to TDO
+set_location_assignment PIN_C4 -to TD_RESET
+set_location_assignment PIN_C8 -to VGA_R[0]
+set_location_assignment PIN_F10 -to VGA_R[1]
+set_location_assignment PIN_G10 -to VGA_R[2]
+set_location_assignment PIN_D9 -to VGA_R[3]
+set_location_assignment PIN_C9 -to VGA_R[4]
+set_location_assignment PIN_A8 -to VGA_R[5]
+set_location_assignment PIN_H11 -to VGA_R[6]
+set_location_assignment PIN_H12 -to VGA_R[7]
+set_location_assignment PIN_F11 -to VGA_R[8]
+set_location_assignment PIN_E10 -to VGA_R[9]
+set_location_assignment PIN_B9 -to VGA_G[0]
+set_location_assignment PIN_A9 -to VGA_G[1]
+set_location_assignment PIN_C10 -to VGA_G[2]
+set_location_assignment PIN_D10 -to VGA_G[3]
+set_location_assignment PIN_B10 -to VGA_G[4]
+set_location_assignment PIN_A10 -to VGA_G[5]
+set_location_assignment PIN_G11 -to VGA_G[6]
+set_location_assignment PIN_D11 -to VGA_G[7]
+set_location_assignment PIN_E12 -to VGA_G[8]
+set_location_assignment PIN_D12 -to VGA_G[9]
+set_location_assignment PIN_J13 -to VGA_B[0]
+set_location_assignment PIN_J14 -to VGA_B[1]
+set_location_assignment PIN_F12 -to VGA_B[2]
+set_location_assignment PIN_G12 -to VGA_B[3]
+set_location_assignment PIN_J10 -to VGA_B[4]
+set_location_assignment PIN_J11 -to VGA_B[5]
+set_location_assignment PIN_C11 -to VGA_B[6]
+set_location_assignment PIN_B11 -to VGA_B[7]
+set_location_assignment PIN_C12 -to VGA_B[8]
+set_location_assignment PIN_B12 -to VGA_B[9]
+set_location_assignment PIN_B8 -to VGA_CLK
+set_location_assignment PIN_D6 -to VGA_BLANK
+set_location_assignment PIN_A7 -to VGA_HS
+set_location_assignment PIN_D8 -to VGA_VS
+set_location_assignment PIN_B7 -to VGA_SYNC
+set_location_assignment PIN_A6 -to I2C_SCLK
+set_location_assignment PIN_B6 -to I2C_SDAT
+set_location_assignment PIN_J9 -to TD_DATA[0]
+set_location_assignment PIN_E8 -to TD_DATA[1]
+set_location_assignment PIN_H8 -to TD_DATA[2]
+set_location_assignment PIN_H10 -to TD_DATA[3]
+set_location_assignment PIN_G9 -to TD_DATA[4]
+set_location_assignment PIN_F9 -to TD_DATA[5]
+set_location_assignment PIN_D7 -to TD_DATA[6]
+set_location_assignment PIN_C7 -to TD_DATA[7]
+set_location_assignment PIN_D5 -to TD_HS
+set_location_assignment PIN_K9 -to TD_VS
+set_location_assignment PIN_C5 -to AUD_ADCLRCK
+set_location_assignment PIN_B5 -to AUD_ADCDAT
+set_location_assignment PIN_C6 -to AUD_DACLRCK
+set_location_assignment PIN_A4 -to AUD_DACDAT
+set_location_assignment PIN_A5 -to AUD_XCK
+set_location_assignment PIN_B4 -to AUD_BCLK
+set_location_assignment PIN_D17 -to ENET_DATA[0]
+set_location_assignment PIN_C17 -to ENET_DATA[1]
+set_location_assignment PIN_B18 -to ENET_DATA[2]
+set_location_assignment PIN_A18 -to ENET_DATA[3]
+set_location_assignment PIN_B17 -to ENET_DATA[4]
+set_location_assignment PIN_A17 -to ENET_DATA[5]
+set_location_assignment PIN_B16 -to ENET_DATA[6]
+set_location_assignment PIN_B15 -to ENET_DATA[7]
+set_location_assignment PIN_B20 -to ENET_DATA[8]
+set_location_assignment PIN_A20 -to ENET_DATA[9]
+set_location_assignment PIN_C19 -to ENET_DATA[10]
+set_location_assignment PIN_D19 -to ENET_DATA[11]
+set_location_assignment PIN_B19 -to ENET_DATA[12]
+set_location_assignment PIN_A19 -to ENET_DATA[13]
+set_location_assignment PIN_E18 -to ENET_DATA[14]
+set_location_assignment PIN_D18 -to ENET_DATA[15]
+set_location_assignment PIN_B24 -to ENET_CLK
+set_location_assignment PIN_A21 -to ENET_CMD
+set_location_assignment PIN_A23 -to ENET_CS_N
+set_location_assignment PIN_B21 -to ENET_INT
+set_location_assignment PIN_A22 -to ENET_RD_N
+set_location_assignment PIN_B22 -to ENET_WR_N
+set_location_assignment PIN_B23 -to ENET_RST_N
+set_location_assignment PIN_AE24 -to IRDA_TXD
+set_location_assignment PIN_AE25 -to IRDA_RXD
+set_location_assignment PIN_AD24 -to SD_DAT
+set_location_assignment PIN_AC23 -to SD_DAT3
+set_location_assignment PIN_Y21 -to SD_CMD
+set_location_assignment PIN_AD25 -to SD_CLK
+#set_location_assignment PIN_D25 -to GPIO_0[0]
+#set_location_assignment PIN_J22 -to GPIO_0[1]
+#set_location_assignment PIN_E26 -to GPIO_0[2]
+#set_location_assignment PIN_E25 -to GPIO_0[3]
+#set_location_assignment PIN_F24 -to GPIO_0[4]
+#set_location_assignment PIN_F23 -to GPIO_0[5]
+#set_location_assignment PIN_J21 -to GPIO_0[6]
+set_location_assignment PIN_J21 -to UART_RXD_JP1_7
+#set_location_assignment PIN_J20 -to GPIO_0[7]
+#set_location_assignment PIN_F25 -to GPIO_0[8]
+#set_location_assignment PIN_F26 -to GPIO_0[9]
+set_location_assignment PIN_N18 -to GPIO_0_10
+#set_location_assignment PIN_P18 -to GPIO_0[11]
+#set_location_assignment PIN_G23 -to GPIO_0[12]
+#set_location_assignment PIN_G24 -to GPIO_0[13]
+#set_location_assignment PIN_K22 -to GPIO_0[14]
+#set_location_assignment PIN_G25 -to GPIO_0[15]
+#set_location_assignment PIN_H23 -to GPIO_0[16]
+#set_location_assignment PIN_H24 -to GPIO_0[17]
+#set_location_assignment PIN_J23 -to GPIO_0[18]
+#set_location_assignment PIN_J24 -to GPIO_0[19]
+#set_location_assignment PIN_H25 -to GPIO_0[20]
+set_location_assignment PIN_H25 -to I_OR7_JP1_35_bis
+#set_location_assignment PIN_H26 -to GPIO_0[21]
+#set_location_assignment PIN_H19 -to GPIO_0[22]
+set_location_assignment PIN_H19 -to I_OR8_JP1_36_bis
+#set_location_assignment PIN_K18 -to GPIO_0_[23]
+#set_location_assignment PIN_K19 -to GPIO_0[24]
+set_location_assignment PIN_K19 -to UART_TXD_JP1_27
+#set_location_assignment PIN_K21 -to GPIO_0[25]
+#set_location_assignment PIN_K23 -to GPIO_0[26]
+#set_location_assignment PIN_K24 -to GPIO_0[27]
+#set_location_assignment PIN_L21 -to GPIO_0[28]
+#set_location_assignment PIN_L20 -to GPIO_0[29]
+#set_location_assignment PIN_J25 -to GPIO_0[30]
+set_location_assignment PIN_J25 -to I_OR7_JP1_35
+#set_location_assignment PIN_J26 -to GPIO_0[31]
+set_location_assignment PIN_J26 -to I_OR8_JP1_36
+#set_location_assignment PIN_L23 -to GPIO_0[32]
+set_location_assignment PIN_L23 -to CONFIG_MODE_JP1_37
+#set_location_assignment PIN_L24 -to GPIO_0[33]
+set_location_assignment PIN_L24 -to I_OT2_JP1_38
+#set_location_assignment PIN_L25 -to GPIO_0[34]
+#set_location_assignment PIN_L19 -to GPIO_0[35]
+set_location_assignment PIN_L25 -to INIT_JP1_39
+#set_location_assignment PIN_K25 -to GPIO_1[0]
+set_location_assignment PIN_K25 -to I_OT7_JP2_41
+#set_location_assignment PIN_K26 -to GPIO_1[1]
+set_location_assignment PIN_K26 -to I_OT6_JP2_42
+#set_location_assignment PIN_M22 -to GPIO_1[2]
+set_location_assignment PIN_M22 -to I_OT4_JP2_43
+#set_location_assignment PIN_M23 -to GPIO_1[3]
+set_location_assignment PIN_M23 -to I_OT3_JP2_44
+#set_location_assignment PIN_M19 -to GPIO_1[4]
+set_location_assignment PIN_M19 -to I_OT1_JP2_45
+#set_location_assignment PIN_M20 -to GPIO_1[5]
+set_location_assignment PIN_M20 -to I_OT0_JP2_46
+#set_location_assignment PIN_N20 -to GPIO_1[6]
+set_location_assignment PIN_N20 -to CONFIG_OUT0_JP2_47
+#set_location_assignment PIN_M21 -to GPIO_1[7]
+set_location_assignment PIN_M21 -to I_OL6_JP2_48
+#set_location_assignment PIN_M24 -to GPIO_1[8]
+set_location_assignment PIN_M24 -to CONFIG_OUT1_JP2_49
+#set_location_assignment PIN_M25 -to GPIO_1[9]
+set_location_assignment PIN_M25 -to I_OL3_JP2_50
+#set_location_assignment PIN_N24 -to GPIO_1_10
+set_location_assignment PIN_N24 -to I_OL7_JP2_53
+#set_location_assignment PIN_P24 -to GPIO_1[11]
+set_location_assignment PIN_P24 -to I_OL0_JP2_54
+#set_location_assignment PIN_R25 -to GPIO_1[12]
+set_location_assignment PIN_R25 -to I_OL4_JP2_55
+#set_location_assignment PIN_R24 -to GPIO_1[13]
+set_location_assignment PIN_R24 -to I_OL8_JP2_56
+#set_location_assignment PIN_R20 -to GPIO_1[14]
+set_location_assignment PIN_R20 -to I_OL1_JP2_57
+#set_location_assignment PIN_T22 -to GPIO_1[15]
+set_location_assignment PIN_T22 -to I_OT8_JP2_58
+#set_location_assignment PIN_T23 -to GPIO_1_16
+set_location_assignment PIN_T23 -to I_OL2_JP2_59
+#set_location_assignment PIN_T24 -to GPIO_1[17]
+set_location_assignment PIN_T24 -to I_OB2_JP2_60
+#set_location_assignment PIN_T25 -to GPIO_1[18]
+set_location_assignment PIN_T25 -to I_OL5_JP2_61
+#set_location_assignment PIN_T18 -to GPIO_1[19]
+set_location_assignment PIN_T18 -to I_OB5_JP2_62
+#set_location_assignment PIN_T21 -to GPIO_1[20]
+set_location_assignment PIN_T21 -to I_OT5_JP2_63
+#set_location_assignment PIN_T20 -to GPIO_1[21]
+set_location_assignment PIN_T20 -to I_OR2_JP2_64
+#set_location_assignment PIN_U26 -to GPIO_1[22]
+set_location_assignment PIN_U26 -to I_OB8_JP2_65
+#set_location_assignment PIN_U25 -to GPIO_1[23]
+set_location_assignment PIN_U25 -to CONFIG_ACK_IN_JP2_66
+#set_location_assignment PIN_U23 -to GPIO_1[24]
+set_location_assignment PIN_U23 -to I_OR5_JP2_67
+#set_location_assignment PIN_U24 -to GPIO_1[25]
+set_location_assignment PIN_U24 -to I_OB0_JP2_68
+#set_location_assignment PIN_R19 -to GPIO_1[26]
+set_location_assignment PIN_R19 -to I_OB1_JP2_71
+#set_location_assignment PIN_T19 -to GPIO_1[27]
+set_location_assignment PIN_T19 -to I_OB3_JP2_72
+#set_location_assignment PIN_U20 -to GPIO_1[28]
+set_location_assignment PIN_U20 -to I_OB4_JP2_73
+#set_location_assignment PIN_U21 -to GPIO_1[29]
+set_location_assignment PIN_U21 -to I_OB6_JP2_74
+#set_location_assignment PIN_V26 -to GPIO_1[30]
+set_location_assignment PIN_V26 -to I_OB7_JP2_75
+#set_location_assignment PIN_V25 -to GPIO_1[31]
+set_location_assignment PIN_V25 -to I_OR0_JP2_76
+#set_location_assignment PIN_V24 -to GPIO_1[32]
+set_location_assignment PIN_V24 -to I_OR1_JP2_77
+#set_location_assignment PIN_V23 -to GPIO_1[33]
+set_location_assignment PIN_V23 -to I_OR3_JP2_78
+#set_location_assignment PIN_W25 -to GPIO_1[34]
+set_location_assignment PIN_W25 -to I_OR4_JP2_79
+#set_location_assignment PIN_W23 -to GPIO_1[35]
+set_location_assignment PIN_W23 -to I_OR6_JP2_80
+
+
+# Assembler Assignments
+# =====================
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS_NO_OUTPUT_GND "AS INPUT TRI-STATED"
+
+
+export_assignments
+
+# close the project
+project_close
+
Index: DE2/do_synth
===================================================================
--- DE2/do_synth (nonexistent)
+++ DE2/do_synth (revision 4)
@@ -0,0 +1,49 @@
+
+#!/bin/sh
+
+run_logic_synthesis_only=0 ;
+while getopts ":s i" options; do
+ case $options in
+ i ) run_logic_synthesis_only=0;;
+ s ) run_logic_synthesis_only=1;;
+ ? ) echo $usage
+ exit 1;;
+ esac
+done
+
+################################
+# set up the verilog filelists:
+################################
+
+export date_of_run=`date +%Y.%m.%d_%H.%M.%S`
+mkdir run_$date_of_run
+rm -f run
+ln -s run_$date_of_run run
+
+cd run
+
+if [ $run_logic_synthesis_only -eq 1 ]; then
+ touch .LOGIC_SYNTHESIS_ONLY
+fi
+
+quartus_sh -t ../quartus.tcl
+if [[ $? != 0 ]]; then exit 1; fi
+
+quartus_map DE2
+if [[ $? != 0 ]]; then exit 1; fi
+
+if [ $run_logic_synthesis_only -eq 1 ]; then
+ quartus_fit --early_timing_estimate=realistic DE2
+ if [[ $? != 0 ]]; then exit 1; fi
+else
+ quartus_fit DE2
+ if [[ $? != 0 ]]; then exit 1; fi
+fi
+
+quartus_sta --do_report_timing DE2
+if [[ $? != 0 ]]; then exit 1; fi
+quartus_asm DE2
+quartus_pgm -c USB-Blaster -m jtag -o "p;DE2.sof"
+cd -
+exit 0
+
DE2/do_synth
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/SEG7_LUT.v
===================================================================
--- DE2/SEG7_LUT.v (nonexistent)
+++ DE2/SEG7_LUT.v (revision 4)
@@ -0,0 +1,28 @@
+module SEG7_LUT ( oSEG,iDIG );
+input [3:0] iDIG;
+output [6:0] oSEG;
+reg [6:0] oSEG;
+
+always @(iDIG)
+begin
+ case(iDIG)
+ 4'h1: oSEG = 7'b1111001; // ---t----
+ 4'h2: oSEG = 7'b0100100; // | |
+ 4'h3: oSEG = 7'b0110000; // lt rt
+ 4'h4: oSEG = 7'b0011001; // | |
+ 4'h5: oSEG = 7'b0010010; // ---m----
+ 4'h6: oSEG = 7'b0000010; // | |
+ 4'h7: oSEG = 7'b1111000; // lb rb
+ 4'h8: oSEG = 7'b0000000; // | |
+ 4'h9: oSEG = 7'b0011000; // ---b----
+ 4'ha: oSEG = 7'b0001000;
+ 4'hb: oSEG = 7'b0000011;
+ 4'hc: oSEG = 7'b1000110;
+ 4'hd: oSEG = 7'b0100001;
+ 4'he: oSEG = 7'b0000110;
+ 4'hf: oSEG = 7'b0001110;
+ 4'h0: oSEG = 7'b1000000;
+ endcase
+end
+
+endmodule
DE2/SEG7_LUT.v
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/async_receiver_altera.v
===================================================================
--- DE2/async_receiver_altera.v (nonexistent)
+++ DE2/async_receiver_altera.v (revision 4)
@@ -0,0 +1,91 @@
+module async_receiver(clk, RxD, RxD_data_ready, RxD_data, RxD_endofpacket, RxD_idle);
+input clk, RxD;
+output RxD_data_ready; // onc clock pulse when RxD_data is valid
+output [7:0] RxD_data;
+
+parameter ClkFrequency = 50000000; // 50MHz
+//parameter ClkFrequency = 27000000; // 27MHz
+parameter Baud = 115200;
+
+// We also detect if a gap occurs in the received stream of characters
+// That can be useful if multiple characters are sent in burst
+// so that multiple characters can be treated as a "packet"
+output RxD_endofpacket; // one clock pulse, when no more data is received (RxD_idle is going high)
+output RxD_idle; // no data is being received
+
+// Baud generator (we use 8 times oversampling)
+parameter Baud8 = Baud*8;
+parameter Baud8GeneratorAccWidth = 16;
+parameter Baud8GeneratorInc = ((Baud8<<(Baud8GeneratorAccWidth-7))+(ClkFrequency>>8))/(ClkFrequency>>7);
+reg [Baud8GeneratorAccWidth:0] Baud8GeneratorAcc;
+always @(posedge clk) Baud8GeneratorAcc <= Baud8GeneratorAcc[Baud8GeneratorAccWidth-1:0] + Baud8GeneratorInc;
+wire Baud8Tick = Baud8GeneratorAcc[Baud8GeneratorAccWidth];
+
+////////////////////////////
+reg [1:0] RxD_sync_inv;
+always @(posedge clk) if(Baud8Tick) RxD_sync_inv <= {RxD_sync_inv[0], ~RxD};
+// we invert RxD, so that the idle becomes "0", to prevent a phantom character to be received at startup
+
+reg [1:0] RxD_cnt_inv;
+reg RxD_bit_inv;
+
+always @(posedge clk)
+if(Baud8Tick)
+begin
+ if( RxD_sync_inv[1] && RxD_cnt_inv!=2'b11) RxD_cnt_inv <= RxD_cnt_inv + 1;
+ else
+ if(~RxD_sync_inv[1] && RxD_cnt_inv!=2'b00) RxD_cnt_inv <= RxD_cnt_inv - 1;
+
+ if(RxD_cnt_inv==2'b00) RxD_bit_inv <= 0;
+ else
+ if(RxD_cnt_inv==2'b11) RxD_bit_inv <= 1;
+end
+
+reg [3:0] state;
+reg [3:0] bit_spacing;
+
+// "next_bit" controls when the data sampling occurs
+// depending on how noisy the RxD is, different values might work better
+// with a clean connection, values from 8 to 11 work
+wire next_bit = (bit_spacing==10);
+
+always @(posedge clk)
+if(state==0)
+ bit_spacing <= 0;
+else
+if(Baud8Tick)
+ bit_spacing <= {bit_spacing[2:0] + 1} | {bit_spacing[3], 3'b000};
+
+always @(posedge clk)
+if(Baud8Tick)
+case(state)
+ 4'b0000: if(RxD_bit_inv) state <= 4'b1000; // start bit found?
+ 4'b1000: if(next_bit) state <= 4'b1001; // bit 0
+ 4'b1001: if(next_bit) state <= 4'b1010; // bit 1
+ 4'b1010: if(next_bit) state <= 4'b1011; // bit 2
+ 4'b1011: if(next_bit) state <= 4'b1100; // bit 3
+ 4'b1100: if(next_bit) state <= 4'b1101; // bit 4
+ 4'b1101: if(next_bit) state <= 4'b1110; // bit 5
+ 4'b1110: if(next_bit) state <= 4'b1111; // bit 6
+ 4'b1111: if(next_bit) state <= 4'b0001; // bit 7
+ 4'b0001: if(next_bit) state <= 4'b0000; // stop bit
+ default: state <= 4'b0000;
+endcase
+
+reg [7:0] RxD_data;
+always @(posedge clk)
+if(Baud8Tick && next_bit && state[3]) RxD_data <= {~RxD_bit_inv, RxD_data[7:1]};
+
+reg RxD_data_ready, RxD_data_error;
+always @(posedge clk)
+begin
+ RxD_data_ready <= (Baud8Tick && next_bit && state==4'b0001 && ~RxD_bit_inv); // ready only if the stop bit is received
+ RxD_data_error <= (Baud8Tick && next_bit && state==4'b0001 && RxD_bit_inv); // error if the stop bit is not received
+end
+
+reg [4:0] gap_count;
+always @(posedge clk) if (state!=0) gap_count<=0; else if(Baud8Tick & ~gap_count[4]) gap_count <= gap_count + 1;
+assign RxD_idle = gap_count[4];
+reg RxD_endofpacket; always @(posedge clk) RxD_endofpacket <= Baud8Tick & (gap_count==15);
+
+endmodule
DE2/async_receiver_altera.v
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/safe_test.vhd
===================================================================
--- DE2/safe_test.vhd (nonexistent)
+++ DE2/safe_test.vhd (revision 4)
@@ -0,0 +1,384 @@
+library ieee;
+use ieee.std_logic_1164.all;
+--use ieee.numeric_bit.all;
+use ieee.std_logic_arith.all;
+
+
+
+entity safe_test is
+generic(INPUT_LENGTH:integer:=6;OUTPUT_LENGTH:integer:=6);
+ port(
+ clk:in std_ulogic;
+ rst:in std_ulogic;
+ --Config Signals
+ init_out:out std_ulogic;
+ config_mode_out:out std_ulogic;
+ config_out0:out std_ulogic;
+ config_out1:out std_ulogic;
+ config_ack_in:in std_ulogic;
+ --DE2 Control SIgnals
+ msg_out:out std_ulogic_vector(2 downto 0);
+ Ack_count_out:out std_logic_vector(31 downto 0);
+ cmd:in std_ulogic_vector(4 downto 0);
+ --SRAM
+ SRAM_DATA_OUT: OUT std_logic_vector(15 downto 0);
+ SRAM_DATA: in std_logic_vector(15 downto 0);
+ SRAM_ADDR: out std_logic_vector(23 downto 0);
+ SRAM_WEN: out std_logic;
+ SRAM_OEN: out std_logic;
+ --SDRAM
+ SDRAM_DATA: out std_logic_vector(15 downto 0);
+ SDRAM_ADDR: out std_logic_vector(23 downto 0);
+ SDRAM_WEN: out std_logic;
+ SDRAM_OEN: out std_logic;
+ --Result Vectors
+ INPUT_ASYNC_0: in std_ulogic_vector(INPUT_LENGTH-1 downto 0);
+ INPUT_ASYNC_1: in std_ulogic_vector(INPUT_LENGTH-1 downto 0);
+ INPUT_ASYNC_ACKOUT: out std_ulogic_vector(INPUT_LENGTH-1 downto 0);
+ --Test Vectors
+ OUTPUT_ASYNC_0: out std_ulogic_vector(OUTPUT_LENGTH-1 downto 0);
+ OUTPUT_ASYNC_1: out std_ulogic_vector(OUTPUT_LENGTH-1 downto 0);
+ OUTPUT_ASYNC_ACKIN: in std_ulogic_vector(OUTPUT_LENGTH-1 downto 0);
+
+ --Trigger for oscilloscope
+ trigger: out std_ulogic
+
+ );
+end entity safe_test;
+
+
+architecture machine_a_etat of safe_test is
+component S_TO_AS_CONFIG is
+generic (BEGIN_ADDR:integer:=0;END_ADDR:integer:=0;LENGTH:integer:=16);
+ port(
+ clk:in std_ulogic;
+ rst:in std_ulogic;
+
+ SRAM_DATA_OUT: out std_logic_vector(15 downto 0);
+ SRAM_DATA: in std_logic_vector(15 downto 0);
+ SRAM_ADDR: out std_logic_vector(23 downto 0);
+ SRAM_WEN: out std_logic;
+ SRAM_OEN: out std_logic;
+
+ AS_OUT0: out std_ulogic;
+ AS_OUT1: out std_ulogic;
+ ACK_IN: in std_ulogic;
+
+ config_enable: in std_ulogic; -- Command from the state_machine up there
+ ACK_COUNT_OUT: out std_logic_vector(31 downto 0)
+ );
+end component S_TO_AS_CONFIG;
+
+component AS_TO_S_VECTOR is
+generic (BEGIN_ADDR:integer:=0;END_ADDR:integer:=0;LENGTH:integer:=16);
+ port(
+ clk:in std_ulogic;
+ rst:in std_ulogic;
+
+ SRAM_DATA: out std_logic_vector(15 downto 0);
+ SRAM_ADDR: out std_logic_vector(23 downto 0);
+ SRAM_WEN: out std_logic;
+ SRAM_OEN: out std_logic;
+
+ I_ASYNC_0: in std_ulogic_vector(LENGTH-1 downto 0);
+ I_ASYNC_1: in std_ulogic_vector(LENGTH-1 downto 0);
+ I_ASYNC_ACK_OUT: out std_ulogic_vector(LENGTH-1 downto 0);
+
+ vector_enable: in std_ulogic; -- Command from the state_machine up there
+ ACK_COUNT_OUT: out std_logic_vector(31 downto 0)
+ );
+end component AS_TO_S_VECTOR;
+
+component S_TO_AS_VECTOR is
+generic (BEGIN_ADDR:integer:=0;END_ADDR:integer:=0;LENGTH:integer:=16);
+ port(
+ clk:in std_ulogic;
+ rst:in std_ulogic;
+ trigger:out std_ulogic;
+
+ SRAM_DATA: in std_logic_vector(15 downto 0);
+ SRAM_ADDR: out std_logic_vector(23 downto 0);
+ SRAM_WEN: out std_logic;
+ SRAM_OEN: out std_logic;
+
+ O_ASYNC_0: out std_ulogic_vector(LENGTH-1 downto 0);
+ O_ASYNC_1: out std_ulogic_vector(LENGTH-1 downto 0);
+ O_ASYNC_ACK_IN: in std_ulogic_vector(LENGTH-1 downto 0);
+
+ vector_enable: in std_ulogic; -- Command from the state_machine up there
+ ACK_COUNT_OUT: out std_logic_vector(31 downto 0)
+ );
+end component S_TO_AS_VECTOR;
+
+--type STATE_TYPE is(IDLE,INIT,CONFIG,RUNNING);
+--signal state,next_state:STATE_TYPE;
+signal msg_out_int:std_ulogic_vector(2 downto 0);
+signal count:integer range 0 to integer'high;
+signal count_in,count_out:std_logic_vector(31 downto 0);
+signal config_enable,run_enable,safe_rst:std_ulogic;
+signal SRAM_DATA_TEST,SRAM_DATA_CONFIG:std_logic_vector(15 downto 0);
+signal SRAM_ADDR_TEST,SRAM_ADDR_CONFIG:std_logic_vector(23 downto 0);
+signal SRAM_WEN_CONFIG,SRAM_WEN_TEST,SRAM_OEN_CONFIG,SRAM_OEN_TEST:std_logic;
+signal trig_count:integer range 0 to integer'high;
+begin
+ msg_out<=msg_out_int;
+ TRANSLATE: S_TO_AS_CONFIG
+ generic map(BEGIN_ADDR=>0,END_ADDR=>293,LENGTH=>1)
+ port map(
+ clk=>clk,
+ rst=>rst,
+
+ SRAM_DATA_OUT=>SRAM_DATA_OUT,
+ SRAM_DATA=>SRAM_DATA,
+ SRAM_ADDR=>SRAM_ADDR_CONFIG,
+ SRAM_WEN=>SRAM_WEN_CONFIG,
+ SRAM_OEN=>SRAM_OEN_CONFIG,
+
+ AS_OUT0=>config_out0,
+ AS_OUT1=>config_out1,
+ ACK_IN=>config_ack_in,
+
+ config_enable=>config_enable,
+ ACK_COUNT_OUT=>Ack_count_out);
+
+
+ TRANSLATE_S_TO_AS:S_TO_AS_VECTOR
+ generic map(BEGIN_ADDR=>4096,END_ADDR=>4159,LENGTH=>OUTPUT_LENGTH)
+ port map(
+ clk=>clk,
+ rst=>safe_rst,
+ trigger=>trigger,
+
+ SRAM_DATA=>SRAM_DATA,
+ SRAM_ADDR=>SRAM_ADDR_TEST,
+ SRAM_WEN=>SRAM_WEN_TEST,
+ SRAM_OEN=>SRAM_OEN_TEST,
+
+ O_ASYNC_0=>OUTPUT_ASYNC_0,
+ O_ASYNC_1=>OUTPUT_ASYNC_1,
+ O_ASYNC_ACK_IN=>OUTPUT_ASYNC_ACKIN,
+
+ vector_enable=>run_enable,
+ ACK_COUNT_OUT=>count_out
+ );
+ TRANSLATE_AS_TO_S:AS_TO_S_VECTOR
+ generic map(BEGIN_ADDR=>0,END_ADDR=>63,LENGTH=>INPUT_LENGTH)
+ port map(
+ clk=>clk,
+ rst=>safe_rst,
+
+ SRAM_DATA=>SDRAM_DATA,
+ SRAM_ADDR=>SDRAM_ADDR,
+ SRAM_WEN=>SDRAM_WEN,
+ SRAM_OEN=>SDRAM_OEN,
+
+ I_ASYNC_0=>INPUT_ASYNC_0,
+ I_ASYNC_1=>INPUT_ASYNC_1,
+ I_ASYNC_ACK_OUT=>INPUT_ASYNC_ACKOUT,
+
+ vector_enable=>run_enable,
+ ACK_COUNT_OUT=>count_in
+ );
+ p1:process(cmd,SRAM_ADDR_CONFIG,SRAM_WEN_CONFIG,SRAM_OEN_CONFIG,SRAM_ADDR_TEST,SRAM_WEN_TEST,SRAM_OEN_TEST)
+ begin
+-- if(rst='0') then
+-- --state<=IDLE;
+-- msg_out_int<="111";
+-- init_out<='0';
+-- config_mode_out<='0';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='0';
+-- elsif rising_edge(clk) then
+ -- state<=next_state;
+ case cmd is
+ when "00000"=>--IDLE
+ msg_out_int<="111";
+ init_out<='0';
+ config_mode_out<='0';
+ config_enable<='0';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_CONFIG;
+ SRAM_WEN<=SRAM_WEN_CONFIG;
+ SRAM_OEN<=SRAM_OEN_CONFIG;
+ safe_rst<='0';
+
+ when "00001"=>--CONNECTED
+ msg_out_int<="000";
+ init_out<='0';
+ config_mode_out<='0';
+ config_enable<='0';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_CONFIG;
+ SRAM_WEN<=SRAM_WEN_CONFIG;
+ SRAM_OEN<=SRAM_OEN_CONFIG;
+ safe_rst<='0';
+
+ when "00011"=>--INIT
+ msg_out_int<="001";
+ init_out<='0';
+ config_mode_out<='0';
+ config_enable<='0';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_CONFIG;
+ SRAM_WEN<=SRAM_WEN_CONFIG;
+ SRAM_OEN<=SRAM_OEN_CONFIG;
+ safe_rst<='0';
+
+ when "00101"=>--CONFIG
+ msg_out_int<="010";
+ init_out<='1';
+ config_mode_out<='0';
+ config_enable<='1';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_CONFIG;
+ SRAM_WEN<=SRAM_WEN_CONFIG;
+ SRAM_OEN<=SRAM_OEN_CONFIG;
+ safe_rst<='0';
+
+ when "10001"=>--SAFE_RESET,Only I/Os there is no reset for safe!!
+ msg_out_int<="011";
+ init_out<='1';
+ config_mode_out<='1';
+ config_enable<='1';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_TEST;
+ SRAM_WEN<=SRAM_WEN_TEST;
+ SRAM_OEN<=SRAM_OEN_TEST;
+ safe_rst<='0';
+ when "01001"=>--RUNNING
+ msg_out_int<="011";
+ init_out<='1';
+ config_mode_out<='1';
+ config_enable<='1';
+ run_enable<='1';
+ SRAM_ADDR<=SRAM_ADDR_TEST;
+ SRAM_WEN<=SRAM_WEN_TEST;
+ SRAM_OEN<=SRAM_OEN_TEST;
+ safe_rst<='1';
+
+ when others=>
+ msg_out_int<= "111";
+ init_out<='1';
+ config_mode_out<='0';
+ config_enable<='0';
+ run_enable<='0';
+ SRAM_ADDR<=SRAM_ADDR_CONFIG;
+ SRAM_WEN<=SRAM_WEN_CONFIG;
+ SRAM_OEN<=SRAM_OEN_CONFIG;
+ safe_rst<='0';
+ end case;
+-- end if;
+ end process;
+
+-- p2:process(state,init_config,config_mode)
+-- begin
+-- case state is
+--
+-- when IDLE=>
+-- if(init_config='0') then
+-- next_state<=INIT;
+-- else
+-- next_state<=IDLE;
+-- end if;
+---- when CONNECT=>
+----
+---- if(init_config='0') then
+---- next_state<= INIT;
+---- else
+---- next_state<= CONNECT;
+---- end if;
+--
+-- when INIT=>
+-- if(config_mode='1') then
+-- next_state<=CONFIG;
+-- else
+-- next_state<=INIT;
+-- end if;
+--
+-- when CONFIG=>
+-- -- if(init_config='0') then
+-- -- next_state<=INIT;
+-- if(config_mode='0') then
+-- next_state<=RUNNING;
+-- elsif(config_mode='1') then
+-- next_state<=CONFIG;
+-- end if;
+--
+-- when RUNNING=>
+-- --if(init_config='0') then
+-- -- next_state<=INIT;
+-- if(config_mode='1') then
+-- next_state<=CONFIG;
+-- elsif(config_mode='0') then
+-- next_state<=RUNNING;
+-- end if;
+--
+-- when others=>
+-- next_state<=state;
+-- end case;
+-- end process;
+
+-- p3:process(state)
+-- begin
+-- case state is
+-- when IDLE=>
+-- msg_out_int<="111";
+-- init_out<='0';
+-- config_mode_out<='0';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='0';
+--
+-- when CONNECT=>
+-- msg_out_int<="000";
+-- init_out<='0';
+-- config_mode_out<='0';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='0';
+--
+-- when INIT=>
+-- msg_out_int<="001";
+-- init_out<='0';
+-- config_mode_out<='0';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='0';
+--
+-- when CONFIG=>
+-- msg_out_int<="010";
+-- init_out<='1';
+-- config_mode_out<='0';
+-- config_enable<='1';
+-- I_OL7_JP2_53<='0';
+--
+-- when RUNNING=>
+-- msg_out_int<="011";
+-- init_out<='1';
+-- config_mode_out<='1';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='1';
+--
+-- when others=>
+-- msg_out_int<= "111";
+-- init_out<='1';
+-- config_mode_out<='0';
+-- config_enable<='0';
+-- I_OL7_JP2_53<='0';
+-- end case;
+-- end process;
+-- --Main State Machine------------------------------------
+--p_trigger:process(clk,rst)
+-- begin
+-- if(rst='0') then
+-- trig_count<=0;
+-- trigger<='0';
+-- elsif rising_edge(clk) then
+-- trig_count<=trig_count+1;
+-- if(trig_count=1024) then
+-- trigger<='1';
+-- elsif(trig_count=2048) then
+-- trig_count<=0;
+-- trigger<='0';
+-- end if;
+-- end if;
+-- end process;
+--trigger<=clk;
+end architecture machine_a_etat;
Index: DE2/DE2.qpf
===================================================================
--- DE2/DE2.qpf (nonexistent)
+++ DE2/DE2.qpf (revision 4)
@@ -0,0 +1,23 @@
+# Copyright (C) 1991-2005 Altera Corporation
+# Your use of Altera Corporation's design tools, logic functions
+# and other software and tools, and its AMPP partner logic
+# functions, and any output files any of the foregoing
+# (including device programming or simulation files), and any
+# associated documentation or information are expressly subject
+# to the terms and conditions of the Altera Program License
+# Subscription Agreement, Altera MegaCore Function License
+# Agreement, or other applicable license agreement, including,
+# without limitation, that your use is for the sole purpose of
+# programming logic devices manufactured by Altera and sold by
+# Altera or its authorized distributors. Please refer to the
+# applicable agreement for further details.
+
+
+
+QUARTUS_VERSION = "5.0"
+DATE = "11:08:53 August 22, 2005"
+
+
+# Revisions
+
+PROJECT_REVISION = "DE2"
DE2/DE2.qpf
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/RS232_Command.h
===================================================================
--- DE2/RS232_Command.h (nonexistent)
+++ DE2/RS232_Command.h (revision 4)
@@ -0,0 +1,27 @@
+////////////////// Command Action /////////////////////
+parameter SETUP = 8'h61;
+parameter ERASE = 8'h72;
+parameter WRITE = 8'h83;
+parameter READ = 8'h94;
+parameter LCD_DAT = 8'h83;
+parameter LCD_CMD = 8'h94;
+////////////////// Command Target /////////////////////
+parameter LED = 8'hF0;
+parameter SEG7 = 8'hE1;
+parameter PS2 = 8'hD2;
+parameter FLASH = 8'hC3;
+parameter SDRAM = 8'hB4;
+parameter SRAM = 8'hA5;
+parameter LCD = 8'h96;
+parameter VGA = 8'h87;
+parameter SDRSEL = 8'h1F;
+parameter FLSEL = 8'h2E;
+parameter EXTIO = 8'h3D;
+parameter SET_REG = 8'h4C;
+parameter SRSEL = 8'h5B;
+parameter SAFE = 8'h6A;
+////////////////// Command Mode /////////////////////
+parameter OUTSEL = 8'h33;
+parameter NORMAL = 8'hAA;
+parameter DISPLAY = 8'hCC;
+parameter BURST = 8'hFF;
DE2/RS232_Command.h
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/DE2_USB_API.pin
===================================================================
--- DE2/DE2_USB_API.pin (nonexistent)
+++ DE2/DE2_USB_API.pin (revision 4)
@@ -0,0 +1,742 @@
+ -- Copyright (C) 1991-2010 Altera Corporation
+ -- Your use of Altera Corporation's design tools, logic functions
+ -- and other software and tools, and its AMPP partner logic
+ -- functions, and any output files from any of the foregoing
+ -- (including device programming or simulation files), and any
+ -- associated documentation or information are expressly subject
+ -- to the terms and conditions of the Altera Program License
+ -- Subscription Agreement, Altera MegaCore Function License
+ -- Agreement, or other applicable license agreement, including,
+ -- without limitation, that your use is for the sole purpose of
+ -- programming logic devices manufactured by Altera and sold by
+ -- Altera or its authorized distributors. Please refer to the
+ -- applicable agreement for further details.
+ --
+ -- This is a Quartus II output file. It is for reporting purposes only, and is
+ -- not intended for use as a Quartus II input file. This file cannot be used
+ -- to make Quartus II pin assignments - for instructions on how to make pin
+ -- assignments, please see Quartus II help.
+ ---------------------------------------------------------------------------------
+
+
+
+ ---------------------------------------------------------------------------------
+ -- NC : No Connect. This pin has no internal connection to the device.
+ -- DNU : Do Not Use. This pin MUST NOT be connected.
+ -- VCCINT : Dedicated power pin, which MUST be connected to VCC (1.2V).
+ -- VCCIO : Dedicated power pin, which MUST be connected to VCC
+ -- of its bank.
+ -- Bank 1: 3.3V
+ -- Bank 2: 3.3V
+ -- Bank 3: 3.3V
+ -- Bank 4: 3.3V
+ -- Bank 5: 3.3V
+ -- Bank 6: 3.3V
+ -- Bank 7: 3.3V
+ -- Bank 8: 3.3V
+ -- GND : Dedicated ground pin. Dedicated GND pins MUST be connected to GND.
+ -- It can also be used to report unused dedicated pins. The connection
+ -- on the board for unused dedicated pins depends on whether this will
+ -- be used in a future design. One example is device migration. When
+ -- using device migration, refer to the device pin-tables. If it is a
+ -- GND pin in the pin table or if it will not be used in a future design
+ -- for another purpose the it MUST be connected to GND. If it is an unused
+ -- dedicated pin, then it can be connected to a valid signal on the board
+ -- (low, high, or toggling) if that signal is required for a different
+ -- revision of the design.
+ -- GND+ : Unused input pin. It can also be used to report unused dual-purpose pins.
+ -- This pin should be connected to GND. It may also be connected to a
+ -- valid signal on the board (low, high, or toggling) if that signal
+ -- is required for a different revision of the design.
+ -- GND* : Unused I/O pin. Connect each pin marked GND* directly to GND
+ -- or leave it unconnected.
+ -- RESERVED : Unused I/O pin, which MUST be left unconnected.
+ -- RESERVED_INPUT : Pin is tri-stated and should be connected to the board.
+ -- RESERVED_INPUT_WITH_WEAK_PULLUP : Pin is tri-stated with internal weak pull-up resistor.
+ -- RESERVED_INPUT_WITH_BUS_HOLD : Pin is tri-stated with bus-hold circuitry.
+ -- RESERVED_OUTPUT_DRIVEN_HIGH : Pin is output driven high.
+ ---------------------------------------------------------------------------------
+
+
+
+ ---------------------------------------------------------------------------------
+ -- Pin directions (input, output or bidir) are based on device operating in user mode.
+ ---------------------------------------------------------------------------------
+
+Quartus II Version 10.0 Build 218 06/27/2010 SJ Full Version
+CHIP "DE2_USB_API" ASSIGNED TO AN: EP2C35F672C6
+
+Pin Name/Usage : Location : Dir. : I/O Standard : Voltage : I/O Bank : User Assignment
+-------------------------------------------------------------------------------------------------------------
+GND : A2 : gnd : : : :
+VCCIO3 : A3 : power : : 3.3V : 3 :
+RESERVED_INPUT : A4 : : : : 3 :
+RESERVED_INPUT : A5 : : : : 3 :
+RESERVED_INPUT : A6 : : : : 3 :
+RESERVED_INPUT : A7 : : : : 3 :
+RESERVED_INPUT : A8 : : : : 3 :
+RESERVED_INPUT : A9 : : : : 3 :
+RESERVED_INPUT : A10 : : : : 3 :
+VCCIO3 : A11 : power : : 3.3V : 3 :
+GND : A12 : gnd : : : :
+DPDT_SW[9] : A13 : input : 3.3-V LVTTL : : 4 : Y
+RESERVED_INPUT : A14 : : : : 4 :
+GND : A15 : gnd : : : :
+VCCIO4 : A16 : power : : 3.3V : 4 :
+RESERVED_INPUT : A17 : : : : 4 :
+RESERVED_INPUT : A18 : : : : 4 :
+RESERVED_INPUT : A19 : : : : 4 :
+RESERVED_INPUT : A20 : : : : 4 :
+RESERVED_INPUT : A21 : : : : 4 :
+RESERVED_INPUT : A22 : : : : 4 :
+RESERVED_INPUT : A23 : : : : 4 :
+VCCIO4 : A24 : power : : 3.3V : 4 :
+GND : A25 : gnd : : : :
+RESERVED_INPUT : AA1 : : : : 1 :
+RESERVED_INPUT : AA2 : : : : 1 :
+RESERVED_INPUT : AA3 : : : : 1 :
+RESERVED_INPUT : AA4 : : : : 1 :
+RESERVED_INPUT : AA5 : : : : 1 :
+RESERVED_INPUT : AA6 : : : : 1 :
+RESERVED_INPUT : AA7 : : : : 1 :
+VCCA_PLL1 : AA8 : power : : 1.2V : :
+RESERVED_INPUT : AA9 : : : : 8 :
+RESERVED_INPUT : AA10 : : : : 8 :
+RESERVED_INPUT : AA11 : : : : 8 :
+RESERVED_INPUT : AA12 : : : : 8 :
+LED_RED[10] : AA13 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[8] : AA14 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AA15 : : : : 7 :
+RESERVED_INPUT : AA16 : : : : 7 :
+RESERVED_INPUT : AA17 : : : : 7 :
+RESERVED_INPUT : AA18 : : : : 7 :
+VCCA_PLL4 : AA19 : power : : 1.2V : :
+LED_GREEN[6] : AA20 : output : 3.3-V LVTTL : : 7 : Y
+GND_PLL4 : AA21 : gnd : : : :
+VCCIO6 : AA22 : power : : 3.3V : 6 :
+HEX1[5] : AA23 : output : 3.3-V LVTTL : : 6 : Y
+HEX1[4] : AA24 : output : 3.3-V LVTTL : : 6 : Y
+HEX3[1] : AA25 : output : 3.3-V LVTTL : : 6 : Y
+HEX3[2] : AA26 : output : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : AB1 : : : : 1 :
+RESERVED_INPUT : AB2 : : : : 1 :
+RESERVED_INPUT : AB3 : : : : 1 :
+RESERVED_INPUT : AB4 : : : : 1 :
+VCCIO1 : AB5 : power : : 3.3V : 1 :
+VCCIO8 : AB6 : power : : 3.3V : 8 :
+GND : AB7 : gnd : : : :
+RESERVED_INPUT : AB8 : : : : 8 :
+VCCIO8 : AB9 : power : : 3.3V : 8 :
+RESERVED_INPUT : AB10 : : : : 8 :
+GND : AB11 : gnd : : : :
+HEX0[1] : AB12 : output : 3.3-V LVTTL : : 8 : Y
+VCCIO8 : AB13 : power : : 3.3V : 8 :
+VCCIO7 : AB14 : power : : 3.3V : 7 :
+RESERVED_INPUT : AB15 : : : : 7 :
+GND : AB16 : gnd : : : :
+VCCIO7 : AB17 : power : : 3.3V : 7 :
+RESERVED_INPUT : AB18 : : : : 7 :
+GND : AB19 : gnd : : : :
+RESERVED_INPUT : AB20 : : : : 7 :
+LED_RED[2] : AB21 : output : 3.3-V LVTTL : : 7 : Y
+VCCIO7 : AB22 : power : : 3.3V : 7 :
+HEX2[0] : AB23 : output : 3.3-V LVTTL : : 6 : Y
+HEX1[6] : AB24 : output : 3.3-V LVTTL : : 6 : Y
+HEX2[5] : AB25 : output : 3.3-V LVTTL : : 6 : Y
+HEX2[4] : AB26 : output : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : AC1 : : : : 1 :
+RESERVED_INPUT : AC2 : : : : 1 :
+RESERVED_INPUT : AC3 : : : : 1 :
+GND : AC4 : gnd : : : :
+RESERVED_INPUT : AC5 : : : : 8 :
+RESERVED_INPUT : AC6 : : : : 8 :
+RESERVED_INPUT : AC7 : : : : 8 :
+RESERVED_INPUT : AC8 : : : : 8 :
+RESERVED_INPUT : AC9 : : : : 8 :
+RESERVED_INPUT : AC10 : : : : 8 :
+RESERVED_INPUT : AC11 : : : : 8 :
+HEX0[2] : AC12 : output : 3.3-V LVTTL : : 8 : Y
+DPDT_SW[6] : AC13 : input : 3.3-V LVTTL : : 8 : Y
+LED_RED[11] : AC14 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AC15 : : : : 7 :
+RESERVED_INPUT : AC16 : : : : 7 :
+RESERVED_INPUT : AC17 : : : : 7 :
+RESERVED_INPUT : AC18 : : : : 7 :
+RESERVED_INPUT : AC19 : : : : 7 :
+RESERVED_INPUT : AC20 : : : : 7 :
+LED_RED[7] : AC21 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[3] : AC22 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AC23 : : : : 6 :
+NC : AC24 : : : : :
+HEX2[2] : AC25 : output : 3.3-V LVTTL : : 6 : Y
+HEX2[3] : AC26 : output : 3.3-V LVTTL : : 6 : Y
+VCCIO1 : AD1 : power : : 3.3V : 1 :
+RESERVED_INPUT : AD2 : : : : 1 :
+RESERVED_INPUT : AD3 : : : : 1 :
+RESERVED_INPUT : AD4 : : : : 8 :
+RESERVED_INPUT : AD5 : : : : 8 :
+RESERVED_INPUT : AD6 : : : : 8 :
+RESERVED_INPUT : AD7 : : : : 8 :
+RESERVED_INPUT : AD8 : : : : 8 :
+GND : AD9 : gnd : : : :
+RESERVED_INPUT : AD10 : : : : 8 :
+HEX0[3] : AD11 : output : 3.3-V LVTTL : : 8 : Y
+LED_RED[17] : AD12 : output : 3.3-V LVTTL : : 8 : Y
+DPDT_SW[5] : AD13 : input : 3.3-V LVTTL : : 8 : Y
+GND : AD14 : gnd : : : :
+LED_RED[12] : AD15 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AD16 : : : : 7 :
+RESERVED_INPUT : AD17 : : : : 7 :
+GND : AD18 : gnd : : : :
+RESERVED_INPUT : AD19 : : : : 7 :
+VCCIO7 : AD20 : power : : 3.3V : 7 :
+LED_RED[6] : AD21 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[4] : AD22 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[5] : AD23 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AD24 : : : : 6 :
+RESERVED_INPUT : AD25 : : : : 6 :
+VCCIO6 : AD26 : power : : 3.3V : 6 :
+GND : AE1 : gnd : : : :
+RESERVED_INPUT : AE2 : : : : 1 :
+RESERVED_INPUT : AE3 : : : : 1 :
+RESERVED_INPUT : AE4 : : : : 8 :
+RESERVED_INPUT : AE5 : : : : 8 :
+RESERVED_INPUT : AE6 : : : : 8 :
+RESERVED_INPUT : AE7 : : : : 8 :
+RESERVED_INPUT : AE8 : : : : 8 :
+RESERVED_INPUT : AE9 : : : : 8 :
+RESERVED_INPUT : AE10 : : : : 8 :
+HEX0[4] : AE11 : output : 3.3-V LVTTL : : 8 : Y
+LED_RED[16] : AE12 : output : 3.3-V LVTTL : : 8 : Y
+LED_RED[15] : AE13 : output : 3.3-V LVTTL : : 8 : Y
+DPDT_SW[3] : AE14 : input : 3.3-V LVTTL : : 7 : Y
+LED_RED[13] : AE15 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AE16 : : : : 7 :
+RESERVED_INPUT : AE17 : : : : 7 :
+RESERVED_INPUT : AE18 : : : : 7 :
+RESERVED_INPUT : AE19 : : : : 7 :
+RESERVED_INPUT : AE20 : : : : 7 :
+RESERVED_INPUT : AE21 : : : : 7 :
+LED_GREEN[0] : AE22 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[0] : AE23 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : AE24 : : : : 6 :
+RESERVED_INPUT : AE25 : : : : 6 :
+GND : AE26 : gnd : : : :
+GND : AF2 : gnd : : : :
+VCCIO8 : AF3 : power : : 3.3V : 8 :
+RESERVED_INPUT : AF4 : : : : 8 :
+RESERVED_INPUT : AF5 : : : : 8 :
+RESERVED_INPUT : AF6 : : : : 8 :
+RESERVED_INPUT : AF7 : : : : 8 :
+RESERVED_INPUT : AF8 : : : : 8 :
+RESERVED_INPUT : AF9 : : : : 8 :
+HEX0[0] : AF10 : output : 3.3-V LVTTL : : 8 : Y
+VCCIO8 : AF11 : power : : 3.3V : 8 :
+GND : AF12 : gnd : : : :
+LED_RED[14] : AF13 : output : 3.3-V LVTTL : : 8 : Y
+DPDT_SW[4] : AF14 : input : 3.3-V LVTTL : : 7 : Y
+GND : AF15 : gnd : : : :
+VCCIO7 : AF16 : power : : 3.3V : 7 :
+RESERVED_INPUT : AF17 : : : : 7 :
+RESERVED_INPUT : AF18 : : : : 7 :
+RESERVED_INPUT : AF19 : : : : 7 :
+RESERVED_INPUT : AF20 : : : : 7 :
+RESERVED_INPUT : AF21 : : : : 7 :
+LED_GREEN[1] : AF22 : output : 3.3-V LVTTL : : 7 : Y
+LED_RED[1] : AF23 : output : 3.3-V LVTTL : : 7 : Y
+VCCIO7 : AF24 : power : : 3.3V : 7 :
+GND : AF25 : gnd : : : :
+GND : B1 : gnd : : : :
+RESERVED_INPUT : B2 : : : : 2 :
+RESERVED_INPUT : B3 : : : : 2 :
+RESERVED_INPUT : B4 : : : : 3 :
+RESERVED_INPUT : B5 : : : : 3 :
+RESERVED_INPUT : B6 : : : : 3 :
+RESERVED_INPUT : B7 : : : : 3 :
+RESERVED_INPUT : B8 : : : : 3 :
+RESERVED_INPUT : B9 : : : : 3 :
+RESERVED_INPUT : B10 : : : : 3 :
+RESERVED_INPUT : B11 : : : : 3 :
+RESERVED_INPUT : B12 : : : : 3 :
+DPDT_SW[8] : B13 : input : 3.3-V LVTTL : : 4 : Y
+RESERVED_INPUT : B14 : : : : 4 :
+RESERVED_INPUT : B15 : : : : 4 :
+RESERVED_INPUT : B16 : : : : 4 :
+RESERVED_INPUT : B17 : : : : 4 :
+RESERVED_INPUT : B18 : : : : 4 :
+RESERVED_INPUT : B19 : : : : 4 :
+RESERVED_INPUT : B20 : : : : 4 :
+RESERVED_INPUT : B21 : : : : 4 :
+RESERVED_INPUT : B22 : : : : 4 :
+RESERVED_INPUT : B23 : : : : 4 :
+RESERVED_INPUT : B24 : : : : 5 :
+UART_TXD : B25 : output : 3.3-V LVTTL : : 5 : Y
+GND : B26 : gnd : : : :
+VCCIO2 : C1 : power : : 3.3V : 2 :
+RESERVED_INPUT : C2 : : : : 2 :
+RESERVED_INPUT : C3 : : : : 2 :
+RESERVED_INPUT : C4 : : : : 3 :
+RESERVED_INPUT : C5 : : : : 3 :
+RESERVED_INPUT : C6 : : : : 3 :
+RESERVED_INPUT : C7 : : : : 3 :
+RESERVED_INPUT : C8 : : : : 3 :
+RESERVED_INPUT : C9 : : : : 3 :
+RESERVED_INPUT : C10 : : : : 3 :
+RESERVED_INPUT : C11 : : : : 3 :
+RESERVED_INPUT : C12 : : : : 3 :
+DPDT_SW[7] : C13 : input : 3.3-V LVTTL : : 3 : Y
+GND : C14 : gnd : : : :
+RESERVED_INPUT : C15 : : : : 4 :
+RESERVED_INPUT : C16 : : : : 4 :
+RESERVED_INPUT : C17 : : : : 4 :
+GND : C18 : gnd : : : :
+RESERVED_INPUT : C19 : : : : 4 :
+VCCIO4 : C20 : power : : 3.3V : 4 :
+RESERVED_INPUT : C21 : : : : 4 :
+RESERVED_INPUT : C22 : : : : 4 :
+RESERVED_INPUT : C23 : : : : 4 :
+RESERVED_INPUT : C24 : : : : 5 :
+UART_RXD : C25 : input : 3.3-V LVTTL : : 5 : Y
+VCCIO5 : C26 : power : : 3.3V : 5 :
+RESERVED_INPUT : D1 : : : : 2 :
+RESERVED_INPUT : D2 : : : : 2 :
+~nCSO~ / RESERVED_INPUT_WITH_WEAK_PULLUP : D3 : input : 3.3-V LVTTL : : 2 : N
+GND : D4 : gnd : : : :
+RESERVED_INPUT : D5 : : : : 3 :
+RESERVED_INPUT : D6 : : : : 3 :
+RESERVED_INPUT : D7 : : : : 3 :
+RESERVED_INPUT : D8 : : : : 3 :
+RESERVED_INPUT : D9 : : : : 3 :
+RESERVED_INPUT : D10 : : : : 3 :
+RESERVED_INPUT : D11 : : : : 3 :
+RESERVED_INPUT : D12 : : : : 3 :
+OSC_27 : D13 : input : 3.3-V LVTTL : : 3 : Y
+RESERVED_INPUT : D14 : : : : 4 :
+RESERVED_INPUT : D15 : : : : 4 :
+RESERVED_INPUT : D16 : : : : 4 :
+RESERVED_INPUT : D17 : : : : 4 :
+RESERVED_INPUT : D18 : : : : 4 :
+RESERVED_INPUT : D19 : : : : 4 :
+RESERVED_INPUT : D20 : : : : 4 :
+RESERVED_INPUT : D21 : : : : 4 :
+VCCIO4 : D22 : power : : 3.3V : 4 :
+RESERVED_INPUT : D23 : : : : 5 :
+GND : D24 : gnd : : : :
+RESERVED_INPUT : D25 : : : : 5 :
+RESERVED_INPUT : D26 : : : : 5 :
+RESERVED_INPUT : E1 : : : : 2 :
+RESERVED_INPUT : E2 : : : : 2 :
+~ASDO~ / RESERVED_INPUT_WITH_WEAK_PULLUP : E3 : input : 3.3-V LVTTL : : 2 : N
+GND_PLL3 : E4 : gnd : : : :
+RESERVED_INPUT : E5 : : : : 2 :
+VCCIO3 : E6 : power : : 3.3V : 3 :
+GND : E7 : gnd : : : :
+RESERVED_INPUT : E8 : : : : 3 :
+VCCIO3 : E9 : power : : 3.3V : 3 :
+RESERVED_INPUT : E10 : : : : 3 :
+GND : E11 : gnd : : : :
+RESERVED_INPUT : E12 : : : : 3 :
+VCCIO3 : E13 : power : : 3.3V : 3 :
+VCCIO4 : E14 : power : : 3.3V : 4 :
+RESERVED_INPUT : E15 : : : : 4 :
+GND : E16 : gnd : : : :
+VCCIO4 : E17 : power : : 3.3V : 4 :
+RESERVED_INPUT : E18 : : : : 4 :
+GND : E19 : gnd : : : :
+RESERVED_INPUT : E20 : : : : 4 :
+GND_PLL2 : E21 : gnd : : : :
+RESERVED_INPUT : E22 : : : : 5 :
+RESERVED_INPUT : E23 : : : : 5 :
+RESERVED_INPUT : E24 : : : : 5 :
+RESERVED_INPUT : E25 : : : : 5 :
+RESERVED_INPUT : E26 : : : : 5 :
+RESERVED_INPUT : F1 : : : : 2 :
+RESERVED_INPUT : F2 : : : : 2 :
+RESERVED_INPUT : F3 : : : : 2 :
+RESERVED_INPUT : F4 : : : : 2 :
+VCCIO2 : F5 : power : : 3.3V : 2 :
+RESERVED_INPUT : F6 : : : : 2 :
+RESERVED_INPUT : F7 : : : : 2 :
+GNDA_PLL3 : F8 : gnd : : : :
+RESERVED_INPUT : F9 : : : : 3 :
+RESERVED_INPUT : F10 : : : : 3 :
+RESERVED_INPUT : F11 : : : : 3 :
+RESERVED_INPUT : F12 : : : : 3 :
+RESERVED_INPUT : F13 : : : : 4 :
+RESERVED_INPUT : F14 : : : : 4 :
+RESERVED_INPUT : F15 : : : : 4 :
+RESERVED_INPUT : F16 : : : : 4 :
+RESERVED_INPUT : F17 : : : : 4 :
+RESERVED_INPUT : F18 : : : : 4 :
+GNDA_PLL2 : F19 : gnd : : : :
+RESERVED_INPUT : F20 : : : : 5 :
+RESERVED_INPUT : F21 : : : : 5 :
+VCCIO5 : F22 : power : : 3.3V : 5 :
+RESERVED_INPUT : F23 : : : : 5 :
+RESERVED_INPUT : F24 : : : : 5 :
+RESERVED_INPUT : F25 : : : : 5 :
+RESERVED_INPUT : F26 : : : : 5 :
+RESERVED_INPUT : G1 : : : : 2 :
+RESERVED_INPUT : G2 : : : : 2 :
+RESERVED_INPUT : G3 : : : : 2 :
+RESERVED_INPUT : G4 : : : : 2 :
+RESERVED_INPUT : G5 : : : : 2 :
+RESERVED_INPUT : G6 : : : : 2 :
+GND_PLL3 : G7 : gnd : : : :
+VCCA_PLL3 : G8 : power : : 1.2V : :
+RESERVED_INPUT : G9 : : : : 3 :
+RESERVED_INPUT : G10 : : : : 3 :
+RESERVED_INPUT : G11 : : : : 3 :
+RESERVED_INPUT : G12 : : : : 3 :
+RESERVED_INPUT : G13 : : : : 4 :
+RESERVED_INPUT : G14 : : : : 4 :
+RESERVED_INPUT : G15 : : : : 4 :
+RESERVED_INPUT : G16 : : : : 4 :
+RESERVED_INPUT : G17 : : : : 4 :
+RESERVED_INPUT : G18 : : : : 4 :
+VCCA_PLL2 : G19 : power : : 1.2V : :
+GND_PLL2 : G20 : gnd : : : :
+RESERVED_INPUT : G21 : : : : 5 :
+RESERVED_INPUT : G22 : : : : 5 :
+RESERVED_INPUT : G23 : : : : 5 :
+RESERVED_INPUT : G24 : : : : 5 :
+RESERVED_INPUT : G25 : : : : 5 :
+KEY[0] : G26 : input : 3.3-V LVTTL : : 5 : Y
+RESERVED_INPUT : H1 : : : : 2 :
+RESERVED_INPUT : H2 : : : : 2 :
+RESERVED_INPUT : H3 : : : : 2 :
+RESERVED_INPUT : H4 : : : : 2 :
+GND : H5 : gnd : : : :
+RESERVED_INPUT : H6 : : : : 2 :
+VCCD_PLL3 : H7 : power : : 1.2V : :
+RESERVED_INPUT : H8 : : : : 3 :
+VCCIO3 : H9 : power : : 3.3V : 3 :
+RESERVED_INPUT : H10 : : : : 3 :
+RESERVED_INPUT : H11 : : : : 3 :
+RESERVED_INPUT : H12 : : : : 3 :
+GND : H13 : gnd : : : :
+GND : H14 : gnd : : : :
+RESERVED_INPUT : H15 : : : : 4 :
+RESERVED_INPUT : H16 : : : : 4 :
+RESERVED_INPUT : H17 : : : : 4 :
+VCCIO4 : H18 : power : : 3.3V : 4 :
+RESERVED_INPUT : H19 : : : : 5 :
+VCCD_PLL2 : H20 : power : : 1.2V : :
+RESERVED_INPUT : H21 : : : : 5 :
+GND : H22 : gnd : : : :
+RESERVED_INPUT : H23 : : : : 5 :
+RESERVED_INPUT : H24 : : : : 5 :
+RESERVED_INPUT : H25 : : : : 5 :
+RESERVED_INPUT : H26 : : : : 5 :
+RESERVED_INPUT : J1 : : : : 2 :
+RESERVED_INPUT : J2 : : : : 2 :
+RESERVED_INPUT : J3 : : : : 2 :
+RESERVED_INPUT : J4 : : : : 2 :
+RESERVED_INPUT : J5 : : : : 2 :
+RESERVED_INPUT : J6 : : : : 2 :
+RESERVED_INPUT : J7 : : : : 2 :
+RESERVED_INPUT : J8 : : : : 2 :
+RESERVED_INPUT : J9 : : : : 3 :
+RESERVED_INPUT : J10 : : : : 3 :
+RESERVED_INPUT : J11 : : : : 3 :
+VCCIO3 : J12 : power : : 3.3V : 3 :
+RESERVED_INPUT : J13 : : : : 3 :
+RESERVED_INPUT : J14 : : : : 3 :
+VCCIO4 : J15 : power : : 3.3V : 4 :
+RESERVED_INPUT : J16 : : : : 4 :
+RESERVED_INPUT : J17 : : : : 4 :
+RESERVED_INPUT : J18 : : : : 4 :
+VCCIO5 : J19 : power : : 3.3V : 5 :
+RESERVED_INPUT : J20 : : : : 5 :
+RESERVED_INPUT : J21 : : : : 5 :
+RESERVED_INPUT : J22 : : : : 5 :
+RESERVED_INPUT : J23 : : : : 5 :
+RESERVED_INPUT : J24 : : : : 5 :
+RESERVED_INPUT : J25 : : : : 5 :
+RESERVED_INPUT : J26 : : : : 5 :
+RESERVED_INPUT : K1 : : : : 2 :
+RESERVED_INPUT : K2 : : : : 2 :
+RESERVED_INPUT : K3 : : : : 2 :
+RESERVED_INPUT : K4 : : : : 2 :
+RESERVED_INPUT : K5 : : : : 2 :
+RESERVED_INPUT : K6 : : : : 2 :
+RESERVED_INPUT : K7 : : : : 2 :
+RESERVED_INPUT : K8 : : : : 2 :
+RESERVED_INPUT : K9 : : : : 3 :
+VCCINT : K10 : power : : 1.2V : :
+VCCINT : K11 : power : : 1.2V : :
+VCCINT : K12 : power : : 1.2V : :
+VCCINT : K13 : power : : 1.2V : :
+VCCINT : K14 : power : : 1.2V : :
+VCCINT : K15 : power : : 1.2V : :
+RESERVED_INPUT : K16 : : : : 4 :
+RESERVED_INPUT : K17 : : : : 4 :
+RESERVED_INPUT : K18 : : : : 5 :
+RESERVED_INPUT : K19 : : : : 5 :
+GND : K20 : gnd : : : :
+RESERVED_INPUT : K21 : : : : 5 :
+RESERVED_INPUT : K22 : : : : 5 :
+RESERVED_INPUT : K23 : : : : 5 :
+RESERVED_INPUT : K24 : : : : 5 :
+RESERVED_INPUT : K25 : : : : 5 :
+RESERVED_INPUT : K26 : : : : 5 :
+VCCIO2 : L1 : power : : 3.3V : 2 :
+HEX7[1] : L2 : output : 3.3-V LVTTL : : 2 : Y
+HEX7[0] : L3 : output : 3.3-V LVTTL : : 2 : Y
+RESERVED_INPUT : L4 : : : : 2 :
+GND : L5 : gnd : : : :
+HEX7[3] : L6 : output : 3.3-V LVTTL : : 2 : Y
+HEX7[4] : L7 : output : 3.3-V LVTTL : : 2 : Y
+TMS : L8 : input : : : 2 :
+HEX7[2] : L9 : output : 3.3-V LVTTL : : 2 : Y
+RESERVED_INPUT : L10 : : : : 2 :
+VCCINT : L11 : power : : 1.2V : :
+GND : L12 : gnd : : : :
+GND : L13 : gnd : : : :
+GND : L14 : gnd : : : :
+GND : L15 : gnd : : : :
+VCCINT : L16 : power : : 1.2V : :
+VCCINT : L17 : power : : 1.2V : :
+VCCINT : L18 : power : : 1.2V : :
+RESERVED_INPUT : L19 : : : : 5 :
+RESERVED_INPUT : L20 : : : : 5 :
+RESERVED_INPUT : L21 : : : : 5 :
+GND : L22 : gnd : : : :
+RESERVED_INPUT : L23 : : : : 5 :
+RESERVED_INPUT : L24 : : : : 5 :
+RESERVED_INPUT : L25 : : : : 5 :
+VCCIO5 : L26 : power : : 3.3V : 5 :
+GND : M1 : gnd : : : :
+HEX6[3] : M2 : output : 3.3-V LVTTL : : 2 : Y
+HEX6[4] : M3 : output : 3.3-V LVTTL : : 2 : Y
+HEX6[6] : M4 : output : 3.3-V LVTTL : : 2 : Y
+HEX6[5] : M5 : output : 3.3-V LVTTL : : 2 : Y
+TCK : M6 : input : : : 2 :
+TDO : M7 : output : : : 2 :
+TDI : M8 : input : : : 2 :
+VCCIO2 : M9 : power : : 3.3V : 2 :
+VCCINT : M10 : power : : 1.2V : :
+VCCINT : M11 : power : : 1.2V : :
+GND : M12 : gnd : : : :
+GND : M13 : gnd : : : :
+GND : M14 : gnd : : : :
+GND : M15 : gnd : : : :
+VCCINT : M16 : power : : 1.2V : :
+VCCINT : M17 : power : : 1.2V : :
+VCCIO5 : M18 : power : : 3.3V : 5 :
+RESERVED_INPUT : M19 : : : : 5 :
+RESERVED_INPUT : M20 : : : : 5 :
+RESERVED_INPUT : M21 : : : : 5 :
+RESERVED_INPUT : M22 : : : : 5 :
+RESERVED_INPUT : M23 : : : : 5 :
+RESERVED_INPUT : M24 : : : : 5 :
+RESERVED_INPUT : M25 : : : : 5 :
+GND : M26 : gnd : : : :
+DPDT_SW[10] : N1 : input : 3.3-V LVTTL : : 2 : Y
+OSC_50 : N2 : input : 3.3-V LVTTL : : 2 : Y
+DATA0 : N3 : input : : : 2 :
+nCE : N4 : : : : 2 :
+VCCIO2 : N5 : power : : 3.3V : 2 :
+DCLK : N6 : : : : 2 :
+nCONFIG : N7 : : : : 2 :
+GND : N8 : gnd : : : :
+HEX7[6] : N9 : output : 3.3-V LVTTL : : 2 : Y
+VCCINT : N10 : power : : 1.2V : :
+GND : N11 : gnd : : : :
+GND : N12 : gnd : : : :
+GND : N13 : gnd : : : :
+GND : N14 : gnd : : : :
+GND : N15 : gnd : : : :
+GND : N16 : gnd : : : :
+VCCINT : N17 : power : : 1.2V : :
+RESERVED_INPUT : N18 : : : : 5 :
+GND : N19 : gnd : : : :
+RESERVED_INPUT : N20 : : : : 5 :
+NC : N21 : : : : :
+VCCIO5 : N22 : power : : 3.3V : 5 :
+KEY[1] : N23 : input : 3.3-V LVTTL : : 5 : Y
+RESERVED_INPUT : N24 : : : : 5 :
+DPDT_SW[0] : N25 : input : 3.3-V LVTTL : : 5 : Y
+DPDT_SW[1] : N26 : input : 3.3-V LVTTL : : 5 : Y
+DPDT_SW[11] : P1 : input : 3.3-V LVTTL : : 1 : Y
+DPDT_SW[12] : P2 : input : 3.3-V LVTTL : : 1 : Y
+HEX6[2] : P3 : output : 3.3-V LVTTL : : 1 : Y
+HEX6[1] : P4 : output : 3.3-V LVTTL : : 1 : Y
+VCCIO1 : P5 : power : : 3.3V : 1 :
+HEX5[1] : P6 : output : 3.3-V LVTTL : : 1 : Y
+HEX5[2] : P7 : output : 3.3-V LVTTL : : 1 : Y
+GND : P8 : gnd : : : :
+HEX7[5] : P9 : output : 3.3-V LVTTL : : 2 : Y
+VCCINT : P10 : power : : 1.2V : :
+GND : P11 : gnd : : : :
+GND : P12 : gnd : : : :
+GND : P13 : gnd : : : :
+GND : P14 : gnd : : : :
+GND : P15 : gnd : : : :
+GND : P16 : gnd : : : :
+RESERVED_INPUT : P17 : : : : 6 :
+RESERVED_INPUT : P18 : : : : 5 :
+GND : P19 : gnd : : : :
+MSEL0 : P20 : : : : 6 :
+MSEL1 : P21 : : : : 6 :
+VCCIO6 : P22 : power : : 3.3V : 6 :
+KEY[2] : P23 : input : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : P24 : : : : 6 :
+DPDT_SW[2] : P25 : input : 3.3-V LVTTL : : 6 : Y
+EXT_CLOCK : P26 : input : 3.3-V LVTTL : : 6 : Y
+GND : R1 : gnd : : : :
+HEX6[0] : R2 : output : 3.3-V LVTTL : : 1 : Y
+HEX5[6] : R3 : output : 3.3-V LVTTL : : 1 : Y
+HEX5[5] : R4 : output : 3.3-V LVTTL : : 1 : Y
+HEX5[4] : R5 : output : 3.3-V LVTTL : : 1 : Y
+HEX4[5] : R6 : output : 3.3-V LVTTL : : 1 : Y
+HEX4[4] : R7 : output : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : R8 : : : : 1 :
+VCCIO1 : R9 : power : : 3.3V : 1 :
+VCCINT : R10 : power : : 1.2V : :
+VCCINT : R11 : power : : 1.2V : :
+GND : R12 : gnd : : : :
+GND : R13 : gnd : : : :
+GND : R14 : gnd : : : :
+GND : R15 : gnd : : : :
+VCCINT : R16 : power : : 1.2V : :
+RESERVED_INPUT : R17 : : : : 6 :
+VCCIO6 : R18 : power : : 3.3V : 6 :
+RESERVED_INPUT : R19 : : : : 6 :
+RESERVED_INPUT : R20 : : : : 6 :
+GND : R21 : gnd : : : :
+nSTATUS : R22 : : : : 6 :
+CONF_DONE : R23 : : : : 6 :
+RESERVED_INPUT : R24 : : : : 6 :
+RESERVED_INPUT : R25 : : : : 6 :
+GND : R26 : gnd : : : :
+VCCIO1 : T1 : power : : 3.3V : 1 :
+HEX5[0] : T2 : output : 3.3-V LVTTL : : 1 : Y
+HEX4[6] : T3 : output : 3.3-V LVTTL : : 1 : Y
+HEX4[3] : T4 : output : 3.3-V LVTTL : : 1 : Y
+GND : T5 : gnd : : : :
+RESERVED_INPUT : T6 : : : : 1 :
+DPDT_SW[13] : T7 : input : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : T8 : : : : 1 :
+HEX5[3] : T9 : output : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : T10 : : : : 1 :
+VCCINT : T11 : power : : 1.2V : :
+GND : T12 : gnd : : : :
+GND : T13 : gnd : : : :
+GND : T14 : gnd : : : :
+GND : T15 : gnd : : : :
+VCCINT : T16 : power : : 1.2V : :
+RESERVED_INPUT : T17 : : : : 6 :
+RESERVED_INPUT : T18 : : : : 6 :
+RESERVED_INPUT : T19 : : : : 6 :
+RESERVED_INPUT : T20 : : : : 6 :
+RESERVED_INPUT : T21 : : : : 6 :
+RESERVED_INPUT : T22 : : : : 6 :
+RESERVED_INPUT : T23 : : : : 6 :
+RESERVED_INPUT : T24 : : : : 6 :
+RESERVED_INPUT : T25 : : : : 6 :
+VCCIO6 : T26 : power : : 3.3V : 6 :
+HEX4[1] : U1 : output : 3.3-V LVTTL : : 1 : Y
+HEX4[2] : U2 : output : 3.3-V LVTTL : : 1 : Y
+DPDT_SW[14] : U3 : input : 3.3-V LVTTL : : 1 : Y
+DPDT_SW[15] : U4 : input : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : U5 : : : : 1 :
+RESERVED_INPUT : U6 : : : : 1 :
+RESERVED_INPUT : U7 : : : : 1 :
+GND : U8 : gnd : : : :
+HEX4[0] : U9 : output : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : U10 : : : : 1 :
+VCCINT : U11 : power : : 1.2V : :
+RESERVED_INPUT : U12 : : : : 8 :
+VCCINT : U13 : power : : 1.2V : :
+VCCINT : U14 : power : : 1.2V : :
+VCCINT : U15 : power : : 1.2V : :
+VCCINT : U16 : power : : 1.2V : :
+LED_GREEN[5] : U17 : output : 3.3-V LVTTL : : 7 : Y
+LED_GREEN[4] : U18 : output : 3.3-V LVTTL : : 7 : Y
+GND : U19 : gnd : : : :
+RESERVED_INPUT : U20 : : : : 6 :
+RESERVED_INPUT : U21 : : : : 6 :
+HEX3[5] : U22 : output : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : U23 : : : : 6 :
+RESERVED_INPUT : U24 : : : : 6 :
+RESERVED_INPUT : U25 : : : : 6 :
+RESERVED_INPUT : U26 : : : : 6 :
+DPDT_SW[16] : V1 : input : 3.3-V LVTTL : : 1 : Y
+DPDT_SW[17] : V2 : input : 3.3-V LVTTL : : 1 : Y
+RESERVED_INPUT : V3 : : : : 1 :
+RESERVED_INPUT : V4 : : : : 1 :
+RESERVED_INPUT : V5 : : : : 1 :
+RESERVED_INPUT : V6 : : : : 1 :
+RESERVED_INPUT : V7 : : : : 1 :
+VCCIO1 : V8 : power : : 3.3V : 1 :
+RESERVED_INPUT : V9 : : : : 8 :
+RESERVED_INPUT : V10 : : : : 8 :
+RESERVED_INPUT : V11 : : : : 8 :
+VCCIO8 : V12 : power : : 3.3V : 8 :
+HEX0[6] : V13 : output : 3.3-V LVTTL : : 8 : Y
+HEX0[5] : V14 : output : 3.3-V LVTTL : : 8 : Y
+VCCIO7 : V15 : power : : 3.3V : 7 :
+VCCINT : V16 : power : : 1.2V : :
+RESERVED_INPUT : V17 : : : : 7 :
+LED_GREEN[3] : V18 : output : 3.3-V LVTTL : : 7 : Y
+VCCIO6 : V19 : power : : 3.3V : 6 :
+HEX1[0] : V20 : output : 3.3-V LVTTL : : 6 : Y
+HEX1[1] : V21 : output : 3.3-V LVTTL : : 6 : Y
+HEX2[1] : V22 : output : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : V23 : : : : 6 :
+RESERVED_INPUT : V24 : : : : 6 :
+RESERVED_INPUT : V25 : : : : 6 :
+RESERVED_INPUT : V26 : : : : 6 :
+RESERVED_INPUT : W1 : : : : 1 :
+RESERVED_INPUT : W2 : : : : 1 :
+RESERVED_INPUT : W3 : : : : 1 :
+RESERVED_INPUT : W4 : : : : 1 :
+GND : W5 : gnd : : : :
+RESERVED_INPUT : W6 : : : : 1 :
+GND_PLL1 : W7 : gnd : : : :
+RESERVED_INPUT : W8 : : : : 8 :
+VCCIO8 : W9 : power : : 3.3V : 8 :
+RESERVED_INPUT : W10 : : : : 8 :
+RESERVED_INPUT : W11 : : : : 8 :
+RESERVED_INPUT : W12 : : : : 8 :
+GND : W13 : gnd : : : :
+GND : W14 : gnd : : : :
+RESERVED_INPUT : W15 : : : : 7 :
+RESERVED_INPUT : W16 : : : : 7 :
+RESERVED_INPUT : W17 : : : : 7 :
+VCCIO7 : W18 : power : : 3.3V : 7 :
+LED_GREEN[2] : W19 : output : 3.3-V LVTTL : : 7 : Y
+GND_PLL4 : W20 : gnd : : : :
+HEX1[2] : W21 : output : 3.3-V LVTTL : : 6 : Y
+GND : W22 : gnd : : : :
+RESERVED_INPUT : W23 : : : : 6 :
+HEX3[6] : W24 : output : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : W25 : : : : 6 :
+KEY[3] : W26 : input : 3.3-V LVTTL : : 6 : Y
+RESERVED_INPUT : Y1 : : : : 1 :
+NC : Y2 : : : : :
+RESERVED_INPUT : Y3 : : : : 1 :
+RESERVED_INPUT : Y4 : : : : 1 :
+RESERVED_INPUT : Y5 : : : : 1 :
+GND_PLL1 : Y6 : gnd : : : :
+VCCD_PLL1 : Y7 : power : : 1.2V : :
+GNDA_PLL1 : Y8 : gnd : : : :
+GND : Y9 : gnd : : : :
+RESERVED_INPUT : Y10 : : : : 8 :
+RESERVED_INPUT : Y11 : : : : 8 :
+LED_GREEN[8] : Y12 : output : 3.3-V LVTTL : : 8 : Y
+LED_RED[9] : Y13 : output : 3.3-V LVTTL : : 7 : Y
+RESERVED_INPUT : Y14 : : : : 7 :
+RESERVED_INPUT : Y15 : : : : 7 :
+RESERVED_INPUT : Y16 : : : : 7 :
+GND : Y17 : gnd : : : :
+LED_GREEN[7] : Y18 : output : 3.3-V LVTTL : : 7 : Y
+GNDA_PLL4 : Y19 : gnd : : : :
+VCCD_PLL4 : Y20 : power : : 1.2V : :
+RESERVED_INPUT : Y21 : : : : 6 :
+HEX1[3] : Y22 : output : 3.3-V LVTTL : : 6 : Y
+HEX3[0] : Y23 : output : 3.3-V LVTTL : : 6 : Y
+HEX2[6] : Y24 : output : 3.3-V LVTTL : : 6 : Y
+HEX3[4] : Y25 : output : 3.3-V LVTTL : : 6 : Y
+HEX3[3] : Y26 : output : 3.3-V LVTTL : : 6 : Y
Index: DE2/DE2.qsf
===================================================================
--- DE2/DE2.qsf (nonexistent)
+++ DE2/DE2.qsf (revision 4)
@@ -0,0 +1,546 @@
+# Project-Wide Assignments
+# ========================
+set_global_assignment -name LAST_QUARTUS_VERSION 10.0
+
+# Pin & Location Assignments
+# ==========================
+set_location_assignment PIN_N25 -to DPDT_SW[0]
+set_location_assignment PIN_N26 -to DPDT_SW[1]
+set_location_assignment PIN_P25 -to DPDT_SW[2]
+set_location_assignment PIN_AE14 -to DPDT_SW[3]
+set_location_assignment PIN_AF14 -to DPDT_SW[4]
+set_location_assignment PIN_AD13 -to DPDT_SW[5]
+set_location_assignment PIN_AC13 -to DPDT_SW[6]
+set_location_assignment PIN_C13 -to DPDT_SW[7]
+set_location_assignment PIN_B13 -to DPDT_SW[8]
+set_location_assignment PIN_A13 -to DPDT_SW[9]
+set_location_assignment PIN_N1 -to DPDT_SW[10]
+set_location_assignment PIN_P1 -to DPDT_SW[11]
+set_location_assignment PIN_P2 -to DPDT_SW[12]
+set_location_assignment PIN_T7 -to DPDT_SW[13]
+set_location_assignment PIN_U3 -to DPDT_SW[14]
+set_location_assignment PIN_U4 -to DPDT_SW[15]
+set_location_assignment PIN_V1 -to DPDT_SW[16]
+set_location_assignment PIN_V2 -to DPDT_SW[17]
+set_location_assignment PIN_T6 -to DRAM_ADDR[0]
+set_location_assignment PIN_V4 -to DRAM_ADDR[1]
+set_location_assignment PIN_V3 -to DRAM_ADDR[2]
+set_location_assignment PIN_W2 -to DRAM_ADDR[3]
+set_location_assignment PIN_W1 -to DRAM_ADDR[4]
+set_location_assignment PIN_U6 -to DRAM_ADDR[5]
+set_location_assignment PIN_U7 -to DRAM_ADDR[6]
+set_location_assignment PIN_U5 -to DRAM_ADDR[7]
+set_location_assignment PIN_W4 -to DRAM_ADDR[8]
+set_location_assignment PIN_W3 -to DRAM_ADDR[9]
+set_location_assignment PIN_Y1 -to DRAM_ADDR[10]
+set_location_assignment PIN_V5 -to DRAM_ADDR[11]
+set_location_assignment PIN_AE2 -to DRAM_BA_0
+set_location_assignment PIN_AE3 -to DRAM_BA_1
+set_location_assignment PIN_AB3 -to DRAM_CAS_N
+set_location_assignment PIN_AA6 -to DRAM_CKE
+set_location_assignment PIN_AA7 -to DRAM_CLK
+set_location_assignment PIN_AC3 -to DRAM_CS_N
+set_location_assignment PIN_V6 -to DRAM_DQ[0]
+set_location_assignment PIN_AA2 -to DRAM_DQ[1]
+set_location_assignment PIN_AA1 -to DRAM_DQ[2]
+set_location_assignment PIN_Y3 -to DRAM_DQ[3]
+set_location_assignment PIN_Y4 -to DRAM_DQ[4]
+set_location_assignment PIN_R8 -to DRAM_DQ[5]
+set_location_assignment PIN_T8 -to DRAM_DQ[6]
+set_location_assignment PIN_V7 -to DRAM_DQ[7]
+set_location_assignment PIN_W6 -to DRAM_DQ[8]
+set_location_assignment PIN_AB2 -to DRAM_DQ[9]
+set_location_assignment PIN_AB1 -to DRAM_DQ[10]
+set_location_assignment PIN_AA4 -to DRAM_DQ[11]
+set_location_assignment PIN_AA3 -to DRAM_DQ[12]
+set_location_assignment PIN_AC2 -to DRAM_DQ[13]
+set_location_assignment PIN_AC1 -to DRAM_DQ[14]
+set_location_assignment PIN_AA5 -to DRAM_DQ[15]
+set_location_assignment PIN_AD2 -to DRAM_LDQM
+set_location_assignment PIN_Y5 -to DRAM_UDQM
+set_location_assignment PIN_AB4 -to DRAM_RAS_N
+set_location_assignment PIN_AD3 -to DRAM_WE_N
+set_location_assignment PIN_AC18 -to FL_ADDR[0]
+set_location_assignment PIN_AB18 -to FL_ADDR[1]
+set_location_assignment PIN_AE19 -to FL_ADDR[2]
+set_location_assignment PIN_AF19 -to FL_ADDR[3]
+set_location_assignment PIN_AE18 -to FL_ADDR[4]
+set_location_assignment PIN_AF18 -to FL_ADDR[5]
+set_location_assignment PIN_Y16 -to FL_ADDR[6]
+set_location_assignment PIN_AA16 -to FL_ADDR[7]
+set_location_assignment PIN_AD17 -to FL_ADDR[8]
+set_location_assignment PIN_AC17 -to FL_ADDR[9]
+set_location_assignment PIN_AE17 -to FL_ADDR[10]
+set_location_assignment PIN_AF17 -to FL_ADDR[11]
+set_location_assignment PIN_W16 -to FL_ADDR[12]
+set_location_assignment PIN_W15 -to FL_ADDR[13]
+set_location_assignment PIN_AC16 -to FL_ADDR[14]
+set_location_assignment PIN_AD16 -to FL_ADDR[15]
+set_location_assignment PIN_AE16 -to FL_ADDR[16]
+set_location_assignment PIN_AC15 -to FL_ADDR[17]
+set_location_assignment PIN_AB15 -to FL_ADDR[18]
+set_location_assignment PIN_AA15 -to FL_ADDR[19]
+set_location_assignment PIN_V17 -to FL_CE_N
+set_location_assignment PIN_W17 -to FL_OE_N
+set_location_assignment PIN_AD19 -to FL_DQ[0]
+set_location_assignment PIN_AC19 -to FL_DQ[1]
+set_location_assignment PIN_AF20 -to FL_DQ[2]
+set_location_assignment PIN_AE20 -to FL_DQ[3]
+set_location_assignment PIN_AB20 -to FL_DQ[4]
+set_location_assignment PIN_AC20 -to FL_DQ[5]
+set_location_assignment PIN_AF21 -to FL_DQ[6]
+set_location_assignment PIN_AE21 -to FL_DQ[7]
+set_location_assignment PIN_AA18 -to FL_RST_N
+set_location_assignment PIN_AA17 -to FL_WE_N
+set_location_assignment PIN_AF10 -to HEX0[0]
+set_location_assignment PIN_AB12 -to HEX0[1]
+set_location_assignment PIN_AC12 -to HEX0[2]
+set_location_assignment PIN_AD11 -to HEX0[3]
+set_location_assignment PIN_AE11 -to HEX0[4]
+set_location_assignment PIN_V14 -to HEX0[5]
+set_location_assignment PIN_V13 -to HEX0[6]
+set_location_assignment PIN_V20 -to HEX1[0]
+set_location_assignment PIN_V21 -to HEX1[1]
+set_location_assignment PIN_W21 -to HEX1[2]
+set_location_assignment PIN_Y22 -to HEX1[3]
+set_location_assignment PIN_AA24 -to HEX1[4]
+set_location_assignment PIN_AA23 -to HEX1[5]
+set_location_assignment PIN_AB24 -to HEX1[6]
+set_location_assignment PIN_AB23 -to HEX2[0]
+set_location_assignment PIN_V22 -to HEX2[1]
+set_location_assignment PIN_AC25 -to HEX2[2]
+set_location_assignment PIN_AC26 -to HEX2[3]
+set_location_assignment PIN_AB26 -to HEX2[4]
+set_location_assignment PIN_AB25 -to HEX2[5]
+set_location_assignment PIN_Y24 -to HEX2[6]
+set_location_assignment PIN_Y23 -to HEX3[0]
+set_location_assignment PIN_AA25 -to HEX3[1]
+set_location_assignment PIN_AA26 -to HEX3[2]
+set_location_assignment PIN_Y26 -to HEX3[3]
+set_location_assignment PIN_Y25 -to HEX3[4]
+set_location_assignment PIN_U22 -to HEX3[5]
+set_location_assignment PIN_W24 -to HEX3[6]
+set_location_assignment PIN_U9 -to HEX4[0]
+set_location_assignment PIN_U1 -to HEX4[1]
+set_location_assignment PIN_U2 -to HEX4[2]
+set_location_assignment PIN_T4 -to HEX4[3]
+set_location_assignment PIN_R7 -to HEX4[4]
+set_location_assignment PIN_R6 -to HEX4[5]
+set_location_assignment PIN_T3 -to HEX4[6]
+set_location_assignment PIN_T2 -to HEX5[0]
+set_location_assignment PIN_P6 -to HEX5[1]
+set_location_assignment PIN_P7 -to HEX5[2]
+set_location_assignment PIN_T9 -to HEX5[3]
+set_location_assignment PIN_R5 -to HEX5[4]
+set_location_assignment PIN_R4 -to HEX5[5]
+set_location_assignment PIN_R3 -to HEX5[6]
+set_location_assignment PIN_R2 -to HEX6[0]
+set_location_assignment PIN_P4 -to HEX6[1]
+set_location_assignment PIN_P3 -to HEX6[2]
+set_location_assignment PIN_M2 -to HEX6[3]
+set_location_assignment PIN_M3 -to HEX6[4]
+set_location_assignment PIN_M5 -to HEX6[5]
+set_location_assignment PIN_M4 -to HEX6[6]
+set_location_assignment PIN_L3 -to HEX7[0]
+set_location_assignment PIN_L2 -to HEX7[1]
+set_location_assignment PIN_L9 -to HEX7[2]
+set_location_assignment PIN_L6 -to HEX7[3]
+set_location_assignment PIN_L7 -to HEX7[4]
+set_location_assignment PIN_P9 -to HEX7[5]
+set_location_assignment PIN_N9 -to HEX7[6]
+set_location_assignment PIN_G26 -to KEY[0]
+set_location_assignment PIN_N23 -to KEY[1]
+set_location_assignment PIN_P23 -to KEY[2]
+set_location_assignment PIN_W26 -to KEY[3]
+set_location_assignment PIN_AE23 -to LED_RED[0]
+set_location_assignment PIN_AF23 -to LED_RED[1]
+set_location_assignment PIN_AB21 -to LED_RED[2]
+set_location_assignment PIN_AC22 -to LED_RED[3]
+set_location_assignment PIN_AD22 -to LED_RED[4]
+set_location_assignment PIN_AD23 -to LED_RED[5]
+set_location_assignment PIN_AD21 -to LED_RED[6]
+set_location_assignment PIN_AC21 -to LED_RED[7]
+set_location_assignment PIN_AA14 -to LED_RED[8]
+set_location_assignment PIN_Y13 -to LED_RED[9]
+set_location_assignment PIN_AA13 -to LED_RED[10]
+set_location_assignment PIN_AC14 -to LED_RED[11]
+set_location_assignment PIN_AD15 -to LED_RED[12]
+set_location_assignment PIN_AE15 -to LED_RED[13]
+set_location_assignment PIN_AF13 -to LED_RED[14]
+set_location_assignment PIN_AE13 -to LED_RED[15]
+set_location_assignment PIN_AE12 -to LED_RED[16]
+set_location_assignment PIN_AD12 -to LED_RED[17]
+set_location_assignment PIN_AE22 -to LED_GREEN[0]
+set_location_assignment PIN_AF22 -to LED_GREEN[1]
+set_location_assignment PIN_W19 -to LED_GREEN[2]
+set_location_assignment PIN_V18 -to LED_GREEN[3]
+set_location_assignment PIN_U18 -to LED_GREEN[4]
+set_location_assignment PIN_U17 -to LED_GREEN[5]
+set_location_assignment PIN_AA20 -to LED_GREEN[6]
+set_location_assignment PIN_Y18 -to LED_GREEN[7]
+set_location_assignment PIN_Y12 -to LED_GREEN[8]
+set_location_assignment PIN_D13 -to OSC_27
+set_location_assignment PIN_N2 -to OSC_50
+set_location_assignment PIN_P26 -to EXT_CLOCK
+set_location_assignment PIN_D26 -to PS2_CLK
+set_location_assignment PIN_C24 -to PS2_DAT
+set_location_assignment PIN_C25 -to UART_RXD
+set_location_assignment PIN_B25 -to UART_TXD
+set_location_assignment PIN_K4 -to LCD_RW
+set_location_assignment PIN_K3 -to LCD_EN
+set_location_assignment PIN_K1 -to LCD_RS
+set_location_assignment PIN_J1 -to LCD_DATA[0]
+set_location_assignment PIN_J2 -to LCD_DATA[1]
+set_location_assignment PIN_H1 -to LCD_DATA[2]
+set_location_assignment PIN_H2 -to LCD_DATA[3]
+set_location_assignment PIN_J4 -to LCD_DATA[4]
+set_location_assignment PIN_J3 -to LCD_DATA[5]
+set_location_assignment PIN_H4 -to LCD_DATA[6]
+set_location_assignment PIN_H3 -to LCD_DATA[7]
+set_location_assignment PIN_L4 -to LCD_ON
+set_location_assignment PIN_K2 -to LCD_BLON
+set_location_assignment PIN_AE4 -to SRAM_ADDR[0]
+set_location_assignment PIN_AF4 -to SRAM_ADDR[1]
+set_location_assignment PIN_AC5 -to SRAM_ADDR[2]
+set_location_assignment PIN_AC6 -to SRAM_ADDR[3]
+set_location_assignment PIN_AD4 -to SRAM_ADDR[4]
+set_location_assignment PIN_AD5 -to SRAM_ADDR[5]
+set_location_assignment PIN_AE5 -to SRAM_ADDR[6]
+set_location_assignment PIN_AF5 -to SRAM_ADDR[7]
+set_location_assignment PIN_AD6 -to SRAM_ADDR[8]
+set_location_assignment PIN_AD7 -to SRAM_ADDR[9]
+set_location_assignment PIN_V10 -to SRAM_ADDR[10]
+set_location_assignment PIN_V9 -to SRAM_ADDR[11]
+set_location_assignment PIN_AC7 -to SRAM_ADDR[12]
+set_location_assignment PIN_W8 -to SRAM_ADDR[13]
+set_location_assignment PIN_W10 -to SRAM_ADDR[14]
+set_location_assignment PIN_Y10 -to SRAM_ADDR[15]
+set_location_assignment PIN_AB8 -to SRAM_ADDR[16]
+set_location_assignment PIN_AC8 -to SRAM_ADDR[17]
+set_location_assignment PIN_AD8 -to SRAM_DQ[0]
+set_location_assignment PIN_AE6 -to SRAM_DQ[1]
+set_location_assignment PIN_AF6 -to SRAM_DQ[2]
+set_location_assignment PIN_AA9 -to SRAM_DQ[3]
+set_location_assignment PIN_AA10 -to SRAM_DQ[4]
+set_location_assignment PIN_AB10 -to SRAM_DQ[5]
+set_location_assignment PIN_AA11 -to SRAM_DQ[6]
+set_location_assignment PIN_Y11 -to SRAM_DQ[7]
+set_location_assignment PIN_AE7 -to SRAM_DQ[8]
+set_location_assignment PIN_AF7 -to SRAM_DQ[9]
+set_location_assignment PIN_AE8 -to SRAM_DQ[10]
+set_location_assignment PIN_AF8 -to SRAM_DQ[11]
+set_location_assignment PIN_W11 -to SRAM_DQ[12]
+set_location_assignment PIN_W12 -to SRAM_DQ[13]
+set_location_assignment PIN_AC9 -to SRAM_DQ[14]
+set_location_assignment PIN_AC10 -to SRAM_DQ[15]
+set_location_assignment PIN_AE10 -to SRAM_WE_N
+set_location_assignment PIN_AD10 -to SRAM_OE_N
+set_location_assignment PIN_AF9 -to SRAM_UB_N
+set_location_assignment PIN_AE9 -to SRAM_LB_N
+set_location_assignment PIN_AC11 -to SRAM_CE_N
+set_location_assignment PIN_K7 -to OTG_ADDR[0]
+set_location_assignment PIN_F2 -to OTG_ADDR[1]
+set_location_assignment PIN_F1 -to OTG_CS_N
+set_location_assignment PIN_G2 -to OTG_RD_N
+set_location_assignment PIN_G1 -to OTG_WR_N
+set_location_assignment PIN_G5 -to OTG_RST_N
+set_location_assignment PIN_F4 -to OTG_DATA[0]
+set_location_assignment PIN_D2 -to OTG_DATA[1]
+set_location_assignment PIN_D1 -to OTG_DATA[2]
+set_location_assignment PIN_F7 -to OTG_DATA[3]
+set_location_assignment PIN_J5 -to OTG_DATA[4]
+set_location_assignment PIN_J8 -to OTG_DATA[5]
+set_location_assignment PIN_J7 -to OTG_DATA[6]
+set_location_assignment PIN_H6 -to OTG_DATA[7]
+set_location_assignment PIN_E2 -to OTG_DATA[8]
+set_location_assignment PIN_E1 -to OTG_DATA[9]
+set_location_assignment PIN_K6 -to OTG_DATA[10]
+set_location_assignment PIN_K5 -to OTG_DATA[11]
+set_location_assignment PIN_G4 -to OTG_DATA[12]
+set_location_assignment PIN_G3 -to OTG_DATA[13]
+set_location_assignment PIN_J6 -to OTG_DATA[14]
+set_location_assignment PIN_K8 -to OTG_DATA[15]
+set_location_assignment PIN_B3 -to OTG_INT0
+set_location_assignment PIN_C3 -to OTG_INT1
+set_location_assignment PIN_C2 -to OTG_DACK0_N
+set_location_assignment PIN_B2 -to OTG_DACK1_N
+set_location_assignment PIN_F6 -to OTG_DREQ0
+set_location_assignment PIN_E5 -to OTG_DREQ1
+set_location_assignment PIN_F3 -to OTG_FSPEED
+set_location_assignment PIN_G6 -to OTG_LSPEED
+set_location_assignment PIN_B14 -to TDI
+set_location_assignment PIN_A14 -to TCS
+set_location_assignment PIN_D14 -to TCK
+set_location_assignment PIN_F14 -to TDO
+set_location_assignment PIN_C4 -to TD_RESET
+set_location_assignment PIN_C8 -to VGA_R[0]
+set_location_assignment PIN_F10 -to VGA_R[1]
+set_location_assignment PIN_G10 -to VGA_R[2]
+set_location_assignment PIN_D9 -to VGA_R[3]
+set_location_assignment PIN_C9 -to VGA_R[4]
+set_location_assignment PIN_A8 -to VGA_R[5]
+set_location_assignment PIN_H11 -to VGA_R[6]
+set_location_assignment PIN_H12 -to VGA_R[7]
+set_location_assignment PIN_F11 -to VGA_R[8]
+set_location_assignment PIN_E10 -to VGA_R[9]
+set_location_assignment PIN_B9 -to VGA_G[0]
+set_location_assignment PIN_A9 -to VGA_G[1]
+set_location_assignment PIN_C10 -to VGA_G[2]
+set_location_assignment PIN_D10 -to VGA_G[3]
+set_location_assignment PIN_B10 -to VGA_G[4]
+set_location_assignment PIN_A10 -to VGA_G[5]
+set_location_assignment PIN_G11 -to VGA_G[6]
+set_location_assignment PIN_D11 -to VGA_G[7]
+set_location_assignment PIN_E12 -to VGA_G[8]
+set_location_assignment PIN_D12 -to VGA_G[9]
+set_location_assignment PIN_J13 -to VGA_B[0]
+set_location_assignment PIN_J14 -to VGA_B[1]
+set_location_assignment PIN_F12 -to VGA_B[2]
+set_location_assignment PIN_G12 -to VGA_B[3]
+set_location_assignment PIN_J10 -to VGA_B[4]
+set_location_assignment PIN_J11 -to VGA_B[5]
+set_location_assignment PIN_C11 -to VGA_B[6]
+set_location_assignment PIN_B11 -to VGA_B[7]
+set_location_assignment PIN_C12 -to VGA_B[8]
+set_location_assignment PIN_B12 -to VGA_B[9]
+set_location_assignment PIN_B8 -to VGA_CLK
+set_location_assignment PIN_D6 -to VGA_BLANK
+set_location_assignment PIN_A7 -to VGA_HS
+set_location_assignment PIN_D8 -to VGA_VS
+set_location_assignment PIN_B7 -to VGA_SYNC
+set_location_assignment PIN_A6 -to I2C_SCLK
+set_location_assignment PIN_B6 -to I2C_SDAT
+set_location_assignment PIN_J9 -to TD_DATA[0]
+set_location_assignment PIN_E8 -to TD_DATA[1]
+set_location_assignment PIN_H8 -to TD_DATA[2]
+set_location_assignment PIN_H10 -to TD_DATA[3]
+set_location_assignment PIN_G9 -to TD_DATA[4]
+set_location_assignment PIN_F9 -to TD_DATA[5]
+set_location_assignment PIN_D7 -to TD_DATA[6]
+set_location_assignment PIN_C7 -to TD_DATA[7]
+set_location_assignment PIN_D5 -to TD_HS
+set_location_assignment PIN_K9 -to TD_VS
+set_location_assignment PIN_C5 -to AUD_ADCLRCK
+set_location_assignment PIN_B5 -to AUD_ADCDAT
+set_location_assignment PIN_C6 -to AUD_DACLRCK
+set_location_assignment PIN_A4 -to AUD_DACDAT
+set_location_assignment PIN_A5 -to AUD_XCK
+set_location_assignment PIN_B4 -to AUD_BCLK
+set_location_assignment PIN_D17 -to ENET_DATA[0]
+set_location_assignment PIN_C17 -to ENET_DATA[1]
+set_location_assignment PIN_B18 -to ENET_DATA[2]
+set_location_assignment PIN_A18 -to ENET_DATA[3]
+set_location_assignment PIN_B17 -to ENET_DATA[4]
+set_location_assignment PIN_A17 -to ENET_DATA[5]
+set_location_assignment PIN_B16 -to ENET_DATA[6]
+set_location_assignment PIN_B15 -to ENET_DATA[7]
+set_location_assignment PIN_B20 -to ENET_DATA[8]
+set_location_assignment PIN_A20 -to ENET_DATA[9]
+set_location_assignment PIN_C19 -to ENET_DATA[10]
+set_location_assignment PIN_D19 -to ENET_DATA[11]
+set_location_assignment PIN_B19 -to ENET_DATA[12]
+set_location_assignment PIN_A19 -to ENET_DATA[13]
+set_location_assignment PIN_E18 -to ENET_DATA[14]
+set_location_assignment PIN_D18 -to ENET_DATA[15]
+set_location_assignment PIN_B24 -to ENET_CLK
+set_location_assignment PIN_A21 -to ENET_CMD
+set_location_assignment PIN_A23 -to ENET_CS_N
+set_location_assignment PIN_B21 -to ENET_INT
+set_location_assignment PIN_A22 -to ENET_RD_N
+set_location_assignment PIN_B22 -to ENET_WR_N
+set_location_assignment PIN_B23 -to ENET_RST_N
+set_location_assignment PIN_AE24 -to IRDA_TXD
+set_location_assignment PIN_AE25 -to IRDA_RXD
+set_location_assignment PIN_AD24 -to SD_DAT
+set_location_assignment PIN_AC23 -to SD_DAT3
+set_location_assignment PIN_Y21 -to SD_CMD
+set_location_assignment PIN_AD25 -to SD_CLK
+#set_location_assignment PIN_D25 -to GPIO_0[0]
+#set_location_assignment PIN_J22 -to GPIO_0[1]
+#set_location_assignment PIN_E26 -to GPIO_0[2]
+#set_location_assignment PIN_E25 -to GPIO_0[3]
+#set_location_assignment PIN_F24 -to GPIO_0[4]
+#set_location_assignment PIN_F23 -to GPIO_0[5]
+#set_location_assignment PIN_J21 -to GPIO_0[6]
+set_location_assignment PIN_J21 -to UART_RXD_JP1_7
+#set_location_assignment PIN_J20 -to GPIO_0[7]
+#set_location_assignment PIN_F25 -to GPIO_0[8]
+#set_location_assignment PIN_F26 -to GPIO_0[9]
+set_location_assignment PIN_N18 -to GPIO_0_10
+#set_location_assignment PIN_P18 -to GPIO_0[11]
+#set_location_assignment PIN_G23 -to GPIO_0[12]
+#set_location_assignment PIN_G24 -to GPIO_0[13]
+#set_location_assignment PIN_K22 -to GPIO_0[14]
+#set_location_assignment PIN_G25 -to GPIO_0[15]
+#set_location_assignment PIN_H23 -to GPIO_0[16]
+#set_location_assignment PIN_H24 -to GPIO_0[17]
+#set_location_assignment PIN_J23 -to GPIO_0[18]
+#set_location_assignment PIN_J24 -to GPIO_0[19]
+#set_location_assignment PIN_H25 -to GPIO_0[20]
+set_location_assignment PIN_H25 -to I_OR7_JP1_35_bis
+#set_location_assignment PIN_H26 -to GPIO_0[21]
+#set_location_assignment PIN_H19 -to GPIO_0[22]
+set_location_assignment PIN_H19 -to I_OR8_JP1_36_bis
+#set_location_assignment PIN_K18 -to GPIO_0_[23]
+#set_location_assignment PIN_K19 -to GPIO_0[24]
+set_location_assignment PIN_K19 -to UART_TXD_JP1_27
+#set_location_assignment PIN_K21 -to GPIO_0[25]
+#set_location_assignment PIN_K23 -to GPIO_0[26]
+#set_location_assignment PIN_K24 -to GPIO_0[27]
+#set_location_assignment PIN_L21 -to GPIO_0[28]
+#set_location_assignment PIN_L20 -to GPIO_0[29]
+#set_location_assignment PIN_J25 -to GPIO_0[30]
+set_location_assignment PIN_J25 -to I_OR7_JP1_35
+#set_location_assignment PIN_J26 -to GPIO_0[31]
+set_location_assignment PIN_J26 -to I_OR8_JP1_36
+#set_location_assignment PIN_L23 -to GPIO_0[32]
+set_location_assignment PIN_L23 -to CONFIG_MODE_JP1_37
+#set_location_assignment PIN_L24 -to GPIO_0[33]
+set_location_assignment PIN_L24 -to I_OT2_JP1_38
+#set_location_assignment PIN_L25 -to GPIO_0[34]
+#set_location_assignment PIN_L19 -to GPIO_0[35]
+set_location_assignment PIN_L25 -to INIT_JP1_39
+#set_location_assignment PIN_K25 -to GPIO_1[0]
+set_location_assignment PIN_K25 -to I_OT7_JP2_41
+#set_location_assignment PIN_K26 -to GPIO_1[1]
+set_location_assignment PIN_K26 -to I_OT6_JP2_42
+#set_location_assignment PIN_M22 -to GPIO_1[2]
+set_location_assignment PIN_M22 -to I_OT4_JP2_43
+#set_location_assignment PIN_M23 -to GPIO_1[3]
+set_location_assignment PIN_M23 -to I_OT3_JP2_44
+#set_location_assignment PIN_M19 -to GPIO_1[4]
+set_location_assignment PIN_M19 -to I_OT1_JP2_45
+#set_location_assignment PIN_M20 -to GPIO_1[5]
+set_location_assignment PIN_M20 -to I_OT0_JP2_46
+#set_location_assignment PIN_N20 -to GPIO_1[6]
+set_location_assignment PIN_N20 -to CONFIG_OUT0_JP2_47
+#set_location_assignment PIN_M21 -to GPIO_1[7]
+set_location_assignment PIN_M21 -to I_OL6_JP2_48
+#set_location_assignment PIN_M24 -to GPIO_1[8]
+set_location_assignment PIN_M24 -to CONFIG_OUT1_JP2_49
+#set_location_assignment PIN_M25 -to GPIO_1[9]
+set_location_assignment PIN_M25 -to I_OL3_JP2_50
+#set_location_assignment PIN_N24 -to GPIO_1_10
+set_location_assignment PIN_N24 -to I_OL7_JP2_53
+#set_location_assignment PIN_P24 -to GPIO_1[11]
+set_location_assignment PIN_P24 -to I_OL0_JP2_54
+#set_location_assignment PIN_R25 -to GPIO_1[12]
+set_location_assignment PIN_R25 -to I_OL4_JP2_55
+#set_location_assignment PIN_R24 -to GPIO_1[13]
+set_location_assignment PIN_R24 -to I_OL8_JP2_56
+#set_location_assignment PIN_R20 -to GPIO_1[14]
+set_location_assignment PIN_R20 -to I_OL1_JP2_57
+#set_location_assignment PIN_T22 -to GPIO_1[15]
+set_location_assignment PIN_T22 -to I_OT8_JP2_58
+#set_location_assignment PIN_T23 -to GPIO_1_16
+set_location_assignment PIN_T23 -to I_OL2_JP2_59
+#set_location_assignment PIN_T24 -to GPIO_1[17]
+set_location_assignment PIN_T24 -to I_OB2_JP2_60
+#set_location_assignment PIN_T25 -to GPIO_1[18]
+set_location_assignment PIN_T25 -to I_OL5_JP2_61
+#set_location_assignment PIN_T18 -to GPIO_1[19]
+set_location_assignment PIN_T18 -to I_OB5_JP2_62
+#set_location_assignment PIN_T21 -to GPIO_1[20]
+set_location_assignment PIN_T21 -to I_OT5_JP2_63
+#set_location_assignment PIN_T20 -to GPIO_1[21]
+set_location_assignment PIN_T20 -to I_OR2_JP2_64
+#set_location_assignment PIN_U26 -to GPIO_1[22]
+set_location_assignment PIN_U26 -to I_OB8_JP2_65
+#set_location_assignment PIN_U25 -to GPIO_1[23]
+set_location_assignment PIN_U25 -to CONFIG_ACK_IN_JP2_66
+#set_location_assignment PIN_U23 -to GPIO_1[24]
+set_location_assignment PIN_U23 -to I_OR5_JP2_67
+#set_location_assignment PIN_U24 -to GPIO_1[25]
+set_location_assignment PIN_U24 -to I_OB0_JP2_68
+#set_location_assignment PIN_R19 -to GPIO_1[26]
+set_location_assignment PIN_R19 -to I_OB1_JP2_71
+#set_location_assignment PIN_T19 -to GPIO_1[27]
+set_location_assignment PIN_T19 -to I_OB3_JP2_72
+#set_location_assignment PIN_U20 -to GPIO_1[28]
+set_location_assignment PIN_U20 -to I_OB4_JP2_73
+#set_location_assignment PIN_U21 -to GPIO_1[29]
+set_location_assignment PIN_U21 -to I_OB6_JP2_74
+#set_location_assignment PIN_V26 -to GPIO_1[30]
+set_location_assignment PIN_V26 -to I_OB7_JP2_75
+#set_location_assignment PIN_V25 -to GPIO_1[31]
+set_location_assignment PIN_V25 -to I_OR0_JP2_76
+#set_location_assignment PIN_V24 -to GPIO_1[32]
+set_location_assignment PIN_V24 -to I_OR1_JP2_77
+#set_location_assignment PIN_V23 -to GPIO_1[33]
+set_location_assignment PIN_V23 -to I_OR3_JP2_78
+#set_location_assignment PIN_W25 -to GPIO_1[34]
+set_location_assignment PIN_W25 -to I_OR4_JP2_79
+#set_location_assignment PIN_W23 -to GPIO_1[35]
+set_location_assignment PIN_W23 -to I_OR6_JP2_80
+
+# Timing Assignments
+# ==================
+#set_global_assignment -name REPORT_IO_PATHS_SEPARATELY ON
+#set_global_assignment -name FLOW_ENABLE_TIMING_CONSTRAINT_CHECK ON
+#set_global_assignment -name DO_COMBINED_ANALYSIS OFF
+
+# Analysis & Synthesis Assignments
+# ================================
+set_global_assignment -name FAMILY "Cyclone II"
+set_global_assignment -name TOP_LEVEL_ENTITY DE2
+
+# Fitter Assignments
+# ==================
+set_global_assignment -name DEVICE EP2C35F672C6
+set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO"
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS "AS INPUT TRI-STATED"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "AS INPUT TRI-STATED"
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[0]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[1]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[2]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[3]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[4]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[5]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[6]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_DATA[7]
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_HS
+set_instance_assignment -name IO_STANDARD LVTTL -to TD_VS
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_ADCLRCK
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_ADCDAT
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_DACLRCK
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_DACDAT
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_XCK
+set_instance_assignment -name IO_STANDARD LVTTL -to AUD_BCLK
+set_instance_assignment -name IO_STANDARD LVTTL -to ENET_DATA[0]
+set_instance_assignment -name IO_STANDARD LVTTL -to SD_DAT3
+set_global_assignment -name STRATIX_DEVICE_IO_STANDARD LVTTL
+set_global_assignment -name ERROR_CHECK_FREQUENCY_DIVISOR 1
+
+# Timing Analysis Assignments
+# ===========================
+set_global_assignment -name ENABLE_RECOVERY_REMOVAL_ANALYSIS ON
+set_global_assignment -name ENABLE_CLOCK_LATENCY ON
+
+# Assembler Assignments
+# =====================
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS_NO_OUTPUT_GND "AS INPUT TRI-STATED"
+set_global_assignment -name FMAX_REQUIREMENT "50 MHz" -section_id OSC_50
+set_instance_assignment -name CLOCK_SETTINGS OSC_50 -to OSC_50
+set_global_assignment -name LL_ROOT_REGION ON -section_id "Root Region"
+set_global_assignment -name LL_MEMBER_STATE LOCKED -section_id "Root Region"
+
+set_global_assignment -name FMAX_REQUIREMENT "50 MHz"
+set_global_assignment -name FLOW_ENABLE_TIMING_CONSTRAINT_CHECK OFF
+set_global_assignment -name EDA_SIMULATION_TOOL "ModelSim-Altera (VHDL)"
+set_global_assignment -name EDA_OUTPUT_DATA_FORMAT VHDL -section_id eda_simulation
+
+set_global_assignment -name VERILOG_FILE CMD_Decode_simple.v
+set_global_assignment -name VHDL_FILE AI.vhd
+set_global_assignment -name SOURCE_FILE RS232_Command.h
+set_global_assignment -name VERILOG_FILE async_receiver_altera.v
+set_global_assignment -name VERILOG_FILE async_transmitter_altera.v
+set_global_assignment -name VERILOG_FILE DE2.v
+set_global_assignment -name VERILOG_FILE LCD_TEST_SAFE.v
+set_global_assignment -name VERILOG_FILE RS232_Controller.v
+set_global_assignment -name VERILOG_FILE SEG7_LUT.v
+set_global_assignment -name VERILOG_FILE SEG7_LUT_8.v
+
+set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top
+set_global_assignment -name PARTITION_COLOR 2147039 -section_id Top
+set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
+set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top
DE2/DE2.qsf
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/LCD_TEST_SAFE.v
===================================================================
--- DE2/LCD_TEST_SAFE.v (nonexistent)
+++ DE2/LCD_TEST_SAFE.v (revision 4)
@@ -0,0 +1,335 @@
+module LCD_TEST ( // Host Side
+ iCLK,iRST_N,msg_in,
+ // LCD Side
+ LCD_DATA,LCD_RW,LCD_EN,LCD_RS );
+// Host Side
+input iCLK,iRST_N;
+input [2:0] msg_in;
+// LCD Side
+output [7:0] LCD_DATA;
+output LCD_RW,LCD_EN,LCD_RS;
+// Internal Wires/Registers
+reg [5:0] LUT_INDEX;
+reg[5:0] LUT_INDEX_NEXT;
+reg [8:0] LUT_DATA;
+reg [5:0] mLCD_ST,mLCD_nxt_ST;
+reg [17:0] mDLY;
+reg [17:0] mDLY_NEXT;
+reg mLCD_Start;
+reg mLCD_Start_NEXT;
+reg [7:0] mLCD_DATA;
+reg mLCD_RS;
+reg [2:0] msg_in_int;
+wire mLCD_Done;
+
+parameter LCD_INTIAL = 0;
+parameter LCD_LINE1 = 5;
+parameter LCD_CH_LINE = LCD_LINE1+16;
+parameter LCD_LINE2 = LCD_LINE1+16+1;
+parameter LUT_SIZE = LCD_LINE1+32+1;
+
+always@(posedge iCLK or negedge iRST_N)
+begin
+ if(!iRST_N)
+ begin
+ mLCD_ST<=4;
+ mLCD_DATA <= 0;
+ mLCD_RS <= 0;
+ msg_in_int <= 0;
+ end
+ else
+ begin
+ mLCD_ST<=mLCD_nxt_ST;
+ LUT_INDEX<=LUT_INDEX_NEXT;
+ mDLY<=mDLY_NEXT;
+ mLCD_Start<=mLCD_Start_NEXT;
+ msg_in_int<=msg_in;
+ mLCD_DATA <= LUT_DATA[7:0];
+ mLCD_RS <= LUT_DATA[8];
+ end
+end
+
+
+//always@(mLCD_ST or msg_in or msg_in_int or LUT_INDEX or LUT_DATA or msg_in_int)
+always@(*)
+ begin
+ case(mLCD_ST)
+ 0: begin
+ mLCD_Start_NEXT <= 1;
+ mDLY_NEXT <= mDLY;
+ if(msg_in_int!=msg_in)
+ begin
+ LUT_INDEX_NEXT<=0;
+ end
+ else begin
+ LUT_INDEX_NEXT<=LUT_INDEX;
+ end
+
+ if( LUT_INDEX"
+set_global_assignment -name VERILOG_INPUT_VERSION Verilog_2001
+set_global_assignment -name VHDL_INPUT_VERSION VHDL_1993
+set_global_assignment -name FAMILY "Stratix II"
+set_global_assignment -name TRUE_WYSIWYG_FLOW Off
+set_global_assignment -name SMART_COMPILE_IGNORES_TDC_FOR_STRATIX_PLL_CHANGES Off
+set_global_assignment -name STATE_MACHINE_PROCESSING Auto
+set_global_assignment -name SAFE_STATE_MACHINE Off
+set_global_assignment -name EXTRACT_VERILOG_STATE_MACHINES On
+set_global_assignment -name EXTRACT_VHDL_STATE_MACHINES On
+set_global_assignment -name IGNORE_VERILOG_INITIAL_CONSTRUCTS Off
+set_global_assignment -name VERILOG_CONSTANT_LOOP_LIMIT 5000
+set_global_assignment -name VERILOG_NON_CONSTANT_LOOP_LIMIT 250
+set_global_assignment -name ADD_PASS_THROUGH_LOGIC_TO_INFERRED_RAMS On
+set_global_assignment -name PARALLEL_SYNTHESIS -value OFF
+set_global_assignment -name DSP_BLOCK_BALANCING Auto
+set_global_assignment -name MAX_BALANCING_DSP_BLOCKS "-1 (Unlimited)"
+set_global_assignment -name NOT_GATE_PUSH_BACK On
+set_global_assignment -name ALLOW_POWER_UP_DONT_CARE On
+set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS Off
+set_global_assignment -name REMOVE_DUPLICATE_REGISTERS On
+set_global_assignment -name IGNORE_CARRY_BUFFERS Off
+set_global_assignment -name IGNORE_CASCADE_BUFFERS Off
+set_global_assignment -name IGNORE_GLOBAL_BUFFERS Off
+set_global_assignment -name IGNORE_ROW_GLOBAL_BUFFERS Off
+set_global_assignment -name IGNORE_LCELL_BUFFERS Off
+set_global_assignment -name MAX7000_IGNORE_LCELL_BUFFERS AUTO
+set_global_assignment -name IGNORE_SOFT_BUFFERS On
+set_global_assignment -name MAX7000_IGNORE_SOFT_BUFFERS Off
+set_global_assignment -name LIMIT_AHDL_INTEGERS_TO_32_BITS Off
+set_global_assignment -name AUTO_GLOBAL_CLOCK_MAX On
+set_global_assignment -name AUTO_GLOBAL_OE_MAX On
+set_global_assignment -name MAX_AUTO_GLOBAL_REGISTER_CONTROLS On
+set_global_assignment -name AUTO_IMPLEMENT_IN_ROM Off
+set_global_assignment -name APEX20K_TECHNOLOGY_MAPPER Lut
+set_global_assignment -name OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name STRATIXII_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name CYCLONE_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name STRATIX_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name MAXII_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name MAX7000_OPTIMIZATION_TECHNIQUE Speed
+set_global_assignment -name APEX20K_OPTIMIZATION_TECHNIQUE Balanced
+set_global_assignment -name MERCURY_OPTIMIZATION_TECHNIQUE Area
+set_global_assignment -name FLEX6K_OPTIMIZATION_TECHNIQUE Area
+set_global_assignment -name FLEX10K_OPTIMIZATION_TECHNIQUE Area
+set_global_assignment -name ALLOW_XOR_GATE_USAGE On
+set_global_assignment -name AUTO_LCELL_INSERTION On
+set_global_assignment -name CARRY_CHAIN_LENGTH 48
+set_global_assignment -name FLEX6K_CARRY_CHAIN_LENGTH 32
+set_global_assignment -name FLEX10K_CARRY_CHAIN_LENGTH 32
+set_global_assignment -name MERCURY_CARRY_CHAIN_LENGTH 48
+set_global_assignment -name STRATIX_CARRY_CHAIN_LENGTH 70
+set_global_assignment -name STRATIXII_CARRY_CHAIN_LENGTH 70
+set_global_assignment -name CASCADE_CHAIN_LENGTH 2
+set_global_assignment -name PARALLEL_EXPANDER_CHAIN_LENGTH 16
+set_global_assignment -name MAX7000_PARALLEL_EXPANDER_CHAIN_LENGTH 4
+set_global_assignment -name AUTO_CARRY_CHAINS On
+set_global_assignment -name AUTO_CASCADE_CHAINS On
+set_global_assignment -name AUTO_PARALLEL_EXPANDERS On
+set_global_assignment -name AUTO_OPEN_DRAIN_PINS On
+set_global_assignment -name ADV_NETLIST_OPT_SYNTH_WYSIWYG_REMAP Off
+set_global_assignment -name AUTO_ROM_RECOGNITION On
+set_global_assignment -name AUTO_RAM_RECOGNITION On
+set_global_assignment -name AUTO_DSP_RECOGNITION On
+set_global_assignment -name AUTO_SHIFT_REGISTER_RECOGNITION Auto
+set_global_assignment -name AUTO_CLOCK_ENABLE_RECOGNITION On
+set_global_assignment -name STRICT_RAM_RECOGNITION Off
+set_global_assignment -name ALLOW_SYNCH_CTRL_USAGE On
+set_global_assignment -name FORCE_SYNCH_CLEAR Off
+set_global_assignment -name AUTO_RAM_BLOCK_BALANCING On
+set_global_assignment -name AUTO_RAM_TO_LCELL_CONVERSION Off
+set_global_assignment -name AUTO_RESOURCE_SHARING Off
+set_global_assignment -name ALLOW_ANY_RAM_SIZE_FOR_RECOGNITION Off
+set_global_assignment -name ALLOW_ANY_ROM_SIZE_FOR_RECOGNITION Off
+set_global_assignment -name ALLOW_ANY_SHIFT_REGISTER_SIZE_FOR_RECOGNITION Off
+set_global_assignment -name MAX7000_FANIN_PER_CELL 100
+set_global_assignment -name USE_LOGICLOCK_CONSTRAINTS_IN_BALANCING On
+set_global_assignment -name MAX_RAM_BLOCKS_M512 "-1 (Unlimited)"
+set_global_assignment -name MAX_RAM_BLOCKS_M4K "-1 (Unlimited)"
+set_global_assignment -name MAX_RAM_BLOCKS_MRAM "-1 (Unlimited)"
+set_global_assignment -name IGNORE_TRANSLATE_OFF_AND_SYNTHESIS_OFF Off
+set_global_assignment -name STRATIXGX_BYPASS_REMAPPING_OF_FORCE_SIGNAL_DETECT_SIGNAL_THRESHOLD_SELECT Off
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Cyclone III LS"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Cyclone III"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Stratix III"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "HardCopy III"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS Off -family "Arria GX"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS Off -family "Cyclone II"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS Off -family "HardCopy II"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS Off -family "Stratix II GX"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS On -family "Stratix V"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Cyclone IV E"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Cyclone IV GX"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS Off -family "Stratix II"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Stratix IV"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "Arria II GX"
+set_global_assignment -name SYNTH_TIMING_DRIVEN_SYNTHESIS -value OFF -family "HardCopy IV"
+set_global_assignment -name REPORT_PARAMETER_SETTINGS On
+set_global_assignment -name REPORT_SOURCE_ASSIGNMENTS On
+set_global_assignment -name REPORT_CONNECTIVITY_CHECKS On
+set_global_assignment -name IGNORE_MAX_FANOUT_ASSIGNMENTS Off
+set_global_assignment -name SYNCHRONIZATION_REGISTER_CHAIN_LENGTH 2
+set_global_assignment -name OPTIMIZE_POWER_DURING_SYNTHESIS "Normal compilation"
+set_global_assignment -name HDL_MESSAGE_LEVEL Level2
+set_global_assignment -name USE_HIGH_SPEED_ADDER Auto
+set_global_assignment -name NUMBER_OF_REMOVED_REGISTERS_REPORTED 5000
+set_global_assignment -name NUMBER_OF_INVERTED_REGISTERS_REPORTED 100
+set_global_assignment -name SYNTH_CLOCK_MUX_PROTECTION On
+set_global_assignment -name SYNTH_GATED_CLOCK_CONVERSION Off
+set_global_assignment -name BLOCK_DESIGN_NAMING Auto
+set_global_assignment -name SYNTH_PROTECT_SDC_CONSTRAINT Off
+set_global_assignment -name SYNTHESIS_EFFORT Auto
+set_global_assignment -name SHIFT_REGISTER_RECOGNITION_ACLR_SIGNAL On
+set_global_assignment -name PRE_MAPPING_RESYNTHESIS Off
+set_global_assignment -name SYNTH_MESSAGE_LEVEL Medium
+set_global_assignment -name DISABLE_REGISTER_MERGING_ACROSS_HIERARCHIES Auto
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone III LS"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone III"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Stratix III"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "HardCopy III"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone II"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family Cyclone
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "HardCopy II"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone IV E"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Cyclone IV GX"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Stratix II"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Stratix IV"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "Arria II GX"
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family Stratix
+set_global_assignment -name SYNTH_RESOURCE_AWARE_INFERENCE_FOR_BLOCK_RAM On -family "HardCopy IV"
+set_global_assignment -name MAX_LABS "-1 (Unlimited)"
+set_global_assignment -name RBCGEN_CRITICAL_WARNING_TO_ERROR On
+set_global_assignment -name SYNTHESIS_SEED 1
+set_global_assignment -name TXPMA_SLEW_RATE Low
+set_global_assignment -name ADCE_ENABLED Auto
+set_global_assignment -name ROUTER_TIMING_OPTIMIZATION_LEVEL Normal
+set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS Off
+set_global_assignment -name PLACEMENT_EFFORT_MULTIPLIER 1.0
+set_global_assignment -name ROUTER_EFFORT_MULTIPLIER 1.0
+set_global_assignment -name FIT_ATTEMPTS_TO_SKIP 0.0
+set_global_assignment -name ECO_ALLOW_ROUTING_CHANGES Off
+set_global_assignment -name DEVICE AUTO
+set_global_assignment -name BASE_PIN_OUT_FILE_ON_SAMEFRAME_DEVICE Off
+set_global_assignment -name ENABLE_JTAG_BST_SUPPORT Off
+set_global_assignment -name MAX7000_ENABLE_JTAG_BST_SUPPORT On
+set_global_assignment -name ENABLE_NCEO_OUTPUT Off
+set_global_assignment -name RESERVE_NCEO_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "Use as programming pin"
+set_global_assignment -name STRATIXIII_UPDATE_MODE Standard
+set_global_assignment -name STRATIX_UPDATE_MODE Standard
+set_global_assignment -name CVPCIE_MODE Off
+set_global_assignment -name STRATIXV_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name STRATIXIII_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name CYCLONEIII_CONFIGURATION_SCHEME "Active Serial"
+set_global_assignment -name STRATIXII_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name CYCLONEII_CONFIGURATION_SCHEME "Active Serial"
+set_global_assignment -name APEX20K_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name STRATIX_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name CYCLONE_CONFIGURATION_SCHEME "Active Serial"
+set_global_assignment -name MERCURY_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name FLEX6K_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name FLEX10K_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name APEXII_CONFIGURATION_SCHEME "Passive Serial"
+set_global_assignment -name USER_START_UP_CLOCK Off
+set_global_assignment -name ENABLE_VREFA_PIN Off
+set_global_assignment -name ENABLE_VREFB_PIN Off
+set_global_assignment -name ALWAYS_ENABLE_INPUT_BUFFERS Off
+set_global_assignment -name ENABLE_ASMI_FOR_FLASH_LOADER Off
+set_global_assignment -name ENABLE_DEVICE_WIDE_RESET Off
+set_global_assignment -name ENABLE_DEVICE_WIDE_OE Off
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS "As output driving ground"
+set_global_assignment -name FLEX10K_ENABLE_LOCK_OUTPUT Off
+set_global_assignment -name ENABLE_INIT_DONE_OUTPUT Off
+set_global_assignment -name INIT_DONE_OPEN_DRAIN On
+set_global_assignment -name RESERVE_NWS_NRS_NCS_CS_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_RDYNBUSY_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_DATA31_THROUGH_DATA16_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_DATA15_THROUGH_DATA8_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_DATA7_THROUGH_DATA1_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_DATA0_AFTER_CONFIGURATION "As input tri-stated"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family "Cyclone II"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family Cyclone
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family "Stratix II GX"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family "HardCopy II"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family "Arria GX"
+set_global_assignment -name RESERVE_ASDO_AFTER_CONFIGURATION "Use as regular IO" -family "Stratix II"
+set_global_assignment -name RESERVE_DATA1_AFTER_CONFIGURATION "As input tri-stated"
+set_global_assignment -name RESERVE_DATA7_THROUGH_DATA2_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_FLASH_NCE_AFTER_CONFIGURATION "As input tri-stated"
+set_global_assignment -name RESERVE_OTHER_AP_PINS_AFTER_CONFIGURATION "Use as regular IO"
+set_global_assignment -name RESERVE_DCLK_AFTER_CONFIGURATION "Use as programming pin"
+set_global_assignment -name CRC_ERROR_CHECKING Off
+set_global_assignment -name INTERNAL_SCRUBBING Off
+set_global_assignment -name PR_ERROR_OPEN_DRAIN On
+set_global_assignment -name PR_READY_OPEN_DRAIN On
+set_global_assignment -name ENABLE_CVPCIE_CONFDONE Off
+set_global_assignment -name CVPCIE_CONFDONE_OPEN_DRAIN On
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "Stratix GX"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "HardCopy III"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "Cyclone II"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "HardCopy II"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Cyclone IV E"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Cyclone IV GX"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Stratix IV"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "HardCopy IV"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Cyclone III LS"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Cyclone III"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Stratix III"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Arria GX"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "Stratix II GX"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family Cyclone
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "All Paths" -family "Stratix V"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "Stratix II"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family "MAX II"
+set_global_assignment -name OPTIMIZE_HOLD_TIMING "IO Paths and Minimum TPD Paths" -family Stratix
+set_global_assignment -name OPTIMIZE_HOLD_TIMING -value "IO PATHS AND MINIMUM TPD PATHS" -family "Arria II GX"
+set_global_assignment -name OPTIMIZE_MULTI_CORNER_TIMING Off
+set_global_assignment -name BLOCK_RAM_TO_MLAB_CELL_CONVERSION On
+set_global_assignment -name BLOCK_RAM_AND_MLAB_EQUIVALENT_POWER_UP_CONDITIONS Auto
+set_global_assignment -name BLOCK_RAM_AND_MLAB_EQUIVALENT_PAUSED_READ_CAPABILITIES Care
+set_global_assignment -name PROGRAMMABLE_POWER_TECHNOLOGY_SETTING "Force All Tiles with Failing Timing Paths to High Speed"
+set_global_assignment -name PROGRAMMABLE_POWER_MAXIMUM_HIGH_SPEED_FRACTION_OF_USED_LAB_TILES 1.0
+set_global_assignment -name GUARANTEE_MIN_DELAY_CORNER_IO_ZERO_HOLD_TIME On
+set_global_assignment -name OPTIMIZE_POWER_DURING_FITTING "Normal compilation"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Cyclone III LS"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Cyclone III"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Stratix III"
+set_global_assignment -name OPTIMIZE_SSN Off -family "HardCopy III"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Cyclone IV E"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Stratix IV"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Cyclone IV GX"
+set_global_assignment -name OPTIMIZE_SSN Off -family "HardCopy IV"
+set_global_assignment -name OPTIMIZE_SSN Off -family "Arria II GX"
+set_global_assignment -name OPTIMIZE_TIMING "Normal compilation"
+set_global_assignment -name ECO_OPTIMIZE_TIMING Off
+set_global_assignment -name ECO_REGENERATE_REPORT Off
+set_global_assignment -name OPTIMIZE_IOC_REGISTER_PLACEMENT_FOR_TIMING -value ON
+set_global_assignment -name FIT_ONLY_ONE_ATTEMPT Off
+set_global_assignment -name FINAL_PLACEMENT_OPTIMIZATION Automatically
+set_global_assignment -name FITTER_AGGRESSIVE_ROUTABILITY_OPTIMIZATION Automatically
+set_global_assignment -name SEED 1
+set_global_assignment -name SLOW_SLEW_RATE Off
+set_global_assignment -name PCI_IO Off
+set_global_assignment -name TURBO_BIT On
+set_global_assignment -name WEAK_PULL_UP_RESISTOR Off
+set_global_assignment -name ENABLE_BUS_HOLD_CIRCUITRY Off
+set_global_assignment -name AUTO_GLOBAL_MEMORY_CONTROLS Off
+set_global_assignment -name MIGRATION_CONSTRAIN_CORE_RESOURCES On
+set_global_assignment -name AUTO_PACKED_REGISTERS_STRATIXII AUTO
+set_global_assignment -name AUTO_PACKED_REGISTERS_MAXII AUTO
+set_global_assignment -name AUTO_PACKED_REGISTERS_CYCLONE Auto
+set_global_assignment -name AUTO_PACKED_REGISTERS Off
+set_global_assignment -name AUTO_PACKED_REGISTERS_STRATIX AUTO
+set_global_assignment -name NORMAL_LCELL_INSERT On
+set_global_assignment -name CARRY_OUT_PINS_LCELL_INSERT On
+set_global_assignment -name AUTO_DELAY_CHAINS On
+set_global_assignment -name XSTL_INPUT_ALLOW_SE_BUFFER Off
+set_global_assignment -name TREAT_BIDIR_AS_OUTPUT Off
+set_global_assignment -name AUTO_MERGE_PLLS On
+set_global_assignment -name IGNORE_MODE_FOR_MERGE Off
+set_global_assignment -name AUTO_TURBO_BIT ON
+set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC_FOR_AREA Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_LOG_FILE Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_MAP_LOGIC_TO_MEMORY_FOR_AREA Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_RETIMING Off
+set_global_assignment -name PHYSICAL_SYNTHESIS_ASYNCHRONOUS_SIGNAL_PIPELINING Off
+set_global_assignment -name IO_PLACEMENT_OPTIMIZATION On
+set_global_assignment -name ALLOW_LVTTL_LVCMOS_INPUT_LEVELS_TO_OVERDRIVE_INPUT_BUFFER Off
+set_global_assignment -name OVERRIDE_DEFAULT_ELECTROMIGRATION_PARAMETERS Off
+set_global_assignment -name FITTER_EFFORT "Auto Fit"
+set_global_assignment -name FITTER_AUTO_EFFORT_DESIRED_SLACK_MARGIN 0ns
+set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT Normal
+set_global_assignment -name ROUTER_LCELL_INSERTION_AND_LOGIC_DUPLICATION AUTO
+set_global_assignment -name ROUTER_REGISTER_DUPLICATION AUTO
+set_global_assignment -name STRATIXGX_ALLOW_CLOCK_FANOUT_WITH_ANALOG_RESET Off
+set_global_assignment -name AUTO_GLOBAL_CLOCK On
+set_global_assignment -name AUTO_GLOBAL_OE On
+set_global_assignment -name AUTO_GLOBAL_REGISTER_CONTROLS On
+set_global_assignment -name FITTER_EARLY_TIMING_ESTIMATE_MODE Realistic
+set_global_assignment -name STRATIXGX_ALLOW_GIGE_UNDER_FULL_DATARATE_RANGE Off
+set_global_assignment -name STRATIXGX_ALLOW_RX_CORECLK_FROM_NON_RX_CLKOUT_SOURCE_IN_DOUBLE_DATA_WIDTH_MODE Off
+set_global_assignment -name STRATIXGX_ALLOW_GIGE_IN_DOUBLE_DATA_WIDTH_MODE Off
+set_global_assignment -name STRATIXGX_ALLOW_PARALLEL_LOOPBACK_IN_DOUBLE_DATA_WIDTH_MODE Off
+set_global_assignment -name STRATIXGX_ALLOW_XAUI_IN_SINGLE_DATA_WIDTH_MODE Off
+set_global_assignment -name STRATIXGX_ALLOW_XAUI_WITH_CORECLK_SELECTED_AT_RATE_MATCHER Off
+set_global_assignment -name STRATIXGX_ALLOW_XAUI_WITH_RX_CORECLK_FROM_NON_TXPLL_SOURCE Off
+set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITH_CORECLK_SELECTED_AT_RATE_MATCHER Off
+set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITHOUT_8B10B Off
+set_global_assignment -name STRATIXGX_ALLOW_GIGE_WITH_RX_CORECLK_FROM_NON_TXPLL_SOURCE Off
+set_global_assignment -name STRATIXGX_ALLOW_POST8B10B_LOOPBACK Off
+set_global_assignment -name STRATIXGX_ALLOW_REVERSE_PARALLEL_LOOPBACK Off
+set_global_assignment -name STRATIXGX_ALLOW_USE_OF_GXB_COUPLED_IOS Off
+set_global_assignment -name GENERATE_GXB_RECONFIG_MIF Off
+set_global_assignment -name GENERATE_GXB_RECONFIG_MIF_WITH_PLL Off
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS_WEAK_PULLUP "As input tri-stated with weak pull-up"
+set_global_assignment -name STOP_AFTER_CONGESTION_MAP Off
+set_global_assignment -name ENABLE_HOLD_BACK_OFF On
+set_global_assignment -name CONFIGURATION_VCCIO_LEVEL Auto
+set_global_assignment -name FORCE_CONFIGURATION_VCCIO Off
+set_global_assignment -name SYNCHRONIZER_IDENTIFICATION Off
+set_global_assignment -name ENABLE_BENEFICIAL_SKEW_OPTIMIZATION -value OFF
+set_global_assignment -name OPTIMIZE_FOR_METASTABILITY On
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Cyclone IV E"
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Cyclone III"
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN On -family "Stratix V"
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "HardCopy III"
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Cyclone III LS"
+set_global_assignment -name CRC_ERROR_OPEN_DRAIN Off -family "Stratix III"
+set_global_assignment -name MAX_GLOBAL_CLOCKS_ALLOWED "-1 (Unlimited)"
+set_global_assignment -name MAX_REGIONAL_CLOCKS_ALLOWED "-1 (Unlimited)"
+set_global_assignment -name MAX_PERIPHERY_CLOCKS_ALLOWED "-1 (Unlimited)"
+set_global_assignment -name MAX_CLOCKS_ALLOWED "-1 (Unlimited)"
+set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_100MHz -family "Stratix V"
+set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_40MHz -family "Arria II GX"
+set_global_assignment -name ACTIVE_SERIAL_CLOCK FREQ_40MHz -family "Cyclone IV GX"
+set_global_assignment -name M144K_BLOCK_READ_CLOCK_DUTY_CYCLE_DEPENDENCY Off
+set_global_assignment -name STRATIXIII_MRAM_COMPATIBILITY On
+set_global_assignment -name FORCE_FITTER_TO_AVOID_PERIPHERY_PLACEMENT_WARNINGS Off
+set_global_assignment -name AUTO_C3_M9K_BIT_SKIP Off
+set_global_assignment -name PR_DONE_OPEN_DRAIN On
+set_global_assignment -name NCEO_OPEN_DRAIN On
+set_global_assignment -name ENABLE_CRC_ERROR_PIN Off
+set_global_assignment -name ENABLE_PR_PINS Off
+set_global_assignment -name CLAMPING_DIODE Off
+set_global_assignment -name TRI_STATE_SPI_PINS Off
+set_global_assignment -name EDA_SIMULATION_TOOL ""
+set_global_assignment -name EDA_TIMING_ANALYSIS_TOOL ""
+set_global_assignment -name EDA_BOARD_DESIGN_TIMING_TOOL ""
+set_global_assignment -name EDA_BOARD_DESIGN_SYMBOL_TOOL ""
+set_global_assignment -name EDA_BOARD_DESIGN_SIGNAL_INTEGRITY_TOOL ""
+set_global_assignment -name EDA_BOARD_DESIGN_BOUNDARY_SCAN_TOOL ""
+set_global_assignment -name EDA_BOARD_DESIGN_TOOL ""
+set_global_assignment -name EDA_FORMAL_VERIFICATION_TOOL ""
+set_global_assignment -name EDA_RESYNTHESIS_TOOL ""
+set_global_assignment -name ON_CHIP_BITSTREAM_DECOMPRESSION On
+set_global_assignment -name COMPRESSION_MODE Off
+set_global_assignment -name CLOCK_SOURCE Internal
+set_global_assignment -name CONFIGURATION_CLOCK_FREQUENCY "10 MHz"
+set_global_assignment -name CONFIGURATION_CLOCK_DIVISOR 1
+set_global_assignment -name ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE On
+set_global_assignment -name FLEX6K_ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE Off
+set_global_assignment -name FLEX10K_ENABLE_LOW_VOLTAGE_MODE_ON_CONFIG_DEVICE On
+set_global_assignment -name MAX7000S_JTAG_USER_CODE FFFF
+set_global_assignment -name STRATIX_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name APEX20K_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name MERCURY_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name FLEX10K_JTAG_USER_CODE 7F
+set_global_assignment -name MAX7000_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name MAX7000_USE_CHECKSUM_AS_USERCODE Off
+set_global_assignment -name USE_CHECKSUM_AS_USERCODE Off
+set_global_assignment -name SECURITY_BIT Off
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family MAX7000B
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "HardCopy II"
+set_global_assignment -name USE_CONFIGURATION_DEVICE -value ON -family "Cyclone IV E"
+set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Stratix IV"
+set_global_assignment -name USE_CONFIGURATION_DEVICE -value ON -family "Cyclone III"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family MAX7000AE
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family Cyclone
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "Stratix II GX"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "MAX II"
+set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "Arria II GX"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "Stratix GX"
+set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "HardCopy III"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family MAX7000S
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "Cyclone II"
+set_global_assignment -name USE_CONFIGURATION_DEVICE -value ON -family "Cyclone IV GX"
+set_global_assignment -name USE_CONFIGURATION_DEVICE Off -family "HardCopy IV"
+set_global_assignment -name USE_CONFIGURATION_DEVICE -value ON -family "Cyclone III LS"
+set_global_assignment -name USE_CONFIGURATION_DEVICE -value ON -family "Stratix III"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "Arria GX"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family MAX3000A
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family "Stratix II"
+set_global_assignment -name USE_CONFIGURATION_DEVICE On -family Stratix
+set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE Auto
+set_global_assignment -name STRATIXII_CONFIGURATION_DEVICE Auto
+set_global_assignment -name APEX20K_CONFIGURATION_DEVICE Auto
+set_global_assignment -name MERCURY_CONFIGURATION_DEVICE Auto
+set_global_assignment -name FLEX6K_CONFIGURATION_DEVICE Auto
+set_global_assignment -name FLEX10K_CONFIGURATION_DEVICE Auto
+set_global_assignment -name CYCLONE_CONFIGURATION_DEVICE Auto
+set_global_assignment -name STRATIX_CONFIGURATION_DEVICE Auto
+set_global_assignment -name APEX20K_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name STRATIX_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name MERCURY_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name FLEX10K_CONFIG_DEVICE_JTAG_USER_CODE FFFFFFFF
+set_global_assignment -name EPROM_USE_CHECKSUM_AS_USERCODE Off
+set_global_assignment -name AUTO_INCREMENT_CONFIG_DEVICE_JTAG_USER_CODE On
+set_global_assignment -name DISABLE_NCS_AND_OE_PULLUPS_ON_CONFIG_DEVICE Off
+set_global_assignment -name GENERATE_TTF_FILE Off
+set_global_assignment -name GENERATE_RBF_FILE Off
+set_global_assignment -name GENERATE_HEX_FILE Off
+set_global_assignment -name HEXOUT_FILE_START_ADDRESS 0
+set_global_assignment -name HEXOUT_FILE_COUNT_DIRECTION Up
+set_global_assignment -name RESERVE_ALL_UNUSED_PINS_NO_OUTPUT_GND "As output driving an unspecified signal"
+set_global_assignment -name RELEASE_CLEARS_BEFORE_TRI_STATES Off
+set_global_assignment -name AUTO_RESTART_CONFIGURATION On
+set_global_assignment -name HARDCOPYII_POWER_ON_EXTRA_DELAY Off
+set_global_assignment -name STRATIXII_MRAM_COMPATIBILITY Off
+set_global_assignment -name CYCLONEII_M4K_COMPATIBILITY On
+set_global_assignment -name ENABLE_OCT_DONE Off
+set_global_assignment -name USE_CHECKERED_PATTERN_AS_UNINITIALIZED_RAM_CONTENT Off
+set_global_assignment -name START_TIME 0ns
+set_global_assignment -name SIMULATION_MODE TIMING
+set_global_assignment -name AUTO_USE_SIMULATION_PDB_NETLIST Off
+set_global_assignment -name ADD_DEFAULT_PINS_TO_SIMULATION_OUTPUT_WAVEFORMS On
+set_global_assignment -name SETUP_HOLD_DETECTION Off
+set_global_assignment -name SETUP_HOLD_DETECTION_INPUT_REGISTERS_BIDIR_PINS_DISABLED Off
+set_global_assignment -name CHECK_OUTPUTS Off
+set_global_assignment -name SIMULATION_COVERAGE On
+set_global_assignment -name SIMULATION_COMPLETE_COVERAGE_REPORT_PANEL On
+set_global_assignment -name SIMULATION_MISSING_1_VALUE_COVERAGE_REPORT_PANEL On
+set_global_assignment -name SIMULATION_MISSING_0_VALUE_COVERAGE_REPORT_PANEL On
+set_global_assignment -name GLITCH_DETECTION Off
+set_global_assignment -name GLITCH_INTERVAL 1ns
+set_global_assignment -name SIMULATOR_GENERATE_SIGNAL_ACTIVITY_FILE Off
+set_global_assignment -name SIMULATION_WITH_GLITCH_FILTERING_WHEN_GENERATING_SAF On
+set_global_assignment -name SIMULATION_BUS_CHANNEL_GROUPING Off
+set_global_assignment -name SIMULATION_VDB_RESULT_FLUSH On
+set_global_assignment -name VECTOR_COMPARE_TRIGGER_MODE INPUT_EDGE
+set_global_assignment -name SIMULATION_NETLIST_VIEWER Off
+set_global_assignment -name SIMULATION_INTERCONNECT_DELAY_MODEL_TYPE TRANSPORT
+set_global_assignment -name SIMULATION_CELL_DELAY_MODEL_TYPE TRANSPORT
+set_global_assignment -name SIMULATOR_GENERATE_POWERPLAY_VCD_FILE Off
+set_global_assignment -name SIMULATOR_PVT_TIMING_MODEL_TYPE AUTO
+set_global_assignment -name SIMULATION_WITH_AUTO_GLITCH_FILTERING AUTO
+set_global_assignment -name DRC_TOP_FANOUT 50
+set_global_assignment -name DRC_FANOUT_EXCEEDING 30
+set_global_assignment -name DRC_GATED_CLOCK_FEED 30
+set_global_assignment -name HARDCOPY_FLOW_AUTOMATION MIGRATION_ONLY
+set_global_assignment -name ENABLE_DRC_SETTINGS Off
+set_global_assignment -name CLK_RULE_CLKNET_CLKSPINES_THRESHOLD 25
+set_global_assignment -name DRC_DETAIL_MESSAGE_LIMIT 10
+set_global_assignment -name DRC_VIOLATION_MESSAGE_LIMIT 30
+set_global_assignment -name DRC_DEADLOCK_STATE_LIMIT 2
+set_global_assignment -name MERGE_HEX_FILE Off
+set_global_assignment -name GENERATE_SVF_FILE Off
+set_global_assignment -name GENERATE_ISC_FILE Off
+set_global_assignment -name GENERATE_JAM_FILE Off
+set_global_assignment -name GENERATE_JBC_FILE Off
+set_global_assignment -name GENERATE_JBC_FILE_COMPRESSED On
+set_global_assignment -name GENERATE_CONFIG_SVF_FILE Off
+set_global_assignment -name GENERATE_CONFIG_ISC_FILE Off
+set_global_assignment -name GENERATE_CONFIG_JAM_FILE Off
+set_global_assignment -name GENERATE_CONFIG_JBC_FILE Off
+set_global_assignment -name GENERATE_CONFIG_JBC_FILE_COMPRESSED On
+set_global_assignment -name GENERATE_CONFIG_HEXOUT_FILE Off
+set_global_assignment -name ISP_CLAMP_STATE_DEFAULT "Tri-state"
+set_global_assignment -name SIGNALPROBE_ALLOW_OVERUSE Off
+set_global_assignment -name SIGNALPROBE_DURING_NORMAL_COMPILATION Off
+set_global_assignment -name LOGICLOCK_INCREMENTAL_COMPILE_ASSIGNMENT Off
+set_global_assignment -name POWER_DEFAULT_TOGGLE_RATE 12.5%
+set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE 12.5%
+set_global_assignment -name POWER_USE_PVA On
+set_global_assignment -name POWER_USE_INPUT_FILE "No File"
+set_global_assignment -name POWER_USE_INPUT_FILES Off
+set_global_assignment -name POWER_VCD_FILTER_GLITCHES On
+set_global_assignment -name POWER_REPORT_SIGNAL_ACTIVITY -value OFF
+set_global_assignment -name POWER_REPORT_POWER_DISSIPATION -value OFF
+set_global_assignment -name POWER_USE_DEVICE_CHARACTERISTICS TYPICAL
+set_global_assignment -name POWER_AUTO_COMPUTE_TJ On
+set_global_assignment -name POWER_TJ_VALUE 25
+set_global_assignment -name POWER_USE_TA_VALUE 25
+set_global_assignment -name POWER_USE_CUSTOM_COOLING_SOLUTION Off
+set_global_assignment -name POWER_BOARD_TEMPERATURE 25
+set_global_assignment -name INCREMENTAL_COMPILATION FULL_INCREMENTAL_COMPILATION
+set_global_assignment -name AUTO_EXPORT_INCREMENTAL_COMPILATION Off
+set_global_assignment -name RTLV_REMOVE_FANOUT_FREE_REGISTERS On
+set_global_assignment -name RTLV_SIMPLIFIED_LOGIC On
+set_global_assignment -name RTLV_GROUP_RELATED_NODES On
+set_global_assignment -name RTLV_GROUP_COMB_LOGIC_IN_CLOUD Off
+set_global_assignment -name RTLV_GROUP_COMB_LOGIC_IN_CLOUD_TMV Off
+set_global_assignment -name RTLV_GROUP_RELATED_NODES_TMV On
+set_global_assignment -name EQC_CONSTANT_DFF_DETECTION On
+set_global_assignment -name EQC_DUPLICATE_DFF_DETECTION On
+set_global_assignment -name EQC_BBOX_MERGE On
+set_global_assignment -name EQC_LVDS_MERGE On
+set_global_assignment -name EQC_RAM_UNMERGING On
+set_global_assignment -name EQC_DFF_SS_EMULATION On
+set_global_assignment -name EQC_RAM_REGISTER_UNPACK On
+set_global_assignment -name EQC_MAC_REGISTER_UNPACK On
+set_global_assignment -name EQC_SET_PARTITION_BB_TO_VCC_GND On
+set_global_assignment -name EQC_STRUCTURE_MATCHING On
+set_global_assignment -name EQC_AUTO_BREAK_CONE On
+set_global_assignment -name EQC_POWER_UP_COMPARE Off
+set_global_assignment -name EQC_AUTO_COMP_LOOP_CUT On
+set_global_assignment -name EQC_AUTO_INVERSION On
+set_global_assignment -name EQC_AUTO_TERMINATE On
+set_global_assignment -name EQC_SUB_CONE_REPORT Off
+set_global_assignment -name EQC_RENAMING_RULES On
+set_global_assignment -name EQC_PARAMETER_CHECK On
+set_global_assignment -name EQC_AUTO_PORTSWAP On
+set_global_assignment -name EQC_DETECT_DONT_CARES On
+set_global_assignment -name EQC_SHOW_ALL_MAPPED_POINTS Off
+set_global_assignment -name DUTY_CYCLE 50 -section_id ?
+set_global_assignment -name INVERT_BASE_CLOCK Off -section_id ?
+set_global_assignment -name MULTIPLY_BASE_CLOCK_PERIOD_BY 1 -section_id ?
+set_global_assignment -name DIVIDE_BASE_CLOCK_PERIOD_BY 1 -section_id ?
+set_global_assignment -name EDA_INPUT_GND_NAME GND -section_id ?
+set_global_assignment -name EDA_INPUT_VCC_NAME VCC -section_id ?
+set_global_assignment -name EDA_INPUT_DATA_FORMAT NONE -section_id ?
+set_global_assignment -name EDA_SHOW_LMF_MAPPING_MESSAGES Off -section_id ?
+set_global_assignment -name EDA_RUN_TOOL_AUTOMATICALLY Off -section_id ?
+set_global_assignment -name RESYNTHESIS_RETIMING FULL -section_id ?
+set_global_assignment -name RESYNTHESIS_OPTIMIZATION_EFFORT Normal -section_id ?
+set_global_assignment -name RESYNTHESIS_PHYSICAL_SYNTHESIS Normal -section_id ?
+set_global_assignment -name USE_GENERATED_PHYSICAL_CONSTRAINTS On -section_id ?
+set_global_assignment -name VCCPD_VOLTAGE 3.3V -section_id ?
+set_global_assignment -name EDA_USER_COMPILED_SIMULATION_LIBRARY_DIRECTORY "" -section_id ?
+set_global_assignment -name EDA_LAUNCH_CMD_LINE_TOOL Off -section_id ?
+set_global_assignment -name EDA_NATIVELINK_GENERATE_SCRIPT_ONLY Off -section_id ?
+set_global_assignment -name EDA_WAIT_FOR_GUI_TOOL_COMPLETION Off -section_id ?
+set_global_assignment -name EDA_TRUNCATE_LONG_HIERARCHY_PATHS Off -section_id ?
+set_global_assignment -name EDA_FLATTEN_BUSES Off -section_id ?
+set_global_assignment -name EDA_MAP_ILLEGAL_CHARACTERS Off -section_id ?
+set_global_assignment -name EDA_GENERATE_TIMING_CLOSURE_DATA Off -section_id ?
+set_global_assignment -name EDA_GENERATE_POWER_INPUT_FILE Off -section_id ?
+set_global_assignment -name EDA_TEST_BENCH_ENABLE_STATUS NOT_USED -section_id ?
+set_global_assignment -name EDA_RTL_SIM_MODE NOT_USED -section_id ?
+set_global_assignment -name EDA_MAINTAIN_DESIGN_HIERARCHY Off -section_id ?
+set_global_assignment -name EDA_GENERATE_FUNCTIONAL_NETLIST Off -section_id ?
+set_global_assignment -name EDA_WRITE_DEVICE_CONTROL_PORTS Off -section_id ?
+set_global_assignment -name EDA_SIMULATION_VCD_OUTPUT_TCL_FILE Off -section_id ?
+set_global_assignment -name EDA_SIMULATION_VCD_OUTPUT_SIGNALS_TO_TCL_FILE "All Except Combinational Logic Element Outputs" -section_id ?
+set_global_assignment -name EDA_ENABLE_GLITCH_FILTERING Off -section_id ?
+set_global_assignment -name EDA_WRITE_NODES_FOR_POWER_ESTIMATION OFF -section_id ?
+set_global_assignment -name EDA_SETUP_HOLD_DETECTION_INPUT_REGISTERS_BIDIR_PINS_DISABLED Off -section_id ?
+set_global_assignment -name EDA_WRITER_DONT_WRITE_TOP_ENTITY Off -section_id ?
+set_global_assignment -name EDA_VHDL_ARCH_NAME structure -section_id ?
+set_global_assignment -name EDA_IBIS_MODEL_SELECTOR Off -section_id ?
+set_global_assignment -name EDA_IBIS_MUTUAL_COUPLING Off -section_id ?
+set_global_assignment -name EDA_FORMAL_VERIFICATION_ALLOW_RETIMING Off -section_id ?
+set_global_assignment -name EDA_BOARD_BOUNDARY_SCAN_OPERATION PRE_CONFIG -section_id ?
+set_global_assignment -name EDA_GENERATE_RTL_SIMULATION_COMMAND_SCRIPT Off -section_id ?
+set_global_assignment -name EDA_GENERATE_GATE_LEVEL_SIMULATION_COMMAND_SCRIPT Off -section_id ?
+set_global_assignment -name SIM_VECTOR_COMPARED_CLOCK_OFFSET 0ns -section_id ?
+set_global_assignment -name SIM_VECTOR_COMPARED_CLOCK_DUTY_CYCLE 50 -section_id ?
+set_global_assignment -name APEX20K_CLIQUE_TYPE LAB -section_id ? -entity ?
+set_global_assignment -name MAX7K_CLIQUE_TYPE LAB -section_id ? -entity ?
+set_global_assignment -name MERCURY_CLIQUE_TYPE LAB -section_id ? -entity ?
+set_global_assignment -name FLEX6K_CLIQUE_TYPE LAB -section_id ? -entity ?
+set_global_assignment -name FLEX10K_CLIQUE_TYPE LAB -section_id ? -entity ?
+set_global_assignment -name PARTITION_PRESERVE_HIGH_SPEED_TILES On -section_id ? -entity ?
+set_global_assignment -name PARTITION_IGNORE_SOURCE_FILE_CHANGES Off -section_id ? -entity ?
+set_global_assignment -name PARTITION_ALWAYS_USE_QXP_NETLIST Off -section_id ? -entity ?
+set_global_assignment -name PARTITION_IMPORT_ASSIGNMENTS On -section_id ? -entity ?
+set_global_assignment -name PARTITION_IMPORT_EXISTING_ASSIGNMENTS REPLACE_CONFLICTING -section_id ? -entity ?
+set_global_assignment -name PARTITION_IMPORT_EXISTING_LOGICLOCK_REGIONS REPLACE_CONFLICTING -section_id ? -entity ?
+set_global_assignment -name PARTITION_IMPORT_PROMOTE_ASSIGNMENTS On -section_id ? -entity ?
Index: DE2/async_transmitter_altera.v
===================================================================
--- DE2/async_transmitter_altera.v (nonexistent)
+++ DE2/async_transmitter_altera.v (revision 4)
@@ -0,0 +1,57 @@
+module async_transmitter(clk, TxD_start, TxD_data, TxD, TxD_busy);
+input clk, TxD_start;
+input [7:0] TxD_data;
+output TxD, TxD_busy;
+
+parameter ClkFrequency = 50000000; // 50MHz
+//parameter ClkFrequency = 27000000; // 27MHz
+parameter Baud = 115200;
+
+// Baud generator
+parameter BaudGeneratorAccWidth = 16;
+parameter BaudGeneratorInc = ((Baud<<(BaudGeneratorAccWidth-4))+(ClkFrequency>>5))/(ClkFrequency>>4);
+reg [BaudGeneratorAccWidth:0] BaudGeneratorAcc;
+wire BaudTick = BaudGeneratorAcc[BaudGeneratorAccWidth];
+wire TxD_busy;
+always @(posedge clk) if(TxD_busy) BaudGeneratorAcc <= BaudGeneratorAcc[BaudGeneratorAccWidth-1:0] + BaudGeneratorInc;
+
+// Transmitter state machine
+reg [3:0] state;
+assign TxD_busy = (state!=0);
+
+always @(posedge clk)
+case(state)
+ 4'b0000: if(TxD_start) state <= 4'b0100;
+ 4'b0100: if(BaudTick) state <= 4'b1000; // start
+ 4'b1000: if(BaudTick) state <= 4'b1001; // bit 0
+ 4'b1001: if(BaudTick) state <= 4'b1010; // bit 1
+ 4'b1010: if(BaudTick) state <= 4'b1011; // bit 2
+ 4'b1011: if(BaudTick) state <= 4'b1100; // bit 3
+ 4'b1100: if(BaudTick) state <= 4'b1101; // bit 4
+ 4'b1101: if(BaudTick) state <= 4'b1110; // bit 5
+ 4'b1110: if(BaudTick) state <= 4'b1111; // bit 6
+ 4'b1111: if(BaudTick) state <= 4'b0001; // bit 7
+ 4'b0001: if(BaudTick) state <= 4'b0010; // stop1
+ 4'b0010: if(BaudTick) state <= 4'b0000; // stop2
+ default: if(BaudTick) state <= 4'b0000;
+endcase
+
+// Output mux
+reg muxbit;
+always @(state[2:0] or TxD_data)
+case(state[2:0])
+ 0: muxbit <= TxD_data[0];
+ 1: muxbit <= TxD_data[1];
+ 2: muxbit <= TxD_data[2];
+ 3: muxbit <= TxD_data[3];
+ 4: muxbit <= TxD_data[4];
+ 5: muxbit <= TxD_data[5];
+ 6: muxbit <= TxD_data[6];
+ 7: muxbit <= TxD_data[7];
+endcase
+
+// Put together the start, data and stop bits
+reg TxD;
+always @(posedge clk) TxD <= (state<4) | (state[3] & muxbit); // register the output to make it glitch free
+
+endmodule
DE2/async_transmitter_altera.v
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/LCD_Controller_safe.v
===================================================================
--- DE2/LCD_Controller_safe.v (nonexistent)
+++ DE2/LCD_Controller_safe.v (revision 4)
@@ -0,0 +1,82 @@
+module LCD_Controller ( // Host Side
+ iDATA,iRS,
+ iStart,oDone,
+ iCLK,iRST_N,
+ // LCD Interface
+ LCD_DATA,
+ LCD_RW,
+ LCD_EN,
+ LCD_RS );
+// CLK
+parameter CLK_Divide = 16;
+
+// Host Side
+input [7:0] iDATA;
+input iRS,iStart;
+input iCLK,iRST_N;
+output reg oDone;
+// LCD Interface
+output [7:0] LCD_DATA;
+output reg LCD_EN;
+output LCD_RW;
+output LCD_RS;
+// Internal Register
+reg [4:0] Cont;
+reg [1:0] ST;
+reg preStart,mStart;
+
+/////////////////////////////////////////////
+// Only write to LCD, bypass iRS to LCD_RS
+assign LCD_DATA = iDATA;
+assign LCD_RW = 1'b0;
+assign LCD_RS = iRS;
+/////////////////////////////////////////////
+
+always@(posedge iCLK or negedge iRST_N)
+begin
+ if(!iRST_N)
+ begin
+ oDone <= 1'b0;
+ LCD_EN <= 1'b0;
+ preStart<= 1'b0;
+ mStart <= 1'b0;
+ Cont <= 0;
+ ST <= 0;
+ end
+ else
+ begin
+ ////// Input Start Detect ///////
+ preStart<= iStart;
+ if({preStart,iStart}==2'b01)
+ begin
+ mStart <= 1'b1;
+ oDone <= 1'b0;
+ end
+ //////////////////////////////////
+ if(mStart)
+ begin
+ case(ST)
+ 0: ST <= 1; // Wait Setup
+ 1: begin
+ LCD_EN <= 1'b1;
+ ST <= 2;
+ end
+ 2: begin
+ if(Cont /dev/ttyS0
+#echo -n -e '\x61\x5B\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## SETUP SRAM SRAM SRAM OUTSEL
+#echo -n -e '\x61\xA5\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## WRITE SRAM NORMAL
+#echo -n -e '\x83\xA5\x00\x00\x00\x38\x41\xAA' > /dev/ttyS0
+## SETUP SRAM SRAM SRAM OUTSEL
+#echo -n -e '\x61\x4C\x12\x34\x56\xA5\xA5\x33' > /dev/ttyS0
+## SETUP SRAM SRAM SRAM OUTSEL
+#echo -n -e '\x61\xA5\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## SRAM
+#echo -n -e '\x94\xA5\x00\x00\x00\x00\x00\xAA' > /dev/ttyS0
+## READ SRAM NORMAL
+#echo -n -e '\x94\xA5\x00\x00\x00\x00\x00\xAA' > /dev/ttyS0
+#
+# SDRSEL
+#echo -n -e '\x61\x1F\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## SETUP SDRAM OUTSEL
+#echo -n -e '\x61\xB4\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## WRITE SDRAM NORMAL
+#echo -n -e '\x83\xB4\x00\x00\x21\x45\x39\xAA' > /dev/ttyS0
+## SETUP SET_REG SRAM SRAM OUTSEL
+#echo -n -e '\x61\x4C\x12\x34\x56\xB4\xB4\x33' > /dev/ttyS0
+## SETUP SDRAM SDRAM OUTSEL
+#echo -n -e '\x61\xB4\x12\x34\x56\x00\x00\x33' > /dev/ttyS0
+## READ SDRAM
+#echo -n -e '\x94\xB4\x00\x00\x21\x00\x00\xAA' > /dev/ttyS0
DE2/setup.sh
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: DE2/AI.vhd
===================================================================
--- DE2/AI.vhd (nonexistent)
+++ DE2/AI.vhd (revision 4)
@@ -0,0 +1,144 @@
+library ieee;
+use ieee.std_logic_1164.all;
+USE ieee.std_logic_arith.ALL;
+
+
+
+entity AI is
+ port(
+ iAI_start:in std_logic;
+ iAI_DATA: in std_logic_vector(63 downto 0);
+ iCOLOR:in std_logic_vector(7 downto 0);
+ imovecount:in std_logic_vector(16 downto 0);
+ oAI_Done: out std_logic;
+ oAI_DATA: out std_logic_vector(63 downto 0);
+ iCLK: in std_logic;
+ iRST_n:in std_logic
+
+ );
+end entity AI;
+
+
+architecture c_to_g of AI is
+
+component connect6ai_synth_tcab is
+ port(
+ clk: in std_logic;
+ reset:in std_logic;
+ stallbar_out:out std_logic;
+ rawdataout_pico_ret_connect6ai_synth_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_0_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_1_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_2_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_3_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_4_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_5_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_6_0_outenable:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_7_0_outenable:out std_logic;
+ start:in std_logic;
+ rawdatain_pico_connect6ai_synth_firstmove_in_0_0:in std_logic_vector(16 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_0_in_1_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_1_in_2_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_2_in_3_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_3_in_4_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_4_in_5_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_5_in_6_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_6_in_7_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_movein_7_in_8_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_colour_in_9_0:in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_0_in_10_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_1_in_11_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_2_in_12_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_3_in_13_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_4_in_14_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_5_in_15_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_6_in_16_0: in std_logic_vector(7 downto 0);
+ rawdatain_pico_connect6ai_synth_moveout_7_in_17_0: in std_logic_vector(7 downto 0);
+ rawdataout_pico_ret_connect6ai_synth_0:out std_logic;
+ rawdataout_pico_connect6ai_synth_moveout_out_0_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_1_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_2_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_3_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_4_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_5_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_6_0: out std_logic_vector(7 downto 0);
+ rawdataout_pico_connect6ai_synth_moveout_out_7_0: out std_logic_vector(7 downto 0)
+
+ );
+end component connect6ai_synth_tcab;
+signal out_enables:std_logic_vector(7 downto 0);
+signal out_enables_reg:std_logic_vector(7 downto 0);
+signal AI_DATA,mAI_DATA: std_logic_vector(63 downto 0);
+begin
+oAI_DATA<=AI_DATA;
+inst_ai:connect6ai_synth_tcab
+ port map(
+
+ clk=>iCLK,
+ reset=>not(iRST_n),
+ stallbar_out=>open,
+ rawdataout_pico_ret_connect6ai_synth_0_outenable=>open,
+ rawdataout_pico_connect6ai_synth_moveout_out_0_0_outenable=>out_enables(0),
+ rawdataout_pico_connect6ai_synth_moveout_out_1_0_outenable=>out_enables(1),
+ rawdataout_pico_connect6ai_synth_moveout_out_2_0_outenable=>out_enables(2),
+ rawdataout_pico_connect6ai_synth_moveout_out_3_0_outenable=>out_enables(3),
+ rawdataout_pico_connect6ai_synth_moveout_out_4_0_outenable=>out_enables(4),
+ rawdataout_pico_connect6ai_synth_moveout_out_5_0_outenable=>out_enables(5),
+ rawdataout_pico_connect6ai_synth_moveout_out_6_0_outenable=>out_enables(6),
+ rawdataout_pico_connect6ai_synth_moveout_out_7_0_outenable=>out_enables(7),
+ start=>iAI_start,
+ rawdatain_pico_connect6ai_synth_firstmove_in_0_0=>imovecount,
+ rawdatain_pico_connect6ai_synth_movein_0_in_1_0=>iAI_DATA(31 downto 24),
+ rawdatain_pico_connect6ai_synth_movein_1_in_2_0=>iAI_DATA(23 downto 16),
+ rawdatain_pico_connect6ai_synth_movein_2_in_3_0=>iAI_DATA(15 downto 8),
+ rawdatain_pico_connect6ai_synth_movein_3_in_4_0=>iAI_DATA(7 downto 0),
+ rawdatain_pico_connect6ai_synth_movein_4_in_5_0=>iAI_DATA(63 downto 56),
+ rawdatain_pico_connect6ai_synth_movein_5_in_6_0=>iAI_DATA(55 downto 48),
+ rawdatain_pico_connect6ai_synth_movein_6_in_7_0=>iAI_DATA(47 downto 40),
+ rawdatain_pico_connect6ai_synth_movein_7_in_8_0=>iAI_DATA(39 downto 32),
+ rawdatain_pico_connect6ai_synth_colour_in_9_0=>icolor,
+ rawdatain_pico_connect6ai_synth_moveout_0_in_10_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_1_in_11_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_2_in_12_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_3_in_13_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_4_in_14_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_5_in_15_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_6_in_16_0=> to_stdlogicvector(x"00"),
+ rawdatain_pico_connect6ai_synth_moveout_7_in_17_0=> to_stdlogicvector(x"00"),
+ rawdataout_pico_ret_connect6ai_synth_0=>open,
+ rawdataout_pico_connect6ai_synth_moveout_out_0_0=> mAI_DATA(63 downto 56),
+ rawdataout_pico_connect6ai_synth_moveout_out_1_0=> mAI_DATA(55 downto 48),
+ rawdataout_pico_connect6ai_synth_moveout_out_2_0=> mAI_DATA(47 downto 40),
+ rawdataout_pico_connect6ai_synth_moveout_out_3_0=> mAI_DATA(39 downto 32),
+ rawdataout_pico_connect6ai_synth_moveout_out_4_0=> mAI_DATA(31 downto 24),
+ rawdataout_pico_connect6ai_synth_moveout_out_5_0=> mAI_DATA(23 downto 16),
+ rawdataout_pico_connect6ai_synth_moveout_out_6_0=> mAI_DATA(15 downto 8),
+ rawdataout_pico_connect6ai_synth_moveout_out_7_0=> mAI_DATA(7 downto 0)
+ );
+
+process(iCLK)
+begin
+ if rising_edge(iCLK) then
+ if(iAI_start='1') then
+ out_enables_reg<="00000000";
+ for i in 0 to 7 loop
+ AI_DATA( 63-8*i downto 56-8*i)<="00000000";
+ end loop;
+ else
+ for i in 0 to 7 loop
+ if(out_enables(i)='1') then
+ out_enables_reg(i)<=out_enables(i);
+ AI_DATA( 63-8*i downto 56-8*i)<=mAI_DATA(63-8*i downto 56-8*i);
+ else
+ out_enables_reg(i)<=out_enables_reg(i);
+ AI_DATA( 63-8*i downto 56-8*i)<=AI_DATA(63-8*i downto 56-8*i);
+ end if;
+ end loop;
+ end if;
+ end if;
+end process;
+ oAI_Done<= out_enables_reg(0) and out_enables_reg(1) and out_enables_reg(2) and out_enables_reg(3) and
+ out_enables_reg(4) and out_enables_reg(5) and out_enables_reg(6) and out_enables_reg(7);
+
+ --oAI_Done<= out_enables(0) and out_enables(1) and out_enables(2) and out_enables(3);
+end architecture c_to_g;
Index: DE2/Makefile
===================================================================
--- DE2/Makefile (nonexistent)
+++ DE2/Makefile (revision 4)
@@ -0,0 +1,18 @@
+all:
+ quartus_map DE2_USB_API.qpf
+ quartus_fit DE2_USB_API.qpf
+ quartus_asm DE2_USB_API.qpf
+ quartus_pgm -c USB-Blaster -m jtag -o "p;DE2_USB_API.sof"
+test:
+ ./setup.sh
+ ../../FPT2011_AI_TERMINAL/connect6 -port /dev/ttyS0 -player D
+
+pgm:
+ quartus_pgm -c USB-Blaster -m jtag -o "p;DE2_USB_API.sof"
+
+sim:
+ vcom S_TO_AS.vhd
+ vcom S_TO_AS_CONFIG.vhd
+ vcom testbench.vhd
+clean:
+ rm -rf db *.msg *.smsg *.summary *.done *.rpt *.pof *.sof transcript incremental_db simulation
Index: DE2/DE2.v
===================================================================
--- DE2/DE2.v (nonexistent)
+++ DE2/DE2.v (revision 4)
@@ -0,0 +1,119 @@
+
+module DE2
+ (
+ //////////////////// Clock Input ////////////////////
+ OSC_27, // 27 MHz
+ OSC_50, // 50 MHz
+ EXT_CLOCK, // External Clock
+ //////////////////// Push Button ////////////////////
+ KEY, // Button[3:0]
+ //////////////////// DPDT Switch ////////////////////
+ DPDT_SW, // DPDT Switch[17:0]
+ //////////////////// 7-SEG Dispaly ////////////////////
+ HEX0, // Seven Segment Digital 0
+ HEX1, // Seven Segment Digital 1
+ HEX2, // Seven Segment Digital 2
+ HEX3, // Seven Segment Digital 3
+ HEX4, // Seven Segment Digital 4
+ HEX5, // Seven Segment Digital 5
+ HEX6, // Seven Segment Digital 6
+ HEX7, // Seven Segment Digital 7
+ //////////////////////// LED ////////////////////////
+ LED_GREEN, // LED Green[8:0]
+ LED_RED, // LED Red[17:0]
+ //////////////////////// UART ////////////////////////
+ UART_TXD, // UART Transmitter
+ UART_RXD, // UART Rceiver
+ TD_RESET
+
+ );
+
+//////////////////////// Clock Input ////////////////////////
+input OSC_27; // 27 MHz
+input OSC_50; // 50 MHz
+input EXT_CLOCK; // External Clock
+//////////////////////// Push Button ////////////////////////
+input [3:0] KEY; // Button[3:0]
+//////////////////////// DPDT Switch ////////////////////////
+input [17:0] DPDT_SW; // DPDT Switch[17:0]
+//////////////////////// 7-SEG Dispaly ////////////////////////
+output [6:0] HEX0; // Seven Segment Digital 0
+output [6:0] HEX1; // Seven Segment Digital 1
+output [6:0] HEX2; // Seven Segment Digital 2
+output [6:0] HEX3; // Seven Segment Digital 3
+output [6:0] HEX4; // Seven Segment Digital 4
+output [6:0] HEX5; // Seven Segment Digital 5
+output [6:0] HEX6; // Seven Segment Digital 6
+output [6:0] HEX7; // Seven Segment Digital 7
+//////////////////////////// LED ////////////////////////////
+output [8:0] LED_GREEN; // LED Green[8:0]
+output [17:0] LED_RED; // LED Red[17:0]
+//////////////////////////// UART ////////////////////////////
+output UART_TXD; // UART Transmitter
+input UART_RXD; // UART Rceiver
+output TD_RESET;
+// USB JTAG
+wire [7:0] mRXD_DATA,mTXD_DATA;
+wire mRXD_Ready,mTXD_Done,mTXD_Start;
+wire mTCK;
+// SEG7
+wire [31:0] mSEG7_DIG;
+// AI
+wire [63:0] DATA_from_AI,DATA_to_AI;
+wire mAI_Start,mAI_Done;
+wire [7:0] mCOLOR;
+
+assign TD_RESET = 1'b1;
+
+
+
+
+SEG7_LUT_8 u0 ( HEX0,HEX1,HEX2,HEX3,HEX4,HEX5,HEX6,HEX7,mSEG7_DIG );
+
+wire mTXD_Done_not;
+RS232_Controller u1_bis( .iDATA(mTXD_DATA),.iTxD_Start(mTXD_Start),.oTxD_Busy(mTXD_Done_not),
+ .oDATA(mRXD_DATA),.oRxD_Ready(mRXD_Ready),.iCLK(OSC_50),.RST_n(KEY[0]),
+ .oTxD(UART_TXD),.iRxD(UART_RXD));
+assign mTXD_Done = !mTXD_Done_not;
+assign LED_RED[9] = mTXD_Done_not;
+assign LED_RED[10] = ~mAI_Done;
+
+
+
+assign UART_RXD_JP1_7 = UART_RXD;
+assign UART_TXD_JP1_50 = UART_TXD;
+
+
+CMD_Decode u5 ( // USB JTAG
+ .iRXD_DATA(mRXD_DATA),.iRXD_Ready(mRXD_Ready),
+ .oTXD_DATA(mTXD_DATA),.oTXD_Start(mTXD_Start),.iTXD_Done(mTXD_Done),
+ // Control
+ .iCLK(OSC_50),.iRST_n(KEY[0]), .oAI_RSTn(mAI_RSTn),
+ //AI
+ .oAI_DATA(DATA_to_AI),
+ .iAI_DATA(DATA_from_AI),
+ .oAI_Start(mAI_Start),
+ .iAI_Done(mAI_Done),.oCOLOR(mCOLOR),.d_cmd(CMD_Tmp[16:0]) );
+AI inst_AI (
+ .oAI_DATA(DATA_from_AI),
+ .iAI_DATA(DATA_to_AI),
+ .iCOLOR(mCOLOR),
+ .imovecount(CMD_Tmp[16:0]),
+ .iAI_Start(mAI_Start),
+ .oAI_Done(mAI_Done),
+
+ // Control
+ .iCLK(OSC_50),.iRST_n(mAI_RSTn) );
+wire [63:0] CMD_Tmp;
+
+//assign mSEG7_DIG = { CMD_Tmp[31:28],CMD_Tmp[27:24],CMD_Tmp[23:20],CMD_Tmp[19:16],
+// CMD_Tmp[15:12],CMD_Tmp[11:8],CMD_Tmp[7:4],CMD_Tmp[3:0] };
+assign mSEG7_DIG = {
+ DATA_to_AI[63:60],DATA_to_AI[59:56],DATA_to_AI[55:52],DATA_to_AI[51:48],
+ DATA_to_AI[47:44],DATA_to_AI[43:40],DATA_to_AI[39:36],DATA_to_AI[35:32] }
+// DATA_from_AI[31:28],DATA_from_AI[27:24],DATA_from_AI[23:20],DATA_from_AI[19:16],
+// DATA_from_AI[15:12],DATA_from_AI[11:8],DATA_from_AI[7:4],DATA_from_AI[3:0] }
+ ;
+
+
+endmodule
Index: synth_src/connect6.cpp
===================================================================
--- synth_src/connect6.cpp (nonexistent)
+++ synth_src/connect6.cpp (revision 4)
@@ -0,0 +1,458 @@
+/*
+ connect6.cpp
+ June 9, 2011
+ This file contains the game AI
+ By Kevin Nam
+
+*/
+
+#include
+#include
+
+#include "util.h"
+#include "connect6.h"
+
+// Subtract this many points for moves at the edges.
+#define EDGEPENALTY 5
+
+using namespace std;
+
+/* The cost function simply counts all of the consecutive stones of same colour in
+ every direction from the spot for which the points is being calculated.
+
+ Ex:
+
+ .DDLL
+ .DLDD
+ DXDDD
+ ...D.
+
+ Above, X is the spot being calculated.
+ The points would be 2 (above) + 2(topright) + 3(right) + 1 (left) = 8.
+ It treats opponent's stones and own stones with equal weighting.
+
+ Return 0 if the spot y,x is already taken, else return the calculated value
+
+*/
+int calculatepoints(char board[][19], int y, int x, char colour){
+ int pts = 0, tempx = x, tempy = y, tcount = 0,bcount = 0;
+ int lcount = 0,rcount = 0,trcount = 0,tlcount = 0,brcount = 0,blcount = 0;
+ char tcolour = 0,bcolour = 0,lcolour = 0,rcolour = 0,tlcolour = 0,trcolour = 0,brcolour = 0,blcolour = 0;
+
+ if (board[y][x] != 0)
+ return 0;
+
+ // scan column above
+ if (y > 0){
+ tempy = y-1;
+ tempx = x;
+ tcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != tcolour || board[tempy][tempx] == 0) break;
+ tcount++;
+ if (tempy == 0) break;
+ tempy--;
+ }
+ }
+ // scan column below
+ if (y < 18){
+ tempy = y+1;
+ tempx = x;
+ bcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != bcolour || board[tempy][tempx] == 0) break;
+ bcount++;
+ if (tempy == 18) break;
+ tempy++;
+ }
+ }
+ // scan row to left
+ if (x > 0){
+ tempy = y;
+ tempx = x-1;
+ lcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != lcolour || board[tempy][tempx] == 0) break;
+ lcount++;
+ if (tempx == 0) break;
+ tempx--;
+ }
+ }
+ // scan row to right
+ if (x < 18){
+ tempy = y;
+ tempx = x+1;
+ rcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != rcolour || board[tempy][tempx] == 0) break;
+ rcount++;
+ if (tempx == 18) break;
+ tempx++;
+ }
+ }
+ // scan diagonal topleft
+ if (x > 0 && y > 0){
+ tempy = y-1;
+ tempx = x-1;
+ tlcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != tlcolour || board[tempy][tempx] == 0) break;
+ tlcount++;
+ if (tempx == 0 || tempy == 0) break;
+ tempx--;
+ tempy--;
+ }
+ }
+ // scan diagonal bottomright
+ if (x < 18 && y < 18){
+ tempy = y+1;
+ tempx = x+1;
+ brcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != brcolour || board[tempy][tempx] == 0) break;
+ brcount++;
+ if (tempx == 18 || tempy == 18) break;
+ tempx++;
+ tempy++;
+ }
+ }
+ // scan diagonal topright
+ if (x < 18 && y > 0){
+ tempy = y-1;
+ tempx = x+1;
+ trcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != trcolour || board[tempy][tempx] == 0) break;
+ trcount++;
+ if (tempx == 18 || tempy == 0) break;
+ tempx++;
+ tempy--;
+ }
+ }
+ // scan diagonal bottomleft
+ if (y < 18 && x > 0){
+ tempy = y+1;
+ tempx = x-1;
+ blcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != blcolour || board[tempy][tempx] == 0) break;
+ blcount++;
+ if (tempy == 18 || tempx == 0) break;
+ tempy++;
+ tempx--;
+ }
+ }
+
+ /// Now calculate the points
+ // Check if this is a winning move. Priority #1.
+ if ((tcount >= 5 && tcolour == colour) ||
+ (bcount >= 5 && bcolour == colour) ||
+ (lcount >= 5 && lcolour == colour) ||
+ (rcount >= 5 && rcolour == colour) ||
+ (tlcount >= 5 && tlcolour == colour) ||
+ (trcount >= 5 && trcolour == colour) ||
+ (brcount >= 5 && brcolour == colour) ||
+ (blcount >= 5 && blcolour == colour) ||
+ (tcount + bcount >= 5 && tcolour == colour && bcolour == colour) ||
+ (lcount + rcount >= 5 && lcolour == colour && rcolour == colour) ||
+ (tlcount + brcount >= 5 && tlcolour == colour && brcolour == colour) ||
+ (trcount + blcount >= 5 && trcolour == colour && blcolour == colour))
+ return 1000;
+
+ // Check if this move can stop opponent from winning. This move is priority #2.
+ if ((tcount >= 4 && tcolour != colour) ||
+ (bcount >= 4 && bcolour != colour) ||
+ (lcount >= 4 && lcolour != colour) ||
+ (rcount >= 4 && rcolour != colour) ||
+ (tlcount >= 4 && tlcolour != colour) ||
+ (trcount >= 4 && trcolour != colour) ||
+ (brcount >= 4 && brcolour != colour) ||
+ (blcount >= 4 && blcolour != colour) ||
+ (tcount + bcount >= 4 && tcolour != colour && bcolour != colour) ||
+ (lcount + rcount >= 4 && lcolour != colour && rcolour != colour) ||
+ (tlcount + brcount >= 4 && tlcolour != colour && brcolour != colour) ||
+ (trcount + blcount >= 4 && trcolour != colour && blcolour != colour))
+ return 500;
+
+ // Else sum up the counts, use this as the points.
+ pts = tcount + bcount + lcount + rcount + tlcount + trcount + blcount + brcount + 1;
+ // If at an edge, lower the points
+ if (x == 0 || x == 18 || y == 0 || y == 18){
+ if (pts >= EDGEPENALTY)
+ pts -= EDGEPENALTY;
+ else
+ pts = 0;
+ }
+ return pts;
+}
+
+/*
+ The AI Function that calls the cost function for every spot on the board.
+ It returns the location with the highest points. In the event of a tie, randomly decide.
+ Input the board and the colour being played.
+ Puts the move (in ASCII chars) inside move[4]. This is from [1 ... 19]
+ Puts the move (in integers) in moveY and moveX. This is from [0 ... 18]
+*/
+int connect6ai(char board[][19], char colour, char move[4]){
+ int x,y,highx = 0, highy = 0,currenthigh = 0, temp;
+ srand(time(NULL));
+ int highRandom =1;//rand();
+ // Sweep the entire board with the cost function
+ for (x = 0; x <= 18; x++){
+ for (y = 0; y <= 18; y++){
+
+ temp = calculatepoints(board,y,x, colour);
+ if (temp > currenthigh){
+ highx = x;
+ highy = y;
+ currenthigh = temp;
+ highRandom = 1;//rand();
+ }
+ // If a tie happens, pseudo-randomly choose one between them
+ if (temp == currenthigh && temp != 0){
+ int tempRandom =1;//rand();
+ if (tempRandom > highRandom){
+ highx = x;
+ highy = y;
+ highRandom = tempRandom;
+ }
+ }
+ }
+ }
+
+ // Modify the board based on current move.
+ board[highy][highx] = colour;
+
+ // Increment by 1 because indexing starts at 1.
+ highy++;
+ highx++;
+
+ /// Convert the int coordinates to corresponding ASCII chars
+ if (highy >= 10){
+ move[0] = '1';
+ highy -= 10;
+ } else {
+ move[0] = '0';
+ }
+ if (highy == 0) move[1] = '0';
+ else if (highy == 1) move[1] = '1';
+ else if (highy == 2) move[1] = '2';
+ else if (highy == 3) move[1] = '3';
+ else if (highy == 4) move[1] = '4';
+ else if (highy == 5) move[1] = '5';
+ else if (highy == 6) move[1] = '6';
+ else if (highy == 7) move[1] = '7';
+ else if (highy == 8) move[1] = '8';
+ else if (highy == 9) move[1] = '9';
+
+ // Do same for x.
+ if (highx >= 10){
+ move[2] = '1';
+ highx -= 10;
+ } else {
+ move[2] = '0';
+ }
+ if (highx == 0) move[3] = '0';
+ else if (highx == 1) move[3] = '1';
+ else if (highx == 2) move[3] = '2';
+ else if (highx == 3) move[3] = '3';
+ else if (highx == 4) move[3] = '4';
+ else if (highx == 5) move[3] = '5';
+ else if (highx == 6) move[3] = '6';
+ else if (highx == 7) move[3] = '7';
+ else if (highx == 8) move[3] = '8';
+ else if (highx == 9) move[3] = '9';
+
+ return 0;
+}
+
+
+// scan board, return 'L' or 'D' for the winner, 'n' if no winner.
+char check_for_win (char board[][19]){
+ int y,x;
+ for (y = 0; y < 19; y++){
+ for (x = 0; x < 19; x++){
+ if (board[y][x] == 0)
+ continue;
+
+ int tempx, tempy, tcount = 0,bcount = 0;
+ int lcount = 0,rcount = 0,trcount = 0,tlcount = 0,brcount = 0,blcount = 0;
+ char tcolour = 0,bcolour = 0,lcolour = 0,rcolour = 0,tlcolour = 0,trcolour = 0,brcolour = 0,blcolour = 0;
+
+ // scan column above
+ if (y > 0){
+ tempy = y;
+ tempx = x;
+ tcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != tcolour || board[tempy][tempx] == 0) break;
+ tcount++;
+ if (tempy == 0) break;
+ tempy--;
+ }
+ }
+ // scan column below
+ if (y < 18){
+ tempy = y+1;
+ tempx = x;
+ bcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != bcolour || board[tempy][tempx] == 0) break;
+ bcount++;
+ if (tempy == 18) break;
+ tempy++;
+ }
+ }
+
+ if (tcolour == bcolour && tcount + bcount >= 6) return tcolour;
+
+ // scan row to left
+ if (x > 0){
+ tempy = y;
+ tempx = x;
+ lcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != lcolour || board[tempy][tempx] == 0) break;
+ lcount++;
+ if (tempx == 0) break;
+ tempx--;
+ }
+ }
+ // scan row to right
+ if (x < 18){
+ tempy = y;
+ tempx = x+1;
+ rcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != rcolour || board[tempy][tempx] == 0) break;
+ rcount++;
+ if (tempx == 18) break;
+ tempx++;
+ }
+ }
+
+ if (lcolour == rcolour && lcount + rcount >= 6) return lcolour;
+
+ // scan diagonal topleft
+ if (x > 0 && y > 0){
+ tempy = y;
+ tempx = x;
+ tlcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != tlcolour || board[tempy][tempx] == 0) break;
+ tlcount++;
+ if (tempx == 0 || tempy == 0) break;
+ tempx--;
+ tempy--;
+ }
+ }
+ // scan diagonal bottomright
+ if (x < 18 && y < 18){
+ tempy = y+1;
+ tempx = x+1;
+ brcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != brcolour || board[tempy][tempx] == 0) break;
+ brcount++;
+ if (tempx == 18 || tempy == 18) break;
+ tempx++;
+ tempy++;
+ }
+ }
+
+ if (tlcolour == brcolour && tlcount + brcount >= 6) return tlcolour;
+
+ // scan diagonal topright
+ if (x < 18 && y > 0){
+ tempy = y;
+ tempx = x;
+ trcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != trcolour || board[tempy][tempx] == 0) break;
+ trcount++;
+ if (tempx == 18 || tempy == 0) break;
+ tempx++;
+ tempy--;
+ }
+ }
+ // scan diagonal bottomleft
+ if (y < 18 && x > 0){
+ tempy = y+1;
+ tempx = x-1;
+ blcolour = board[tempy][tempx];
+ while (1){
+ if (board[tempy][tempx] != blcolour || board[tempy][tempx] == 0) break;
+ blcount++;
+ if (tempy == 18 || tempx == 0) break;
+ tempy++;
+ tempx--;
+ }
+ }
+
+ if (trcolour == blcolour && trcount + blcount >= 6) return trcolour;
+ }
+ }
+ // return 'n' for no victory
+ return 'n';
+}
+
+// Check if the board is full
+int check_board_full (char board[][19]){
+ int y,x;
+ // As soon as there is an empty intersection, return 0;
+ for (y = 0; y < 19; y++)
+ for (x = 0; x < 19; x++)
+ if (board[y][x] == 0)
+ return 0;
+
+ // By now, swept entire board and all filled.
+ return -1;
+}
+
+// Check if move y,x is valid. Here, y and x are [0 ... 18]
+int check_move_validity (char board[][19],int y, int x){
+ if (y < 0 || y > 18 || x < 0 || x > 18 || board[y][x] != 0){
+ return -1;
+ }
+ return 0;
+}
+
+
+void print_board (char board[][19]){
+ printf(" 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9");
+ unsigned short x,y;
+ for (x = 0; x <= 18; x++){
+ printf("\n");
+ printf("%d",x+1);
+ if (x < 9) printf(" ");
+ for (y = 0; y <= 18; y++){
+ if (board[x][y] == 0)
+ printf(".");
+ else printf("%c",board[x][y]);
+ printf(" ");
+ }
+
+ }
+ printf("\n");
+}
+
+void print_board_file (char board[][19]){
+char filename[12]="myboard.txt";
+FILE *fp=fopen(filename,"w");
+ fprintf(fp," 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9");
+ unsigned short x,y;
+ for (x = 0; x <= 18; x++){
+ fprintf(fp,"\n");
+ fprintf(fp,"%d",x+1);
+ if (x < 9) fprintf(fp," ");
+ for (y = 0; y <= 18; y++){
+ if (board[x][y] == 0)
+ fprintf(fp,".");
+ else fprintf(fp,"%c",board[x][y]);
+ fprintf(fp," ");
+ }
+
+ }
+ fprintf(fp,"\n");
+fclose(fp);
+}
Index: synth_src/threats.h
===================================================================
--- synth_src/threats.h (nonexistent)
+++ synth_src/threats.h (revision 4)
@@ -0,0 +1,30 @@
+
+
+
+
+typedef int PIECE;
+
+typedef struct Board {
+ AllocChain ac;
+ /* Allocation chain must be the first member */
+
+ unsigned int moves_left;
+ /* How many moves the current player has left */
+
+ struct Board *parent;
+ /* The board preceeding this one in history */
+
+ gboolean won;
+ BCOORD win_x1, win_y1, win_x2, win_y2;
+ /* On won boards, used to indicate where the winning line is */
+
+ PIECE turn;
+ /* Whose turn it is on this board */
+
+ BCOORD move_x, move_y;
+ /* The move to the next Board in history */
+
+ PIECE data[];
+} Board;
+/* The board structure represents the state of the game board. Do NOT preserve
+ board pointers across games. */
Index: synth_src/state.cpp
===================================================================
--- synth_src/state.cpp (nonexistent)
+++ synth_src/state.cpp (revision 4)
@@ -0,0 +1,767 @@
+
+/*
+
+connectk -- a program to play the connect-k family of games
+Copyright (C) 2007 Michael Levin
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+//#include "config.h"
+//#include
+//#include
+//#include
+//#include
+//#include
+//#include
+#include "./shared.h"
+//#include "connectk.h"
+
+/*
+ * Allocation chain
+ */
+
+#define IA 1103515245u
+#define IC 12345u
+#define IM 2147483648u
+#define CHECK_RAND
+//moved the following declaration to connect6_threat
+//static unsigned int current_random = 0;
+
+//from vpr uti.c code
+/* Portable random number generator defined below. Taken from ANSI C by *
+ * K & R. Not a great generator, but fast, and good enough for my needs. */
+
+
+void my_srandom(int seed,unsigned int *current_random)
+{
+ *current_random = (unsigned int)seed;
+}
+
+
+int my_irand(int imax,unsigned int current_random)
+{
+
+///* Creates a random integer between 0 and imax, inclusive. i.e. [0..imax] */
+//
+// int ival;
+//
+///* current_random = (current_random * IA + IC) % IM; */
+// current_random = current_random * IA + IC; /* Use overflow to wrap */
+// ival = current_random & (IM - 1); /* Modulus */
+// //float not synthesizable
+// //ival = (int)((float)ival * (float)(imax + 0.999) / (float)IM);
+// ival = (int)(ival * (imax + 1) / IM);
+//
+//#ifdef CHECK_RAND
+// if((ival < 0) || (ival > imax))
+// {
+// //printf("Bad value in my_irand, imax = %d ival = %d\n", imax,
+// // ival);
+// //exit(1);
+// }
+//#endif
+//
+// return (ival);
+return(0);
+}
+
+
+//static void achain_init(AllocChain *ac)
+//{
+// static unsigned int ids;
+//
+// ac->free = FALSE;
+// ac->id = ids++;
+//}
+//
+//AllocChain *achain_new(AllocChain **root, AllocFunc afunc)
+//{
+// AllocChain *ac;
+//
+// if (!*root) {
+// *root = afunc(NULL);
+// achain_init(*root);
+// (*root)->next = NULL;
+// return *root;
+// }
+// ac = *root;
+// for (;;) {
+// if (ac->free) {
+// afunc(ac);
+// achain_init(ac);
+// return ac;
+// }
+// if (!ac->next)
+// break;
+// ac = ac->next;
+// }
+// ac->next = afunc(NULL);
+// achain_init(ac->next);
+// ac->next->next = NULL;
+// return ac->next;
+//}
+//
+//void achain_free(AllocChain *ac)
+//{
+// if (!ac)
+// return;
+// ac->free = TRUE;
+//}
+//
+//void achain_copy(const AllocChain *src, AllocChain *dest, gsize mem)
+//{
+// if (!src || !dest || !mem) {
+// g_warning("NULL argument(s) to achain_copy");
+// return;
+// }
+// memcpy((char*)dest + sizeof (AllocChain),
+// (char*)src + sizeof (AllocChain), mem - sizeof (AllocChain));
+//}
+//
+//static void achain_dealloc(AllocChain **root, gsize mem)
+//{
+// AllocChain *ac = *root, *ac_next;
+//
+// while (ac) {
+// ac_next = ac->next;
+// g_slice_free1(mem, ac);
+// ac = ac_next;
+// }
+// *root = NULL;
+//}
+
+
+// Move Arrays
+
+
+//AllocChain *aimoves_root = NULL;
+gsize aimoves_mem = 0;
+
+//AllocChain *aimoves_alloc(AllocChain *ac)
+//{
+// //if (!ac)
+// // ac = (AllocChain*)g_slice_alloc(aimoves_mem);
+// //memset((char*)ac + sizeof (AllocChain), 0, sizeof (AIMoves) -
+// // sizeof (AllocChain));
+// //return ac;
+//}
+
+void aimoves_add(AIMoves *moves, const AIMove *move)
+{
+ int i;
+
+ i = aimoves_find(moves, move->x, move->y);
+ if (i < 0) {
+ if (moves->len >= board_size * board_size)
+ //g_warning("Attempted to add a move to a full AIMoves");
+ //printf("Attempted to add a move to a full AIMoves");
+ return;
+ else
+ moves->data[moves->len++] = *move;
+ } else
+ moves->data[i].weight += move->weight;
+}
+
+void aimoves_append(AIMoves *moves, const AIMove *move)
+{
+ int i;
+
+ if (move->x >= board_size || move->y >= board_size)
+ return;
+ for (i = 0; i < moves->len; i++) {
+ AIMove *aim = moves->data + i;
+
+ if (aim->x == move->x && aim->y == move->y) {
+ aim->weight = move->weight;
+ return;
+ }
+ }
+ if (moves->len >= board_size * board_size) {
+ //g_warning("Attempted to append a move to a full AIMoves");
+ //printf("Attempted to append a move to a full AIMoves");
+ return;
+ }
+ moves->data[moves->len++] = *move;
+}
+
+int aimoves_compare(const void *a, const void *b)
+{
+ return ((AIMove*)b)->weight - ((AIMove*)a)->weight;
+}
+
+int aimoves_choose(AIMoves *moves, AIMove *move)
+{
+ //#pragma read_write_ports moves.data combined 3
+ //#pragma internal_blockram moves
+ //#pragma no_memory_analysis moves
+ int i = 0, top = 0;
+ #pragma bitsize i 4
+ if (!moves || !moves->len)
+ return 0;
+ aimoves_sort(moves);
+ for (top = 0; top < moves->len &&
+ moves->data[top].weight == moves->data[0].weight; top++);
+ if (top)
+ //i = my_irand(top,current_random);//g_random_int_range(0, top);
+ i=0;
+
+ *move = moves->data[i];
+ return 1;
+}
+//
+//void aimoves_crop(AIMoves *moves, unsigned int n)
+//{
+// if (moves->len < n)
+// return;
+// aimoves_shuffle(moves);
+// aimoves_sort(moves);
+// moves->len = n;
+//}
+//
+//void aimoves_concat(AIMoves *m1, const AIMoves *m2)
+//{
+// gsize max_len = board_size * board_size, len;
+//
+// len = m2->len;
+// if (m1->len + len > max_len)
+// len = max_len - m1->len;
+// memcpy(m1->data + len, m2->data, len * sizeof (AIMove));
+// m1->len += len;
+//}
+//
+//AIMoves *aimoves_dup(const AIMoves *moves)
+//{
+// AIMoves *dup;
+//
+// if (!moves)
+// return NULL;
+// dup = aimoves_new();
+// dup->len = moves->len;
+// memcpy(dup->data, moves->data, moves->len * sizeof (AIMove));
+// return dup;
+//}
+//
+int aimoves_find(const AIMoves *moves, BCOORD x, BCOORD y)
+{
+ int i;
+
+ if (moves)
+ for (i = 0; i < moves->len; i++) {
+ const AIMove *aim = moves->data + i;
+
+ if (aim->x == x && aim->y == y)
+ return i;
+ }
+ return -1;
+}
+//
+//void aimoves_range(AIMoves *moves, AIWEIGHT *min, AIWEIGHT *max)
+//{
+// int i;
+//
+// *min = AIW_MAX;
+// *max = AIW_MIN;
+// for (i = 0; i < moves->len; i++) {
+// if (moves->data[i].weight > *max)
+// *max = moves->data[i].weight;
+// if (moves->data[i].weight < *min)
+// *min = moves->data[i].weight;
+// }
+//}
+//
+//void aimoves_merge(AIMoves *m1, const AIMoves *m2)
+//{
+// int len = m1->len, i, j;
+//
+// for (i = 0; i < m2->len; i++)
+// for (j = 0;; j++) {
+// if (j >= len) {
+// aimoves_append(m1, m2->data + i);
+// break;
+// }
+// if (m1->data[j].x == m2->data[i].x &&
+// m1->data[j].y == m2->data[i].y) {
+// if (m2->data[i].weight > m1->data[j].weight)
+// m1->data[j].weight = m2->data[i].weight;
+// break;
+// }
+// }
+//}
+//
+//char *aimove_to_string(const AIMove *aim)
+//{
+// static char buffer[32];
+//
+// g_snprintf(buffer, sizeof (buffer), "%s (%s)",
+// bcoords_to_string(aim->x, aim->y),
+// aiw_to_string(aim->weight));
+// return buffer;
+//}
+//
+//void aimoves_print(const AIMoves *moves)
+//{
+// int i;
+//
+// if (!moves || !moves->len) {
+// g_print("(empty)");
+// return;
+// }
+// for (i = 0; i < moves->len; i++) {
+// const AIMove *aim = moves->data + i;
+//
+// if (i)
+// g_print(", ");
+// g_print("%s", aimove_to_string(aim));
+// }
+//}
+//
+//void aimoves_remove_index_fast(AIMoves *moves, int i)
+//{
+// if (moves->len > i)
+// moves->data[i] = moves->data[moves->len - 1];
+// moves->len--;
+//}
+//
+//void aimoves_remove(AIMoves *moves, BCOORD x, BCOORD y)
+//{
+// int i;
+//
+// for (i = 0; i < moves->len; i++) {
+// AIMove *aim = moves->data + i;
+//
+// if (aim->x == x && aim->y == y) {
+// aimoves_remove_index_fast(moves, i);
+// return;
+// }
+// }
+//}
+//
+void aimoves_shuffle(AIMoves *moves,unsigned int current_random)
+{
+// int i;
+//
+// if (opt_det_ai)
+// return;
+//
+// /* Fisher-Yates shuffle */
+// for (i = 0; i < moves->len; i++) {
+// int j;
+//
+// j = my_irand(moves->len,current_random);//g_random_int_range(i, moves->len);
+// if (i != j) {
+// AIMove tmp;
+//
+// tmp = moves->data[i];
+// moves->data[i] = moves->data[j];
+// moves->data[j] = tmp;
+// }
+// }
+return;
+}
+
+
+//taken from http://cprogramminglanguage.net/c-bubble-sort-source-code.aspx
+void swap(AIMove *x,AIMove *y)
+{
+ AIMove temp;
+ temp = *x;
+ *x = *y;
+ *y = temp;
+}
+void bublesort(AIMove *list, int n)
+{
+ int i,j;
+ for(i=0;i<(n-1);i++)
+ for(j=0;j<(n-(i+1));j++)
+ if(list[j].weight < list[j+1].weight)
+ swap(&list[j],&list[j+1]);
+}
+//taken from http://cprogramminglanguage.net/c-bubble-sort-source-code.aspx
+void aimoves_sort(AIMoves *moves)
+{
+ //qsort(moves->data, moves->len, sizeof (AIMove), aimoves_compare);
+ bublesort(moves->data,moves->len);
+
+}
+
+//void aimoves_subtract(AIMoves *m1, const AIMoves *m2)
+//{
+// int i, j;
+//
+// for (i = 0; i < m1->len; i++)
+// for (j = 0; j < m2->len; j++)
+// if (m1->data[i].x == m2->data[j].x &&
+// m1->data[i].y == m2->data[j].y) {
+// aimoves_remove_index_fast(m1, i--);
+// break;
+// }
+//}
+//
+//const char *aiw_to_string(AIWEIGHT w)
+//{
+// static char buffer[32];
+//
+// switch (w) {
+// case AIW_WIN:
+// return "WIN";
+// case AIW_LOSE:
+// return "LOSS";
+// case AIW_NONE:
+// return "NONE";
+// default:
+// break;
+// }
+// if (w > 0)
+// g_snprintf(buffer, sizeof (buffer), "%010d (10^%.2f)", w,
+// log10((double)w));
+// else if (w < 0)
+// g_snprintf(buffer, sizeof (buffer), "%010d (-10^%.2f)", w,
+// log10((double)-w));
+// return buffer;
+//}
+
+/*
+ * Boards
+ */
+
+//Board board;
+//AllocChain *board_root = NULL;
+//int board_size=19, board_stride=21, move_no, move_last,
+// connect_k = 6, place_p = 2, start_q = 1;
+//int opt_det_ai=1;
+//gsize board_mem = 0;
+
+//Player players[PIECES] = {
+// { PLAYER_HUMAN, SEARCH_NONE, 0 },
+// { PLAYER_HUMAN, SEARCH_NONE, 0 },
+// { PLAYER_HUMAN, SEARCH_NONE, 0 },
+//};
+//
+//static GPtrArray *history = NULL;
+
+static void board_init(Board *b)
+{
+// memset((char*)b + sizeof (AllocChain), 0, sizeof (Board) -
+// sizeof (AllocChain));
+int i,j;
+for(i=0;idata[i][0]=PIECE_ERROR;
+for(i=0;idata[i][board_stride-1]=PIECE_ERROR;
+for(j=0;jdata[0][j]=PIECE_ERROR;
+for(j=0;jdata[board_stride-1][j]=PIECE_ERROR;
+for(i=1;idata[i][j]=PIECE_NONE;
+
+ //b->ac=(const AllocChain )0;
+ b->moves_left=0;
+ b->parent =0;
+ b->won =0;
+ b->win_x1 =0;
+ b->win_y1 =0;
+ b->win_x2 =0;
+ b->win_y2 =0;
+ b->turn =0;
+ b->move_x =0;
+ b->move_y =0;
+}
+
+//AllocChain *board_alloc(AllocChain *ac)
+//{
+// //Board *b = (Board*)ac;
+// //int i;
+//
+// ///* Clear the old board */
+// //if (b) {
+// // for (i = 1; i <= board_size; i++)
+// // memset(b->data + board_stride * i + 1, 0,
+// // board_size * sizeof (PIECE));
+// // board_init(b);
+// // return (AllocChain*)b;
+// //}
+//
+// ///* New boards are allocated with a 1-tile wide boundary of PIECE_ERROR
+// // around the edges */
+// //b = (Board*)g_slice_alloc0(board_mem);
+// //memset(b->data, PIECE_ERROR, sizeof (PIECE) * board_stride);
+// //for (i = 1; i <= board_size; i++) {
+// // b->data[i * board_stride] = PIECE_ERROR;
+// // memset(b->data + board_stride * i + 1, 0,
+// // board_size * sizeof (PIECE));
+// // b->data[(i + 1) * board_stride - 1] = PIECE_ERROR;
+// //}
+// //memset(b->data + board_stride * (board_stride - 1), PIECE_ERROR,
+// // sizeof (PIECE) * board_stride);
+// //board_init(&b);
+// //return (AllocChain*)b;
+//}
+
+void board_clean(Board *b)
+{
+ int y, x;
+
+ for (y = 0; y < board_size; y++)
+ for (x = 0; x < board_size; x++)
+ if (piece_at(b, x, y) >= PIECES)
+ place_piece_type(b, x, y, PIECE_NONE);
+}
+
+//void set_board_size(unsigned int size)
+//{
+// //if (board_size == size)
+// // return;
+// ////draw_marks(NULL, FALSE);
+// //achain_dealloc(&board_root, board_mem);
+// achain_dealloc(&aimoves_root, aimoves_mem);
+// //board_size = size;
+// //board_stride = size + 2;
+// //board_mem = sizeof (Board) + board_stride * board_stride *
+// // sizeof (PIECE);
+// aimoves_mem = sizeof (AIMoves) + size * size * sizeof (AIMove);
+//}
+
+//Board *board_at(unsigned int move)
+//{
+// if (move >= history->len)
+// return NULL;
+// return (Board*)g_ptr_array_index(history, move);
+//}
+
+int count_pieces(const Board *b, BCOORD x, BCOORD y, PIECE type, int dx, int dy,
+ PIECE *out)
+{
+ int i;
+ PIECE p = PIECE_NONE;
+
+ if (!dx && !dy)
+ return piece_at(b, x, y) == type ? 1 : 0;
+ for (i = 0; x >= 0 && x < board_size && y >= 0 && y < board_size; i++) {
+ p = piece_at(b, x, y);
+ if (p != type)
+ break;
+ x += dx;
+ y += dy;
+ }
+ if (out)
+ *out = p;
+ return i;
+}
+
+gboolean check_win_full(const Board *b, BCOORD x, BCOORD y,
+ BCOORD *x1, BCOORD *y1, BCOORD *x2, BCOORD *y2)
+{
+ int i, c1, c2, xs[] = {1, 1, 0, -1}, ys[] = {0, 1, 1, 1};
+ PIECE type;
+
+ type = piece_at(b, x, y);
+ if (type != PIECE_BLACK && type != PIECE_WHITE)
+ return FALSE;
+ for (i = 0; i < 4; i++) {
+ c1 = count_pieces(b, x, y, type, xs[i], ys[i], 0);
+ c2 = count_pieces(b, x, y, type, -xs[i], -ys[i], 0);
+ if (c1 + c2 > connect_k) {
+ if (x1)
+ *x1 = x + xs[i] * (c1 - 1);
+ if (y1)
+ *y1 = y + ys[i] * (c1 - 1);
+ if (x2)
+ *x2 = x - xs[i] * (c2 - 1);
+ if (y2)
+ *y2 = y - ys[i] * (c2 - 1);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+///* Convert a boord coordinate to alpha representation */
+//const char *bcoord_to_alpha(BCOORD x)
+//{
+// static char buf[2][32];
+// static int which;
+// int i, divisor = 26;
+//
+// which = !which;
+// for (i = 0; i < sizeof (buf[which]) - 1; i++) {
+// div_t result;
+//
+// result = div(x, divisor);
+// buf[which][i] = 'a' + result.rem * 26 / divisor;
+// if (i)
+// buf[which][i]--;
+// x -= result.rem;
+// if (!x)
+// break;
+// divisor *= 26;
+// }
+// buf[which][i + 1] = 0;
+// return g_strreverse(buf[which]);
+//}
+
+//// Get a string representation of board x/y coordinates (d7, h16, etc)
+//const char *bcoords_to_string(BCOORD x, BCOORD y)
+//{
+// static char buf[2][32];
+// static int which;
+//
+// which = !which;
+// g_snprintf(buf[which], sizeof (buf[which]), "%s%d",
+// bcoord_to_alpha(x), board_size - y);
+// return buf[which];
+//}
+//
+/* Convert a string representation to coordinates */
+void string_to_bcoords(const char *str, BCOORD *x, BCOORD *y)
+{
+ *x = 0;
+ *y = 0;
+ while (*str && *str >= 'a' && *str <= 'z') {
+ *x *= 26;
+ *x += *str - 'a';
+ str++;
+ }
+ while (*str && *str >= '0' && *str <= '9') {
+ *y *= 10;
+ *y += *str - '0';
+ str++;
+ }
+ if (*y)
+ *y = board_size - *y;
+}
+
+const char *piece_to_string(PIECE piece)
+{
+ switch (piece) {
+ case PIECE_WHITE:
+ return "White";
+ case PIECE_BLACK:
+ return "Black";
+ case PIECE_NONE:
+ return "None";
+ case PIECE_ERROR:
+ return "Error";
+ default:
+ return "Mark";
+ }
+}
+
+char piece_to_char(PIECE piece)
+{
+ switch (piece) {
+ case PIECE_WHITE:
+ return 'W';
+ case PIECE_BLACK:
+ return 'B';
+ case PIECE_NONE:
+ return '_';
+ case PIECE_ERROR:
+ return 'E';
+ default:
+ return 'M';
+ }
+}
+
+//char *search_to_string(SEARCH s)
+//{
+// switch (s) {
+// case SEARCH_NONE:
+// return "No search";
+// case SEARCH_DFS:
+// return "Depth first search";
+// case SEARCHES:
+// break;
+// }
+// return "Unknown";
+//}
+
+//void go_to_move(unsigned int move)
+//{
+// Board board2;
+//
+// if (!history)
+// history = g_ptr_array_sized_new(32);
+// if (move > history->len)
+// move = history->len;
+// if (move == history->len) {
+// //board2 = board_new();
+// if (&board)
+// board_copy(&board, &board2);
+// g_ptr_array_add(history, &board2);
+// board2.parent = &board;
+// } else
+// //board2 = (Board*)g_ptr_array_index(history, move);
+// //&board = &board2;
+// move_no = move;
+// if (move_no > move_last)
+// move_last = move_no;
+//}
+
+//void clear_history(unsigned int from)
+//{
+// int i;
+//
+// if (!history)
+// return;
+// if (from >= history->len) {
+// g_warning("Attempted to clear future history");
+// return;
+// }
+// for (i = from; i < history->len; i++)
+// board_free(g_ptr_array_index(history, i));
+// g_ptr_array_remove_range(history, from, history->len - from);
+// move_last = from;
+//}
+/* Clear the board and history for a new game */
+void new_game(Board *board,unsigned int size)
+{
+ //tree_view_clear(1);
+ //clear_history(0);
+ //set_board_size(size);
+ //board = NULL;
+ //go_to_move(0);
+ //move_last=0;
+ //move_no=0;
+ board_init(board);
+ board->moves_left = start_q;
+ board->turn = PIECE_BLACK;
+ //draw_board();
+ //stop_ai();
+ //setup_move();
+}
+void board_copy(const Board *from, Board *to){
+int i,j;
+for(i=0;idata[i][j]=from->data[i][j];
+
+ to->ac= from->ac;
+ to->moves_left= from->moves_left;
+ to->parent = from->parent;
+ to->won = from->won;
+ to->win_x1 = from->win_x1;
+ to->win_y1 = from->win_y1;
+ to->win_x2 = from->win_x2;
+ to->win_y2 = from->win_y2;
+ to->turn = from->turn;
+ to->move_x = from->move_x;
+ to->move_y = from->move_y;
+
+
+}
synth_src/state.cpp
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: synth_src/util.h
===================================================================
--- synth_src/util.h (nonexistent)
+++ synth_src/util.h (revision 4)
@@ -0,0 +1,34 @@
+/* util.cpp
+ June 9, 2011
+ Some helper functions.
+
+ Much of the code below is borrowed from Alastair Smith's program
+ from the 2010 FPT Othello competition
+
+ By Kevin Nam
+*/
+
+#ifndef _UTILS_H
+#define _UTILS_H
+
+using namespace std;
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+//#include "commondefs.h"
+
+/*********************** Portable random number generators *******************/
+
+void setup_port(int fd);
+int select_com_port(int argc, char **argv);
+char select_AI_colour (int argc, char **argv);
+int char_to_int (char c);
+void wait(double seconds);
+#endif
Index: synth_src/connect6_synth.cpp
===================================================================
--- synth_src/connect6_synth.cpp (nonexistent)
+++ synth_src/connect6_synth.cpp (revision 4)
@@ -0,0 +1,252 @@
+/*
+ connect6.cpp
+ June 9, 2011
+ This file contains the game AI
+ By Kevin Nam
+
+ */
+
+//#include
+//#include
+//
+//#include "util.h"
+//#include "connect6.h"
+//#include
+#include "./shared.h"
+//#include "pico.h"
+
+// Subtract this many points for moves at the edges.
+#define EDGEPENALTY 5
+
+using namespace std;
+
+/* The cost function simply counts all of the consecutive stones of same colour in
+ every direction from the spot for which the points is being calculated.
+
+Ex:
+
+.DDLL
+.DLDD
+DXDDD
+...D.
+
+Above, X is the spot being calculated.
+The points would be 2 (above) + 2(topright) + 3(right) + 1 (left) = 8.
+It treats opponent's stones and own stones with equal weighting.
+
+Return 0 if the spot y,x is already taken, else return the calculated value
+
+ */
+void move_to_ascii(int x,int y, char *move){
+ if (y >= 10){
+ move[0] = '1';
+ y -= 10;
+ } else {
+ move[0] = '0';
+ }
+ if (y == 0) move[1] = '0';
+ else if (y == 1) move[1] = '1';
+ else if (y == 2) move[1] = '2';
+ else if (y == 3) move[1] = '3';
+ else if (y == 4) move[1] = '4';
+ else if (y == 5) move[1] = '5';
+ else if (y == 6) move[1] = '6';
+ else if (y == 7) move[1] = '7';
+ else if (y == 8) move[1] = '8';
+ else if (y == 9) move[1] = '9';
+
+ // Do same for x.
+ if (x >= 10){
+ move[2] = '1';
+ x -= 10;
+ } else {
+ move[2] = '0';
+ }
+ if (x == 0) move[3] = '0';
+ else if (x == 1) move[3] = '1';
+ else if (x == 2) move[3] = '2';
+ else if (x == 3) move[3] = '3';
+ else if (x == 4) move[3] = '4';
+ else if (x == 5) move[3] = '5';
+ else if (x == 6) move[3] = '6';
+ else if (x == 7) move[3] = '7';
+ else if (x == 8) move[3] = '8';
+ else if (x == 9) move[3] = '9';
+
+}
+
+static int char_to_int(short x){
+ if(x>=48)
+ return x-48;
+ else
+ return 0;
+}
+
+
+/*
+ The AI Function that calls the cost function for every spot on the board.
+ It returns the location with the highest points. In the event of a tie, randomly decide.
+ Input the board and the colour being played.
+ Puts the move (in ASCII chars) inside move[4]. This is from [1 ... 19]
+ Puts the move (in integers) in moveY and moveX. This is from [0 ... 18]
+ */
+//void backup_move(Board *board, AIMoves *moves,AIMove *move){
+////when the threat doesn't return any good move
+////put in a single function to parition and speedup synthesis
+// //#pragma read_write_ports board.data combined 2
+// //#pragma internal_blockram myboard
+// //#pragma no_memory_analysis myboard
+// //#pragma read_write_ports moves.data combined 3
+// //#pragma internal_blockram moves
+// //#pragma no_memory_analysis moves
+// move->x=-1;
+// move->y=-1;
+// if (!aimoves_choose(moves, move)) {
+// // aimoves_free(moves);
+// //moves->len=0;
+// // /*moves = */ai_adjacent(board,moves);
+// aimoves_choose(moves, move);
+// }
+//}
+int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]){
+ //int id= PICO_initialize_PPA(ai_threats);
+ #pragma bitsize firstmove 17
+ char moveoutm[8];
+ #pragma internal_blockram moveoutm
+ short x,y,highx = 0;
+ //Board *myboard ;
+ static Board myboard;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}};
+ //#pragma read_write_ports board.data combined 2
+ //#pragma preserve_array myboard.data
+ #pragma internal_blockram myboard
+ //#pragma no_memory_analysis myboard
+ static unsigned int current_random = 10;
+ AIMove move,move_threat,move_adj;
+ //#pragma internal_blockram move
+ //#pragma no_memory_analysis move
+ if(firstmove==0||firstmove==1) {
+ //my_srandom(1,¤t_random);
+ new_game(&myboard,board_size);
+ }
+ if(firstmove==0) myboard.moves_left=1;
+ else myboard.moves_left=2;
+
+ //-------------------------------------------------------------------------
+ if((firstmove >= 1)){
+ //update the board
+ y = char_to_int(movein[0])*10 + char_to_int(movein[1]) - 1;
+ x = char_to_int(movein[2])*10 + char_to_int(movein[3]) - 1;
+ if(colour==68){//'D')
+ //myboard[y][x] = (char)2;//76;//'L';
+ place_piece_type(&myboard,x,y,PIECE_WHITE);
+ myboard.turn=PIECE_BLACK;
+ }else{
+ //board[y][x] = (char)1;//68;//'D';
+ place_piece_type(&myboard,x,y,PIECE_BLACK);
+ myboard.turn=PIECE_WHITE;
+ }
+ }
+ if((firstmove >=3)){
+ //update the board
+ y = char_to_int(movein[4])*10 + char_to_int(movein[5]) - 1;
+ x = char_to_int(movein[6])*10 + char_to_int(movein[7]) - 1;
+ if(colour==68){//'D')
+ //board[y][x] = (char)2;//76;//'L';
+ place_piece_type(&myboard,x,y,PIECE_WHITE);
+ myboard.turn=PIECE_BLACK;
+ }else{
+ //board[y][x] = (char)1;//68;//'D';
+ place_piece_type(&myboard,x,y,PIECE_BLACK);
+ myboard.turn=PIECE_WHITE;
+ }
+ }
+ int i;
+ #pragma bitsize i 6
+
+ for(i=myboard.moves_left;i>0;i--){
+ //aimoves_free(&moves);
+ move.x=-1;
+ move.y=-1;
+
+ if (!ai_threats(&myboard,&move_threat)){
+ //aimoves_free(&moves);
+ //moves.len=0;
+ ai_adjacent(&myboard,&move_adj,current_random);
+ move.x=move_adj.x;
+ move.y=move_adj.y;
+ }else{
+ move.x=move_threat.x;
+ move.y=move_threat.y;
+ }
+
+ //backup_move(&myboard,&moves,&move);
+ //printf("DEBUG1:%d ",move.x);
+ // Modify the board based on current move.
+ place_piece_type(&myboard,move.x,move.y,myboard.turn);
+ /// Convert the int coordinates to corresponding ASCII chars
+
+ //if(firstmove==0)
+ //move_to_ascii(move.x+1,move.y+1,&moveout[0]);
+ //else if(myboard.moves_left==2)
+ //move_to_ascii(move.x+1,move.y+1,&moveout[0]);
+ //else
+ //move_to_ascii(move.x+1,move.y+1,&moveout[4]);
+ if(firstmove==0)
+ move_to_ascii(move.x+1,move.y+1,&moveoutm[0]);
+ else
+ move_to_ascii(move.x+1,move.y+1,&moveoutm[8-4*i]);
+ myboard.moves_left--;
+ }
+ if(firstmove==0){
+ #pragma unroll
+ for(i=0;i<4;i++)
+ moveout[i]=moveoutm[i];
+ }else{
+ #pragma unroll
+ for(i=0;i<8;i++)
+ moveout[i]=moveoutm[i];
+ }
+ //if(firstmove==0){
+ //moveout[0]=moveoutm[0];
+ //moveout[1]=moveoutm[1];
+ //moveout[2]=moveoutm[2];
+ //moveout[3]=moveoutm[3];
+ //}else{
+ //moveout[0]=moveoutm[0];
+ //moveout[1]=moveoutm[1];
+ //moveout[2]=moveoutm[2];
+ //moveout[3]=moveoutm[3];
+ //moveout[4]=moveoutm[4];
+ //moveout[5]=moveoutm[5];
+ //moveout[6]=moveoutm[6];
+ //moveout[7]=moveoutm[7];
+ //}
+
+ ////-------------------------------------------------------------------------
+ //if(firstmove>=1){
+ ////aimoves_free(&moves);
+ //moves.len=0;
+ //myboard.moves_left=1;
+ ///*moves=*/ai_threats(&myboard,&moves);
+ // move.x=-1;
+ // move.y=-1;
+ // if (!aimoves_choose(&moves, &move)) {
+ // //aimoves_free(&moves);
+ // moves.len=0;
+ // /*moves = */ai_adjacent(&myboard,&moves);
+ // aimoves_choose(&moves, &move);
+ // }
+ // //backup_move(&myboard,&moves,&move);
+ ////printf("DEBUG2%d\n",move.x);
+ //// Modify the board based on current move.
+ //place_piece_type(&myboard,move.x,move.y,myboard.turn);
+ //
+ // /// Convert the int coordinates to corresponding ASCII chars
+ //move_to_ascii(move.x+1,move.y+1,&moveout[4]);
+ //}
+ //PICO_finalize_PPA(id);
+ return 0;
+}
+
+
+
Index: synth_src/connect6.h
===================================================================
--- synth_src/connect6.h (nonexistent)
+++ synth_src/connect6.h (revision 4)
@@ -0,0 +1,19 @@
+/*
+ connect6.h
+ June 9, 2011
+ This file contains the game AI
+ By Kevin Nam
+
+*/
+
+#ifndef _CONNECT6_H
+#define _CONNECT6_H
+
+int calculatepoints(char board[][19], int y, int x, char colour);
+int connect6ai(char board[][19], char colour, char move[4]);
+char check_for_win (char board[][19]);
+int check_board_full (char board[][19]);
+int check_move_validity (char board[][19],int y, int x);
+void print_board (char board[][19]);
+void print_board_file (char board[][19]);
+#endif
Index: synth_src/connect6_synth.c
===================================================================
--- synth_src/connect6_synth.c (nonexistent)
+++ synth_src/connect6_synth.c (revision 4)
@@ -0,0 +1,145 @@
+/*
+ connect6.cpp
+ June 9, 2011
+ This file contains the game AI
+ By Kevin Nam
+
+ */
+
+//#include
+//#include
+//
+//#include "util.h"
+//#include "connect6.h"
+#include "./shared.h"
+
+// Subtract this many points for moves at the edges.
+#define EDGEPENALTY 5
+
+
+/* The cost function simply counts all of the consecutive stones of same colour in
+ every direction from the spot for which the points is being calculated.
+
+Ex:
+
+.DDLL
+.DLDD
+DXDDD
+...D.
+
+Above, X is the spot being calculated.
+The points would be 2 (above) + 2(topright) + 3(right) + 1 (left) = 8.
+It treats opponent's stones and own stones with equal weighting.
+
+Return 0 if the spot y,x is already taken, else return the calculated value
+
+ */
+void move_to_ascii(int x,int y, char *move){
+ if (y >= 10){
+ move[0] = '1';
+ y -= 10;
+ } else {
+ move[0] = '0';
+ }
+ if (y == 0) move[1] = '0';
+ else if (y == 1) move[1] = '1';
+ else if (y == 2) move[1] = '2';
+ else if (y == 3) move[1] = '3';
+ else if (y == 4) move[1] = '4';
+ else if (y == 5) move[1] = '5';
+ else if (y == 6) move[1] = '6';
+ else if (y == 7) move[1] = '7';
+ else if (y == 8) move[1] = '8';
+ else if (y == 9) move[1] = '9';
+
+ // Do same for x.
+ if (x >= 10){
+ move[2] = '1';
+ x -= 10;
+ } else {
+ move[2] = '0';
+ }
+ if (x == 0) move[3] = '0';
+ else if (x == 1) move[3] = '1';
+ else if (x == 2) move[3] = '2';
+ else if (x == 3) move[3] = '3';
+ else if (x == 4) move[3] = '4';
+ else if (x == 5) move[3] = '5';
+ else if (x == 6) move[3] = '6';
+ else if (x == 7) move[3] = '7';
+ else if (x == 8) move[3] = '8';
+ else if (x == 9) move[3] = '9';
+
+}
+
+static int char_to_int(short x){
+ if(x>=48)
+ return x-48;
+ else
+ return 0;
+}
+
+
+/*
+ The AI Function that calls the cost function for every spot on the board.
+ It returns the location with the highest points. In the event of a tie, randomly decide.
+ Input the board and the colour being played.
+ Puts the move (in ASCII chars) inside move[4]. This is from [1 ... 19]
+ Puts the move (in integers) in moveY and moveX. This is from [0 ... 18]
+ */
+int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]){
+ #pragma bitsize firstmove 17
+ short x,y,highx = 0;
+ Board *myboard ;
+ AIMoves *moves;
+ //-------------------------------------------------------------------------
+ if((firstmove >= 1)){
+ //update the board
+ y = char_to_int(movein[0])*10 + char_to_int(movein[1]) - 1;
+ x = char_to_int(movein[2])*10 + char_to_int(movein[3]) - 1;
+ if(colour==68){//'D')
+ //myboard[y][x] = (char)2;//76;//'L';
+ place_piece_type(myboard,x,y,PIECE_WHITE);
+ myboard->turn=PIECE_BLACK;
+ }else{
+ //myboard[y][x] = (char)1;//68;//'D';
+ place_piece_type(myboard,x,y,PIECE_BLACK);
+ myboard->turn=PIECE_WHITE;
+ }
+ }
+ if((firstmove >=3)){
+ //update the board
+ y = char_to_int(movein[4])*10 + char_to_int(movein[5]) - 1;
+ x = char_to_int(movein[6])*10 + char_to_int(movein[7]) - 1;
+ if(colour==68){//'D')
+ //myboard[y][x] = (char)2;//76;//'L';
+ place_piece_type(myboard,x,y,PIECE_WHITE);
+ myboard->turn=PIECE_BLACK;
+ }else{
+ //myboard[y][x] = (char)1;//68;//'D';
+ place_piece_type(myboard,x,y,PIECE_BLACK);
+ myboard->turn=PIECE_WHITE;
+ }
+ }
+ moves=ai_threats(myboard);
+ // Modify the myboard based on current move.
+ place_piece_type(myboard,moves->data[1].x,moves->data[1].y,myboard->turn);
+ /// Convert the int coordinates to corresponding ASCII chars
+
+ move_to_ascii(moves->data[1].x+1,moves->data[1].y+1,moveout);
+
+
+ //-------------------------------------------------------------------------
+ if(firstmove>=1){
+ moves=ai_threats(myboard);
+ // Modify the myboard based on current move.
+ place_piece_type(myboard,moves->data[1].x,moves->data[1].y,myboard->turn);
+
+ /// Convert the int coordinates to corresponding ASCII chars
+ move_to_ascii(moves->data[1].x+1,moves->data[1].y+1,&moveout[4]);
+ }
+ return 0;
+}
+
+
+
Index: synth_src/main.cpp
===================================================================
--- synth_src/main.cpp (nonexistent)
+++ synth_src/main.cpp (revision 4)
@@ -0,0 +1,276 @@
+/* main.cpp
+ June 9,2011
+
+ Software connect6 AI program.
+ Have your board polling for its colour before starting this program.
+
+ commandline option:
+ -port
+ Ex: "./connect6 -port /dev/ttyUSB0"
+
+ By: Kevin Nam
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "util.h"
+#include "connect6.h"
+#include "connect6_synth.h"
+//#include "pico.h"
+//#include "shared.h"
+
+// The AI has as much time as it wants, but moves after 1 second. Default is to wait 2 seconds
+#define AI_WAIT_TIME 0.1
+
+// FPGA has 1 second to make its move
+#define MOVE_TIME_LIMIT 0.1
+
+using namespace std;
+
+// commandline option: -port
+int main(int argc, char **argv){
+ //for verification two runs and a reference board
+ int i,j,k;
+ char ref_board[19][19] = {{ 0 }};
+
+ char board[19][19] = {{ 0 }};
+ char move[4];
+ char moveport[8]={0};
+ char moveportout[8]={0};
+ int movecount=0;
+ int y,x;
+ char winning_colour;
+
+ // Get the serial port
+ //int port = select_com_port(argc,argv);
+ // Get software AI's colour
+ char AI_colour = select_AI_colour(argc,argv);
+ char FPGA_colour;
+ //int id = PICO_initialize_PPA(connect6ai_synth);
+ // Take care of the first few moves (including sending the colour)
+ if (AI_colour == 'D'){
+ FPGA_colour = 'L';
+ //write(port, "L",1);
+
+ wait(AI_WAIT_TIME);
+
+ // AI makes a move
+ connect6ai(board,AI_colour,move);
+ movecount++;
+ cout<<"AI MOVE: "<
+#include
+#include
+#include "../shared.h"
+#include "../connectk.h"
+
+/*
+ * AIs
+ */
+
+static AI ais[] = {
+ { "human", "Human", NULL },
+ { "random", "Random", ai_random },
+ { "adjacent", "Adjacent", ai_adjacent },
+ { "threats", "Threats", ai_threats },
+ /*{ "windows", "Windows", ai_windows },*/
+ /*{ "priority", "Prioritized Threats", ai_priority },*/
+ { "sequences", "Sequences", ai_sequences },
+ { "mesh", "Mesh", ai_mesh },
+ { "montecarlo", "Monte Carlo", ai_monte_carlo },
+};
+
+static gboolean is_adjacent(const Board *b, BCOORD x, BCOORD y, int dist)
+{
+ int dx, dy, count;
+ PIECE p;
+
+ if (!piece_empty(piece_at(b, x, y)))
+ return FALSE;
+ for (dy = -1; dy < 2; dy++)
+ for (dx = -1; dx < 2; dx++) {
+ if (!dx && !dy)
+ continue;
+ count = count_pieces(b, x, y, PIECE_NONE, dx, dy, &p);
+ if (count - 1 < dist && p != PIECE_NONE)
+ return TRUE;
+ }
+ return FALSE;
+}
+
+AIMoves *enum_adjacent(const Board *b, int dist)
+{
+ AIMoves *moves;
+ AIMove move;
+
+ move.weight = AIW_NONE;
+ moves = aimoves_new();
+ for (move.y = 0; move.y < board_size; move.y++)
+ for (move.x = 0; move.x < board_size; move.x++)
+ if (is_adjacent(b, move.x, move.y, dist))
+ aimoves_append(moves, &move);
+ aimoves_shuffle(moves);
+ return moves;
+}
+
+AIMoves *ai_marks(const Board *b, PIECE min)
+{
+ AIMoves *moves = aimoves_new();
+ AIMove move;
+ PIECE p;
+
+ for (move.y = 0; move.y < board_size; move.y++)
+ for (move.x = 0; move.x < board_size; move.x++)
+ if ((p = piece_at(b, move.x, move.y)) >= min) {
+ move.weight = p - PIECE_THREAT0;
+ aimoves_set(moves, &move);
+ }
+ return moves;
+}
+
+AIMoves *ai_random(const Board *b)
+/* Returns a list of all empty tiles */
+{
+ AIMove move;
+ AIMoves *moves;
+
+ moves = aimoves_new();
+ for (move.y = 0; move.y < board_size; move.y++)
+ for (move.x = 0; move.x < board_size; move.x++)
+ if (piece_empty(piece_at(b, move.x, move.y))) {
+ move.weight =
+ g_random_int_range(AIW_MIN, AIW_MAX);
+ aimoves_append(moves, &move);
+ }
+ return moves;
+}
+
+AIMoves *ai_adjacent(const Board *b)
+{
+ AIMove move;
+ AIMoves *moves;
+
+ /* Get all open tiles adjacent to any piece */
+ moves = enum_adjacent(b, 1);
+ if (moves->len)
+ return moves;
+
+ /* Play in the middle if there are no open adjacent tiles */
+ move.x = board_size / 2;
+ move.y = board_size / 2;
+ move.weight = AIW_NONE;
+ aimoves_append(moves, &move);
+ return moves;
+}
+
+const char *player_to_string(PLAYER p)
+{
+ return ais[p].l_desc;
+}
+
+int number_of_ais(void)
+{
+ return sizeof (ais) / sizeof (*ais);
+}
+
+AI *ai(int n)
+{
+ if (n >= 0 && n < number_of_ais())
+ return ais + n;
+ return NULL;
+}
+
synth_src/ai.c
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: synth_src/connect6_synth.h
===================================================================
--- synth_src/connect6_synth.h (nonexistent)
+++ synth_src/connect6_synth.h (revision 4)
@@ -0,0 +1,5 @@
+#ifndef _CONNECT6_H_SYNTH
+#define _CONNECT6_H_SYNTH
+
+int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]);
+#endif
Index: synth_src/threats.cpp
===================================================================
--- synth_src/threats.cpp (nonexistent)
+++ synth_src/threats.cpp (revision 4)
@@ -0,0 +1,591 @@
+
+/*
+
+connectk -- a program to play the connect-k family of games
+Copyright (C) 2007 Michael Levin
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+//#include "config.h"
+//#include
+//#include h>
+#include "./shared.h"
+//#include
+
+/* Bits per threat level */
+#define BITS_PER_THREAT 6
+
+
+typedef struct {
+ int threat[2];
+ PIECE turn[2];
+} Line;
+typedef struct{
+ int data[MAX_CONNECT_K + 1][2];
+}threat_count_array;
+
+static AIWEIGHT threat_bits(int threat, PIECE type, Board *b)
+/* Bit pack the threat value */
+{
+ if (threat < 1)
+ return 0;
+
+ /* No extra value for building sequences over k - p unless it is
+ enough to win */
+ if (b->turn == type && connect_k - threat <= b->moves_left)
+ threat = connect_k - place_p + 1;
+ else if (threat >= connect_k - place_p)
+ threat = connect_k - place_p - (type == b->turn);
+
+ return 1 << ((threat - 1) * BITS_PER_THREAT);
+}
+
+static void threat_mark(int i, int threat, PIECE type,Board *b,Line *line)
+{
+ int j, index = 0;
+
+ if (threat <= 0)
+ return;
+
+ /* No extra value for building sequences over k - p unless it is
+ enough to win */
+ if (b->turn == type && connect_k - threat <= b->moves_left)
+ threat = connect_k - place_p + 1;
+ else if (threat >= connect_k - place_p)
+ threat = connect_k - place_p - (type == b->turn);
+
+ /* Do not mark if this threat is dominated by a preceeding threat;
+ Likewise supress any smaller threats */
+ for (j = i; j >= 0 && j > i - connect_k; j--)
+ if (line[j].threat[0] > threat)
+ return;
+ else if (line[j].threat[0] < threat) {
+ line[j].threat[0] = 0;
+ line[j].threat[1] = 0;
+ }
+
+ /* Store up to two threats per tile in the line */
+ if (line[i].threat[index])
+ index++;
+ line[i].threat[index] = threat;
+ line[i].turn[index] = type;
+}
+
+int threat_window(int x, int y, int dx, int dy,
+ PIECE *ptype, int *pdouble,Board *b)
+{
+ int minimum, maximum, count = 0;
+ PIECE p, type = PIECE_NONE;
+
+ /* Check if this tile is empty */
+ p = piece_at(b, x, y);
+ if (!piece_empty(p))
+ return 0;
+
+ /* Push forward the maximum and find the window type */
+ #pragma unroll
+ for (maximum = 1; maximum < connect_k; maximum++) {
+ p = piece_at(b, x + dx * maximum, y + dy * maximum);
+ if (p == PIECE_ERROR)
+ break;
+ if (!piece_empty(p)) {
+ if (type == PIECE_NONE)
+ type = p;
+ else if (type != p)
+ break;
+ count++;
+ }
+ }
+ maximum--;
+
+ /* Try to push the entire window back */
+ #pragma unroll
+ for (minimum = -1; minimum > -connect_k; minimum--) {
+ p = piece_at(b, x + dx * minimum, y + dy * minimum);
+ if (p == PIECE_ERROR || piece_empty(p))
+ break;
+ if (type == PIECE_NONE)
+ type = p;
+ else if (type != p)
+ break;
+ if (maximum - minimum > connect_k - 1) {
+ p = piece_at(b, x + dx * maximum, y + dy * maximum);
+ if (p == type)
+ count--;
+ maximum--;
+ }
+ count++;
+ }
+ minimum++;
+
+ /* Push back minimum if we haven't formed a complete window, this window
+ can't be a double */
+ if (maximum - minimum < connect_k - 1) {
+ for (minimum--; minimum > maximum - connect_k; minimum--) {
+ p = piece_at(b, x + dx * minimum, y + dy * minimum);
+ if (p == PIECE_ERROR)
+ break;
+ if (!piece_empty(p)) {
+ if (type != p)
+ break;
+ if (type == PIECE_NONE)
+ type = p;
+ count++;
+ }
+ }
+ *pdouble = 0;
+ minimum++;
+ }
+
+ *ptype = type;
+ if (maximum - minimum >= connect_k - 1)
+ return count;
+ return 0;
+}
+
+/*static*/ AIWEIGHT threat_line(int x, int y, int dx, int dy,Board *b,Board *bwrite,AIMoves *moves,int k)
+{
+
+ //#pragma read_write_ports threat_counts.data combined 2
+ //#pragma internal_blockram threat_counts
+ //#pragma no_memory_analysis threat_counts
+
+ //#pragma read_write_ports b.data combined 2
+ #pragma internal_blockram b
+ #pragma internal_blockram bwrite
+ //#pragma read_write_ports b.data separate 1 readonly 2 writeonly
+ //#pragma no_memory_analysis b
+ /* This is the line of threats currently being processed */
+ Line line[board_size]={{1},{2}};
+ #pragma internal_fast line
+ //#pragma no_memory_analysis line
+ /* Running tally of threats for both players */
+ //static int threat_counts[MAX_CONNECT_K + 1][2];
+ threat_count_array threat_counts={{0}};
+ #pragma internal_fast threat_counts
+ //#pragma read_write_ports threat_counts.data combined 2
+ //#pragma no_memory_analysis threat_counts
+ if (k==1) board_copy(b, bwrite);
+ int i;
+ AIWEIGHT weight = 0;
+ ///* Clear threat tallys */
+ //for (i = 0; i < connect_k; i++) {
+ // threat_counts.data[i][0] = 1;
+ // threat_counts.data[i][1] = 1;
+ //}
+
+ /* Mark the maximum threat for each */
+ for (i = 0; x >= 0 && x < board_size && y >= 0 && y < board_size; i++) {
+ int count[2], tmp, double_threat = 1;
+ PIECE type[2];
+
+ count[0] = threat_window(x, y, dx, dy, type, &double_threat,bwrite);
+ count[1] = threat_window(x, y, -dx, -dy, type + 1,
+ &double_threat,bwrite);
+ if (count[1] > count[0]) {
+ tmp = count[1];
+ count[1] = count[0];
+ count[0] = tmp;
+ tmp = type[1];
+ type[1] = type[0];
+ type[0] = tmp;
+ }
+ line[i].threat[0] = 0;
+ line[i].threat[1] = 0;
+ threat_mark(i, count[0], type[0],bwrite,&line[0]);
+ if (double_threat)
+ threat_mark(i, count[1], type[1],bwrite,&line[0]);
+ x += dx;
+ y += dy;
+ }
+
+ /* Commit stored line values to the board */
+ x -= dx;
+ y -= dy;
+ for (i--; x >= 0 && x < board_size && y >= 0 && y < board_size; i--) {
+ AIWEIGHT bits[2];
+ PIECE p;
+
+ bits[0] = threat_bits(line[i].threat[0], line[i].turn[0],bwrite);
+ bits[1] = threat_bits(line[i].threat[1], line[i].turn[1],bwrite);
+ p = piece_at(bwrite, x, y);
+ if (piece_empty(p) && line[i].threat[0]) {
+ threat_counts.data[line[i].threat[0]][line[i].turn[0] - 1]++;
+ if (line[i].threat[1])
+ threat_counts.data[line[i].threat[1]]
+ [line[i].turn[1] - 1]++;
+ if (p >= PIECE_THREAT0)
+ place_threat(bwrite, x, y, p - PIECE_THREAT0 +
+ bits[0] + bits[1]);
+ else
+ place_threat(bwrite, x, y, bits[0] + bits[1]);
+ }
+ if (bwrite->turn != line[i].turn[0])
+ bits[0] = -bits[0];
+ if (bwrite->turn != line[i].turn[1])
+ bits[1] = -bits[1];
+ weight += bits[0] + bits[1];
+ x -= dx;
+ y -= dy;
+ }
+ return weight;
+}
+
+/*AIMoves*/int ai_threats(Board *board,AIMove *move)
+{
+ //#pragma read_write_ports board.data combined 2
+ #pragma internal_blockram board
+ //#pragma no_memory_analysis board
+
+ //#pragma internal_blockram move
+ //#pragma no_memory_analysis move
+
+ /////////* All threat functions work on this board */
+ /*static*/ Board b;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}} ;//= NULL;
+ //#pragma read_write_ports b.data combined 2
+ #pragma internal_blockram b
+ //#pragma read_write_ports b.data separate 1 readonly 2 writeonly
+ //#pragma no_memory_analysis b
+ /*static*/ Board bwrite;//={0,0,0,0,0,0,0,0,0,0,0,{{0}}} ;//= NULL;
+ //#pragma read_write_ports b.data combined 2
+ #pragma internal_blockram bwrite
+ //#pragma no_memory_analysis b
+ /*static*/ AIMoves moves;//={{0,0,0,{{0,0,0}}}};
+ //#pragma read_write_ports moves.data combined 3
+ #pragma internal_blockram moves
+ //#pragma no_memory_analysis moves
+
+ moves.len=0;
+ //AIMoves moves;
+ AIWEIGHT u_sum = 0;
+ int i;
+
+ //b = board_new();
+ //Board b;
+ board_copy(board, &b);
+
+ /* Clear threat tallys */
+ //for (i = 0; i < connect_k; i++) {
+ // threat_counts.data[i][0] = 0;
+ // threat_counts.data[i][1] = 0;
+ //}
+/*---------------------------------------------------------------------------*/
+ // /* Horizontal lines */
+ // for (i = 0; i < board_size; i++)
+ // u_sum += threat_line(0, i, 1, 0,&b);
+
+ // /* Vertical lines */
+ // for (i = 0; i < board_size; i++)
+ // u_sum += threat_line(i, 0, 0, 1,&b);
+
+ // /* SE diagonals */
+ // for (i = 0; i < board_size - connect_k + 1; i++)
+ // u_sum += threat_line(i, 0, 1, 1,&b);
+ // for (i = 1; i < board_size - connect_k + 1; i++)
+ // u_sum += threat_line(0, i, 1, 1,&b);
+
+ // /* SW diagonals */
+ // for (i = connect_k - 1; i < board_size; i++)
+ // u_sum += threat_line(i, 0, -1, 1,&b);
+ // for (i = 1; i < board_size - connect_k + 1; i++)
+ // u_sum += threat_line(board_size - 1, i, -1, 1,&b);
+/*---------------------------------------------------------------------------*/
+//rewritten for hardware
+/*---------------------------------------------------------------------------*/
+ int j;
+ int arg1,arg2,arg3,arg4,loop_bound,loop_begin;
+ int k=0;
+ for(j=0;j<6;j++){
+ switch(j){
+ case 0:
+ {
+ loop_begin=0;
+ loop_bound=board_size;
+ break;
+ }
+ case 1:
+ {
+ loop_begin=0;
+ loop_bound=board_size;
+ break;
+ }
+ case 2:
+ {
+ loop_begin=0;
+ loop_bound=board_size-connect_k+1;
+ break;
+ }
+ case 3:
+ {
+ loop_begin=1;
+ loop_bound=board_size-connect_k+1;
+ break;
+ }
+ case 4:
+ {
+ loop_begin=connect_k-1;
+ loop_bound=board_size;
+ break;
+ }
+ case 5:
+ {
+ loop_begin=1;
+ loop_bound=board_size-connect_k+1;
+ break;
+ }
+ default:{
+ break;
+ }
+ }
+ for (i = loop_begin; i < loop_bound; i++){
+ k++;
+ switch(j){
+ case 0:
+ {
+ arg1=0;
+ arg2=i;
+ arg3=1;
+ arg4=0;
+ break;
+ }
+ case 1:
+ {
+ arg1=i;
+ arg2=0;
+ arg3=0;
+ arg4=1;
+ break;
+ }
+ case 2:
+ {
+ arg1=i;
+ arg2=0;
+ arg3=1;
+ arg4=1;
+ break;
+ }
+ case 3:
+ {
+ arg1=0;
+ arg2=i;
+ arg3=1;
+ arg4=1;
+ break;
+ }
+ case 4:
+ {
+ arg1=i;
+ arg2=0;
+ arg3=-1;
+ arg4=1;
+ break;
+ }
+ case 5:
+ {
+ arg1=board_size-1;
+ arg2=i;
+ arg3=-1;
+ arg4=1;
+ break;
+ }
+ default:{
+ break;
+ }
+ }
+
+
+ u_sum += threat_line(arg1, arg2, arg3, arg4,&b,&bwrite,&moves,k);
+ }
+ }
+/*---------------------------------------------------------------------------*/
+ //board_copy(&b,&b_marks);
+ /*moves = */ ai_marks(&bwrite, PIECE_THREAT(1),&moves);
+ moves.utility = u_sum;
+ if (!aimoves_choose(&moves, move))
+ return 0;
+ else return 1;
+ //board_free(b);
+ //return moves;
+ //return 0;
+}
+
+//void debug_counts(void)
+//{
+// int i, sum = 0;
+//
+// if (!b)
+// return;
+//
+// g_debug("Threat counts (black, white):");
+// for (i = 1; i < connect_k; i++) {
+// g_debug("%d: %3d %3d", i, threat_counts[i][0],
+// threat_counts[i][1]);
+// sum += threat_counts[i][0] * threat_bits(i, b->turn) -
+// threat_counts[i][1] *
+// threat_bits(i, other_player(b->turn));
+// }
+// if (sum > 0)
+// g_debug("Threat sum: %d (10^%.2f)", sum, log10((double)sum));
+// else if (sum < 0)
+// g_debug("Threat sum: %d (-10^%.2f)", sum, log10((double)-sum));
+// else
+// g_debug("Threat sum: 0");
+//}
+
+//static int threat_number(int player, int threat,threat_count_array threat_counts)
+//{
+// return threat_counts.data[threat][player] / (connect_k - threat);
+//}
+
+//AIMoves *ai_priority(const Board *b)
+//{
+// AIMoves *moves;
+// int i, j, stage[2] = {1, 1}, mask, bits;
+//
+// moves = ai_threats(b);
+//
+// /* Do not prioritize if we've won */
+// if (threat_counts[connect_k - place_p + 1][b->turn - 1]) {
+// moves->utility = AIW_WIN;
+// return moves;
+// }
+//
+// /* Find the largest supported threat for each player */
+// for (i = 2; i < connect_k; i++) {
+// if (threat_number(0, i - 1) >= place_p &&
+// threat_number(0, i) > place_p)
+// stage[0] = i;
+// if (threat_number(1, i - 1) >= place_p &&
+// threat_number(1, i) > place_p)
+// stage[1] = i;
+// }
+//
+// //if (opt_debug_stage)
+// // g_debug("Stages %d/%d", stage[0], stage[1]);
+//
+// /* Do not prioritize if we're losing */
+// if (stage[b->turn - 1] <= stage[other_player(b->turn) - 1]) {
+// moves->utility = -stage[other_player(b->turn) - 1];
+// return moves;
+// }
+//
+// /* Threats above the player's stage are no more valuable than the
+// stage */
+// bits = 1 << (stage[b->turn - 1] * BITS_PER_THREAT);
+// mask = bits - 1;
+// for (i = 0; i < moves->len; i++) {
+// AIWEIGHT w = moves->data[i].weight, w2;
+//
+// if (w < AIW_THREAT_MAX && w >= bits) {
+// w2 = w & mask;
+// w = w & ~mask;
+// for (j = stage[b->turn - 1];
+// w && j < connect_k - place_p + 1; j++) {
+// w = w >> BITS_PER_THREAT;
+// w2 += w & mask;
+// }
+// moves->data[i].weight = w2;
+// }
+// }
+//
+// /* Stage determines weight */
+// moves->utility = stage[b->turn - 1];
+// return moves;
+//}
+/*AIMoves*/ void ai_marks(Board *b, PIECE minimum,AIMoves *moves)
+{
+ //#pragma read_write_ports b.data combined 2
+ #pragma internal_blockram b
+ //#pragma no_memory_analysis b
+ //AIMoves *moves = aimoves_new();
+ //AIMoves moves;
+ //AIMoves moves[361];
+ AIMove move;
+ PIECE p;
+ for (move.y = 0; move.y < board_size; move.y++)
+ for (move.x = 0; move.x < board_size; move.x++)
+ if ((p = piece_at(b, move.x, move.y)) >= minimum) {
+ move.weight = p - PIECE_THREAT0;
+ aimoves_set(moves, &move);
+ }
+ //return moves;
+}
+
+static gboolean is_adjacent( Board *b, BCOORD x, BCOORD y, int dist)
+{
+ int dx, dy, count;
+ #pragma bitsize dx 4
+ #pragma bitsize dy 4
+ PIECE p;
+
+ if (!piece_empty(piece_at(b, x, y)))
+ return FALSE;
+ for (dy = -1; dy < 2; dy++)
+ for (dx = -1; dx < 2; dx++) {
+ if (!dx && !dy)
+ continue;
+ count = count_pieces(b, x, y, PIECE_NONE, dx, dy, &p);
+ if (count - 1 < dist && p != PIECE_NONE)
+ return TRUE;
+ }
+ return FALSE;
+}
+/*AIMoves **/ void enum_adjacent(Board *b, int dist,AIMoves *moves,unsigned int current_random)
+{
+ //AIMoves *moves;
+ AIMove move;
+
+ move.weight = AIW_NONE;
+ //moves = aimoves_new();
+ for (move.y = 0; move.y < board_size; move.y++)
+ for (move.x = 0; move.x < board_size; move.x++)
+ if (is_adjacent(b, move.x, move.y, dist))
+ aimoves_append(moves, &move);
+ //aimoves_shuffle(moves,current_random);
+ //return moves;
+}
+/*AIMoves **/void ai_adjacent( Board *b, AIMove *move,unsigned int current_random)
+{
+ //#pragma read_write_ports board.data combined 2
+ #pragma internal_blockram b
+ //#pragma no_memory_analysis b
+
+ /*static*/ AIMoves moves;//={{0,0,0,{{0,0,0}}}};
+ //#pragma read_write_ports moves.data combined 3
+ #pragma internal_blockram moves
+ //#pragma no_memory_analysis moves
+ //#pragma read_write_ports moves.data combined 3
+ //#pragma internal_blockram moves
+ //#pragma no_memory_analysis moves
+ //AIMove move;
+ //AIMoves *moves;
+ moves.len=0;
+ /* Get all open tiles adjacent to any piece */
+ /*moves =*/ enum_adjacent(b, 1,&moves,current_random);
+ if (moves.len){
+ aimoves_choose(&moves, move);
+
+ return ;//moves;
+ }
+ /* Play in the middle if there are no open adjacent tiles */
+ move->x = board_size / 2;
+ move->y = board_size / 2;
+ move->weight = AIW_NONE;
+ //aimoves_append(&moves, move);
+ //aimoves_choose(&moves, move);
+ //return moves;
+}
synth_src/threats.cpp
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: synth_src/shared.h
===================================================================
--- synth_src/shared.h (nonexistent)
+++ synth_src/shared.h (revision 4)
@@ -0,0 +1,454 @@
+
+/*
+
+connectk -- a program to play the connect-k family of games
+Copyright (C) 2007 Michael Levin
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+/* Some definitions in case glib is not included */
+//#ifndef TRUE
+#define TRUE 1
+#define FALSE 0
+#define NULL ((void*)0)
+//#endif
+//#ifndef __G_TYPES_H__
+typedef unsigned int gboolean;
+#pragma bitsize gboolean 1
+typedef int gsize;
+//#endif
+
+
+/*
+ * Options
+ */
+
+/* These are boolean options the user can toggle through the "Options" menu.
+ Do not modify them directly as the "Options" menu will not reflect your
+ changes. You can add more options in connectk.c */
+extern int opt_pause_ai, /* Pause AI to inspect the board */
+// opt_det_ai, /* No randomness */
+ opt_print_u, /* Print utility after every move */
+ opt_debug_dfsc, /* Print out debug messages related to the DFS
+ cache */
+ opt_debug_thread, /* Print messages related to thread and mutex function */
+ opt_mark_log, /* Take log of weights before marking */
+ opt_mark_norm, /* Normalize to the largest weight */
+ opt_debug_stage, /* Debug priority stages */
+ opt_grayscale; /* Use grayscale rendering for print outs */
+
+/*
+ * Utility
+ */
+
+#ifdef _EFISTDARG_H_
+char *nvav(int *plen, const char *fmt, va_list va);
+#endif
+char *nva(int *plen, const char *fmt, ...);
+char *va(const char *fmt, ...);
+/* The va family of functions simplify string processing by allowing
+ printf-style substitution with any string-accepting function.
+
+ For example:
+ window_status(va("1 + 2 = %d", 1 + 2));
+
+ nva provides additional functionality by outputting the length of the
+ formatted string into the integer pointed to by plen. nvav accepts a variable
+ argument indirectly. */
+
+void window_status(const char *msg);
+/* Sets the status bar text of the main window */
+
+/*
+ * Allocation Chain
+ */
+
+typedef struct AllocChain {
+ gboolean free;
+ /* Is this object unallocated? */
+
+ unsigned int id;
+ /* Each object has a unique id */
+
+ struct AllocChain *next;
+ /* Next object in the chain */
+} AllocChain;
+
+typedef AllocChain *(*AllocFunc)(AllocChain *old_ac);
+
+AllocChain *achain_new(AllocChain **root, AllocFunc af);
+void achain_free(AllocChain *ac);
+void achain_copy(const AllocChain *src, AllocChain *dest, gsize mem);
+
+/*
+ * Game state
+ */
+
+/* We limit the maximum values of these variables; note that these are not
+ arbitrary limits and should be modified with care */
+#define MAX_BOARD_SIZE 59
+#define MAX_CONNECT_K 12
+#define MAX_PLACE_P 12
+#define MAX_START_Q 6
+#define MAX_DEPTH 9
+#define MAX_BRANCH 32
+
+
+#define board_size 19
+#define board_stride 21
+#define move_no 0
+#define move_last 0
+#define connect_k 6
+#define place_p 2
+#define start_q 1
+#define opt_det_ai 1
+//extern int board_size, board_stride, move_no, connect_k, place_p, start_q;
+/* Board size (for all boards), moves in the game, connect_k to win, place_p
+ moves at a time, black has start_q moves on the first move; do NOT modify
+ these directly! */
+
+enum {
+ PIECE_ERROR = -1,
+ /* Error pieces form a one tile deep border around the board */
+
+ PIECE_NONE = 0,
+ PIECE_BLACK,
+ PIECE_WHITE,
+ /* Empty and played pieces */
+
+ PIECES,
+ /* Total number of normal pieces (2) */
+
+ PIECE_SEARCHED,
+ PIECE_SEARCHED_MAX = PIECE_SEARCHED + MAX_DEPTH,
+ /* Markers used by the search system */
+
+ PIECE_THREAT0,
+ PIECE_MARKER = PIECE_THREAT0,
+ /* These threat markers are usable by the AIs */
+};
+typedef int PIECE;
+//#pragma bitsize PIECE 16
+
+#define MAX_THREAT (INT_MAX - PIECE_THREAT0)
+/* Highest value a threat marker can have */
+
+#define PIECE_THREAT(n) (PIECE_THREAT0 + (n))
+/* This marker represents a threat n-turns (of that player) away */
+
+#define piece_empty(p) ((p) == PIECE_NONE || (p) >= PIECES)
+/* Checks if a piece is an empty or a marker */
+
+typedef unsigned int PLAYER;
+/* Type for AIs, this is the index of the AI entry in ai.c */
+
+typedef int BCOORD;
+#pragma bitsize BCOORD 8
+/* Type for board coordinates */
+
+typedef struct Board {
+ int ac;
+ /* Allocation chain must be the first member */
+ #pragma bitsize ac 4
+ unsigned int moves_left;
+ /* How many moves the current player has left */
+ #pragma bitsize moves_left 8
+
+ //struct Board *parent; //not synthesizable
+ int parent;
+ /* The board preceeding this one in history */
+ #pragma bitsize parent 4
+
+ gboolean won;
+ BCOORD win_x1, win_y1, win_x2, win_y2;
+ /* On won boards, used to indicate where the winning line is */
+
+ PIECE turn;
+ /* Whose turn it is on this board */
+
+ BCOORD move_x, move_y;
+ /* The move to the next Board in history */
+
+ PIECE data[board_stride][board_stride];
+} Board;
+/* The board structure represents the state of the game board. Do NOT preserve
+ board pointers across games. */
+
+extern AllocChain *board_root;
+extern gsize board_mem;
+/* Variables for the allocation chain */
+
+//extern Board board;
+/* This is the current board. Do NOT modify it, that's cheating. :) */
+const char *bcoords_to_string(BCOORD x, BCOORD y);
+const char *bcoord_to_alpha(BCOORD c);
+/* Return a static string representing a board coordinate pair */
+
+void string_to_bcoords(const char *string, BCOORD *x, BCOORD *y);
+/* Attempts to convert a string to board coordinates */
+
+void new_game(Board *board,unsigned int size);
+
+AllocChain *board_alloc(AllocChain *data);
+#define board_new() ((Board*)achain_new(&board_root, board_alloc))
+#define board_free(b) achain_free((AllocChain*)b)
+/* Boards are dynamically allocated and must be free'd */
+
+//#define board_copy(from, to) achain_copy((AllocChain*)from, (AllocChain*)to,\
+ board_mem)
+void board_copy(const Board *from, Board *to);
+/* Overwrite one board with another */
+
+void board_clean(Board *b);
+/* Remove all threat markers from a board */
+
+int threat_count(const Board *b, PIECE player);
+/* Gives the number of threats on a board for the current player */
+
+Board *board_at(unsigned int move);
+/* Returns a static pointer to a board in the history at move */
+
+//int count_pieces(const Board *b, BCOORD x, BCOORD y, PIECE type,
+int count_pieces(const Board *b, BCOORD x, BCOORD y, PIECE type,
+ int dx, int dy, PIECE *out);
+/* Count consecutive pieces of type starting from (x, y) in the direction given
+ by (dx, dy); includes (x, y) itself in the count and outputs the final
+ piece to out if it is not NULL */
+
+gboolean check_win_full(const Board *b, BCOORD x, BCOORD y,
+ BCOORD *x1, BCOORD *y1, BCOORD *x2, BCOORD *y2);
+#define check_win(b, x, y) check_win_full(b, x, y, 0, 0, 0, 0)
+/* Returns non-zero if placing a piece of type at (x, y) on the current board
+ will result in a win for that player. The start and end coordinates of the
+ winning line will be placed in (x1, y1) and (x2, y2). */
+
+static inline PIECE piece_at(const Board *b, BCOORD x, BCOORD y)
+{
+ //return b->data[(y + 1) * board_stride + x + 1];
+ return b->data[y+1][x+1];
+}
+/* Returns the piece at (x, y) on board b. If the coordinates are out of range,
+ this function will return PIECE_ERROR. */
+
+char piece_to_char(PIECE piece);
+/* Returns a one character representation of a piece (e.g. 'W', 'B', etc) */
+
+const char *piece_to_string(PIECE piece);
+/* Returns a static string representation of a piece (e.g. "White" etc) */
+
+static inline void place_piece_type(Board *b, BCOORD x, BCOORD y, PIECE type)
+{
+ //b->data[(y + 1) * board_stride + x + 1] = type;
+ b->data[y+1][x+1]=type;
+}
+#define place_piece(b, x, y) place_piece_type(b, x, y, (b)->turn)
+#define place_threat(b, x, y, n) place_piece_type(b, x, y, PIECE_THREAT(n))
+/* Places a piece on board b, overwriting any piece that was previously in that
+ place */
+
+#define other_player(p) ((p) == PIECE_BLACK ? PIECE_WHITE : PIECE_BLACK)
+/* Invert a player piece */
+
+/*
+ * Move arrays
+ */
+
+/* Some guideline values for move weights: */
+#define AIW_MAX INT_MAX /* largest weight value */
+#define AIW_MIN INT_MIN /* smallest weight value */
+#define AIW_WIN AIW_MAX /* this move wins the game */
+#define AIW_DEFEND (AIW_WIN - 2) /* defends from an opponent win */
+#define AIW_NONE 0 /* does nothing */
+#define AIW_DRAW AIW_NONE /* draw game */
+#define AIW_LOSE (-AIW_WIN) /* this move loses the game */
+#define AIW_THREAT_MAX 262144 /* value of an immediate threat */
+
+typedef int AIWEIGHT;
+/* Type for AI move weights (utilities) */
+#pragma bitsize AIWEIGHT 32
+
+typedef struct {
+ AIWEIGHT weight;
+ BCOORD x, y;
+} AIMove;
+/* AIs return an array filled with these */
+
+typedef struct AIMoves {
+ int ac;
+ /* Allocation chain must be the first member */
+ #pragma bitsize ac 4
+
+ unsigned int len;
+ /* Number of members in data */
+ #pragma bitsize len 8
+
+ AIWEIGHT utility;
+ /* A composite utility value set by some AIs when producing a moves
+ list */
+
+ AIMove data[361];
+ /* Array of AIMove structures */
+} AIMoves;
+/* An array type for holding move lists */
+
+AllocChain *aimoves_alloc(AllocChain *data);
+#define aimoves_new() ((AIMoves*)achain_new(&aimoves_root, aimoves_alloc))
+//#define aimoves_free(m) achain_free((AllocChain*)(m))
+static inline void aimoves_free(AIMoves *m) {
+ m->len=0;
+}
+///////////* Move arrays are dynamically allocated and must be free'd */
+//////////
+//////////#define aimoves_copy(from, to) achain_copy((AllocChain*)(from),\
+////////// (AllocChain*)(to), aimoves_mem)
+///////////* Overwrite one array with another */
+//////////
+//////////void aimoves_add(AIMoves *moves, const AIMove *aim);
+///////////* Add an AIMove to an AIMoves array; move weights will be added to existing
+////////// weights */
+//////////
+void aimoves_append(AIMoves *moves, const AIMove *aim);
+#define aimoves_set aimoves_append
+///////////* Add an AIMove to an AIMoves array; existing moves weights will be
+////////// overwritten */
+//////////
+int aimoves_choose(AIMoves *moves, AIMove *move);
+/* Will choose one of the best moves from a GArray of AIMove structures at
+ random. Returns non-zero if a move was chosen or zero if a move could not
+ be chosen for some reason. */
+//////////
+int aimoves_compare(const void *a, const void *b);
+/* A comparison function for sorting move lists by weight */
+//////////
+//////////void aimoves_crop(AIMoves *moves, unsigned int n);
+///////////* Reduce a moves list to the top-n by weight */
+//////////
+//////////void aimoves_concat(AIMoves *m1, const AIMoves *m2);
+///////////* Concatenates m2 to m1 without checking for duplicates */
+//////////
+//////////AIMoves *aimoves_dup(const AIMoves *moves);
+///////////* Duplicate a GArray of moves */
+//////////
+int aimoves_find(const AIMoves *moves, BCOORD x, BCOORD y);
+///////////* Returns the index of (x, y) if it is in moves or -1 otherwise */
+//////////
+//////////void aimoves_range(AIMoves *moves, AIWEIGHT *min, AIWEIGHT *max);
+///////////* Find the smallest and largest weight in the move array */
+//////////
+//////////void aimoves_merge(AIMoves *m1, const AIMoves *m2);
+///////////* Merges m2 into m1, the highest weight is used for duplicates */
+//////////
+//////////void aimoves_print(const AIMoves *moves);
+///////////* Prints out an array of moves */
+//////////
+//////////void aimoves_remove(AIMoves *moves, BCOORD x, BCOORD y);
+///////////* Remove an AIMove from a GArray of AIMoves */
+//////////
+//////////void aimoves_remove_index_fast(AIMoves *moves, int i);
+///////////* Remove a move from the list by overwriting it by the last move and
+////////// decrementing the length */
+//////////
+void aimoves_shuffle(AIMoves *moves,unsigned int current_random);
+/* Shuffle a list of moves */
+
+void aimoves_sort(AIMoves *moves);
+/* Sort a list of moves by descending weight */
+
+//////////void aimoves_subtract(AIMoves *m1, const AIMoves *m2);
+///////////* Subtracts members of m2 from m1; O(n^2) */
+//////////
+extern AllocChain *aimoves_root;
+//////////extern gsize aimoves_mem;
+///////////* Allocation chain variables */
+//////////
+//////////const char *aiw_to_string(AIWEIGHT w);
+///////////* Convert a weight to a string representation */
+//////////
+//////////char *aimove_to_string(const AIMove *move);
+///////////* Convert a move to a string representation */
+//////////
+///////////*
+////////// * AI helper functions
+////////// */
+//////////
+//////////extern int ai_stop;
+///////////* If this variable is non-zero, the system is trying to stop the AI thread
+////////// and your AI should exit. Do not set this yourself. */
+//////////
+//////////typedef AIMoves *(*AIFunc)(const Board *b);
+///////////* AIs are defined as functions that output an unsorted, weighted list of board
+////////// coordinates for an arbitrary board. To create an AI in a file other than
+////////// ai.c, add a prototype of the function here and in ai.c. */
+//////////
+//////////AIMoves *enum_top_n(const Board *b, int n);
+///////////* Returns an array containing the top n moves according to the utility
+////////// function */
+//////////
+/*AIMoves **/ void enum_adjacent(Board *b, int dist,AIMoves *moves,unsigned int current_random);
+/* Enumerate empty tiles at most dist away from some other piece on the board */
+
+/*AIMoves **/void ai_marks(Board *b, PIECE min,AIMoves *moves);
+/* Fills a moves list with tiles marked at least PIECE_THREAT(min) */
+
+/*
+ * AI
+ */
+
+/* This table holds the information about all of the AIs in the program. Each
+ has a short and long description. The short description will be used for
+ the command line interface and the long description appears in the UI menu.
+ Each AI has an associated AIFunc which outputs a move for the current
+ board. */
+///////////typedef struct AI {
+/////////// char *s_desc, *l_desc;
+/////////// AIFunc func;
+///////////} AI;
+///////////
+///////////AIMoves *ai_sequences(const Board *b);
+////////////* The square of the number of pieces in a window */
+///////////
+///////////AIMoves *ai_mesh(const Board *b);
+////////////* The board as a mesh weighed down by the pieces */
+///////////
+///////////AIMoves *ai_monte_carlo(const Board *b);
+////////////* Chooses the best move based on which one wins the most random games */
+///////////
+///////////AIMoves *ai_random(const Board *b);
+////////////* Plays in a random tile */
+///////////
+/*AIMoves */ void ai_adjacent(Board *b,AIMove *move,unsigned int current_random);
+/* Plays in a random tile adjacent to any piece on the board */
+
+///////////AIMoves *ai_windows(const Board *b);
+////////////* Plays in the best defensive position */
+///////////
+///////////AIMoves *ai_utility(const Board *b);
+///////////AIMoves *ai_dfs_utility(const Board *b);
+////////////* Utility function */
+///////////
+/*AIMoves **/int ai_threats(Board *board,AIMove *move);
+AIMoves *ai_priority(const Board *b);
+/* Multi-level threats */
+
+
+
+void my_srandom(int seed,unsigned int *current_random);
+int my_irand(int imax,unsigned int current_random);
+//void backup_move(Board *board, AIMoves *moves,AIMove *move);
+AIWEIGHT threat_line(int x, int y, int dx, int dy,Board *b,Board *bwrite,AIMoves *moves,int k);
+int threat_window(int x, int y, int dx, int dy,
+ PIECE *ptype, int *pdouble,Board *b);
+int connect6ai_synth(int firstmove,char movein[8], char colour, char moveout[8]);
synth_src/shared.h
Property changes :
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: synth_src/main.cpp.base
===================================================================
--- synth_src/main.cpp.base (nonexistent)
+++ synth_src/main.cpp.base (revision 4)
@@ -0,0 +1,276 @@
+/* main.cpp
+ June 9,2011
+
+ Software connect6 AI program.
+ Have your board polling for its colour before starting this program.
+
+ commandline option:
+ -port
+ Ex: "./connect6 -port /dev/ttyUSB0"
+
+ By: Kevin Nam
+*/
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "util.h"
+#include "connect6.h"
+#include "connect6_synth.h"
+//#include "pico.h"
+//#include "shared.h"
+
+// The AI has as much time as it wants, but moves after 1 second. Default is to wait 2 seconds
+#define AI_WAIT_TIME 0.1
+
+// FPGA has 1 second to make its move
+#define MOVE_TIME_LIMIT 0.1
+
+using namespace std;
+
+// commandline option: -port
+int main(int argc, char **argv){
+ //for verification two runs and a reference board
+ int i,j,k;
+ char ref_board[19][19] = {{ 0 }};
+
+ char board[19][19] = {{ 0 }};
+ char move[4];
+ char moveport[8]={0};
+ char moveportout[8]={0};
+ int movecount=0;
+ int y,x;
+ char winning_colour;
+
+ // Get the serial port
+ //int port = select_com_port(argc,argv);
+ // Get software AI's colour
+ char AI_colour = select_AI_colour(argc,argv);
+ char FPGA_colour;
+ //int id = PICO_initialize_PPA(\TCAB_NAME);
+ // Take care of the first few moves (including sending the colour)
+ if (AI_colour == 'D'){
+ FPGA_colour = 'L';
+ //write(port, "L",1);
+
+ wait(AI_WAIT_TIME);
+
+ // AI makes a move
+ connect6ai(board,AI_colour,move);
+ movecount++;
+ cout<<"AI MOVE: "<
+#include
+#include
+#include
+#include
+#include
+#include "util.h"
+
+#define IA 1103515245u
+#define IC 12345u
+#define IM 2147483648u
+
+using namespace std;
+
+static unsigned int current_random = 0;
+
+
+char select_AI_colour (int argc, char **argv){
+ char ai_colour;
+ int i;
+ //cout<<"Please enter referee AI's colour. L or D"<> ai_colour;
+ for(i=0;i> ai_colour;
+ }
+
+ cout<<"AI is playing as "<> com_port;
+ }
+
+
+ port = open(com_port.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
+ while(port < 0) // if open is unsucessful keep trying until the user specifies a good port
+ {
+ cout << "Unable to open port " << com_port << ", try again, should be: (windows) /dev/comx or (linux) /dev/ttyx ?\n";
+ cin >> com_port;
+ port = open(com_port.c_str(), O_RDWR | O_NOCTTY | O_NONBLOCK);
+ }
+ setup_port(port);
+
+ cout << "COM port has been set up at a baud rate of 115200\n";
+ return port;
+}
+
+void setup_port(int fd) {
+ struct termios options;
+ fcntl(fd, F_SETFL, 0);
+ tcgetattr(fd, &options);
+ cfsetispeed(&options, B115200);
+ cfsetospeed(&options, B115200);
+ options.c_cflag |= (CLOCAL | CREAD);
+ tcsetattr(fd, TCSANOW, &options);
+
+ // set up non-blocking port, so that we can time out
+ int opts;
+ opts = fcntl(fd,F_GETFL);
+ if (opts < 0) {
+ perror("fcntl(F_GETFL)");
+ exit(EXIT_FAILURE);
+ }
+ opts = (opts | O_NONBLOCK);
+ if (fcntl(fd,F_SETFL,opts) < 0) {
+ perror("fcntl(F_SETFL)");
+ exit(EXIT_FAILURE);
+ }
+ return;
+}
+
+int char_to_int (char c){
+ if (c == '0') return 0;
+ else if (c == '1') return 1;
+ else if (c == '2') return 2;
+ else if (c == '3') return 3;
+ else if (c == '4') return 4;
+ else if (c == '5') return 5;
+ else if (c == '6') return 6;
+ else if (c == '7') return 7;
+ else if (c == '8') return 8;
+ else if (c == '9') return 9;
+
+ return 0;
+}
+
+void wait(double seconds){
+ timeval tim;
+ gettimeofday(&tim, NULL);
+ double t1=tim.tv_sec+(tim.tv_usec/1000000.0);
+ while (1){
+ gettimeofday(&tim, NULL);
+ double t2=tim.tv_sec+(tim.tv_usec/1000000.0);
+ if (t2-t1 >= seconds)
+ break;
+ }
+}
+
Index: Makefile
===================================================================
--- Makefile (nonexistent)
+++ Makefile (revision 4)
@@ -0,0 +1,97 @@
+GCC=g++
+
+SCC=schroot -c centos5-i386 ~/bin/synphonycc_fpga
+SCC_SCRIPTS=./scc_scripts
+SYNTH_SRC=./synth_src
+
+
+
+
+
+all: fpt_connect6 test_golden
+
+fpt_connect6: ${SYNTH_SRC}/main.cpp util.o connect6.o connect6_synth.o state.o threats.o
+ ${GCC} -o connect6 ${SYNTH_SRC}/main.cpp util.o connect6.o connect6_synth.o state.o threats.o -lpthread -lm -g -pg
+
+connect6_synth.o: ${SYNTH_SRC}/connect6_synth.cpp ${SYNTH_SRC}/connect6_synth.h
+ ${GCC} -c -g -pg ${SYNTH_SRC}/connect6_synth.cpp
+connect6.o: ${SYNTH_SRC}/connect6.cpp ${SYNTH_SRC}/connect6.h
+ ${GCC} -c -g -pg ${SYNTH_SRC}/connect6.cpp
+
+util.o: ${SYNTH_SRC}/util.cpp ${SYNTH_SRC}/util.h
+ ${GCC} -c -g -pg ${SYNTH_SRC}/util.cpp
+state.o:${SYNTH_SRC}/state.cpp ${SYNTH_SRC}/shared.h
+ ${GCC} -c -g -pg ${SYNTH_SRC}/state.cpp
+
+threats.o:${SYNTH_SRC}/threats.cpp ${SYNTH_SRC}/shared.h
+ ${GCC} -c -g -pg ${SYNTH_SRC}/threats.cpp
+
+
+test_golden:
+ ./connect6 -player L
+
+clean:
+ rm -f *.o connect6 gmon.out myboard.txt
+
+
+
+
+#first the c/c++ source should be compiled
+fpga: synth altera_synth test
+ cp cp ./rtl_package/synth/altera_fpga/run/DE2.sof ../DEMO
+
+synth: all imp_connect
+imp_window:
+ #sed -s 's/\\TCAB_NAME/threat_window/g' main.cpp.base >main.cpp
+ cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_window.tcl
+imp_line: imp_window
+ #sed -s 's/\\TCAB_NAME/threat_line/g' main.cpp.base >main.cpp
+ cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_line.tcl
+imp_marks:
+ #sed -s 's/\\TCAB_NAME/ai_mraks/g' main.cpp.base >main.cpp
+ cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_marks.tcl
+imp_threat: imp_line imp_marks
+ #sed -s 's/\\TCAB_NAME/ai_threats/g' main.cpp.base >main.cpp
+ cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_threat.tcl
+imp_adjacent:
+ cp ${SYNTH_SRC}/main.cpp.base ${SYNTH_SRC}/main.cpp
+ #sed -s 's/\\TCAB_NAME/ai_adjacent/g' main.cpp.base >main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_adjacent.tcl
+imp_connect: imp_threat imp_adjacent
+ sed -s 's/\\TCAB_NAME/connect6ai_synth/g' ${SYNTH_SRC}/main.cpp.base >${SYNTH_SRC}/main.cpp
+ ${SCC} ${SCC_SCRIPTS}/run_imp_connect.tcl
+
+altera_synth:
+ cp -r ./imp_connect/rtl_package/ ./
+ cp DE2/do_synth ./rtl_package/synth/altera_fpga/
+ cp DE2/quartus.tcl ./rtl_package/synth/altera_fpga/
+ cp DE2/constraints.sdc ./rtl_package/synth/altera_fpga/
+ echo -e 'all:\n\t./do_synth' > ./rtl_package/synth/altera_fpga/makefile
+ make -C ./rtl_package/synth/altera_fpga/
+
+test:
+ ../scripts/serial_port_setup.sh
+ rm -f ./test.result
+ for i in `seq 1 100` ; do ../connect6 -port /dev/ttyS0 -player L >> test.result 2>&1; done
+ #grep "FPGA has won" ./test.result | wc -l
+ #grep "AI has won" ./test.result | wc -l
+ #grep "TIE" ./test.result | wc -l
+ python ../scripts/esult.py
+pgm:
+ cp ./rtl_package/synth/altera_fpga/run/DE2.sof ./
+ quartus_pgm -c USB-Blaster -m jtag -o "p;DE2.sof"
+
+
+prof:
+ valgrind --tool=callgrind ./connect6 -player L
+ kcachegrind
+
+altera_clean:
+ rm -rf ./rtl_package/
+
+ultraclean: altera_clean
+ rm -rf imp_line imp_marks imp_threat imp_choose imp_adjacent imp_connect imp_window Logs