Professional Documents
Culture Documents
A Tsume-Shogi Processor Based On Reconfigurable Hardware: Yohei Hori, Tsutomu Maruyama and Kenji Toda
A Tsume-Shogi Processor Based On Reconfigurable Hardware: Yohei Hori, Tsutomu Maruyama and Kenji Toda
1
2 Hardware Algorithms AT’s turn,
checkmated,
depth neq 1 BMB
BMG hit STP
hash tab.
The main ideas for fast move generation and size re- AT’s no DF’s turn, WMB
DF’s any
turn MV checkmated
duction of hardware are parallel computation of different turn MV
types of moves and parallel/pipeline processing with the 9- INI UDP EXP
eval.
NMV FCK
AT’s turn, checkmated, depth=1
FIN
>= TH.
square architecture. This section briefly explains the hard- DF, checkmated
AT’s eval.
ware algorithms to generate check/defense moves and to DF’s
turn < TH.
WNM
turn AT, no checkmate,
search the game tree. no
unexpanded
MV DF, checkmate found, TH. = BNB
WMG unexpanded Sup.
AT’s turn, BNM
no checkmate TH. <
2.1 Check/Defense Move Generation NXT Sup. BNS
cessed in pipeline, the computation of shogi with 9-square Indirect Mask Indirect Cover Direct Mask Black Direct Cover White Direct
Cover
btm_brd_data
top_brd_data
wh_pawn
brd_valid
wh_hand
brd_stop
mv_valid
brd_rqst
bl_pawn
mv_end
bl_hand
Table 1. The data structure of Hash Table.
player
wk_x
wk_y
mv
name width (bit) explanation Controller Evaluation (PN)
Data Flag 1 Occupancy (stored/empty).
Move Stack Move Data
Evaluation 8 Evaluation of the position. Data
Depth 11 Depth of the mate-found node. Position Hash Code Position
Move Stack
Compressed Pos. 88 Prevents malfunction caused by Updator Generator Evaluator
top_brd_data
Code
wh_hand
bl_hand
kinds of data are stored to Move Stack. One is Move Data External RAM Position Stack
Hash Code
Hash Table
Stack
sent from Check/Defense Move Generator. Move data are
stored to Move Stack with information about depth of the
node and mate flag. The other is information to control tree Figure 3. The structure of Tree Search Circuit.
search. After the move generation in some position fin-
ished, information about the number of generated moves,
the upper limit of the threshold in the iterative deepening Table 2. The implementation result of each
and address of previous move is stored to the Move Stack. module.
Module Slice Block RAM Freq. [MHz]
Check Move 11,977 (36%) 66 (20%) 112.108
3.1.2 Hash Table In iterative deepening, the same node Defense Move 7,147 (21%) 25 (8%) 93.879
may be evaluated and expanded many times. To avoid the Tree Search 1,080 (3%) 43 (13%) 140.262
idle evaluation of the node, hash table is used in our cir- TOTAL 20,204 (61%) 134 (41%) 93.879
cuit. Data stored to Hash Table are evaluation of the node,
the depth of mate-found node and compressed board data. (33,088 slices, 328 Block RAMs), 18MB DDR2-SSRAM
Compressed board data are referred when the hash colli- and up to 2GB DDR-SDRAM.
sion occurred. When the compressed code of the current Below we show the result of the implementation of
position is different from the stored code and the evaluation modules in Table 2. Table 2 shows that the imple-
of the current position is smaller than stored value, stored mented modules totally use 41% of slices and 61% of
hash code is overwritten with the current one. In addition, Block RAMs, and the whole circuit works at 93.879 MHz.
exceptional operation is done when the stored position is a Figure 4 describes the timing chart of the tsume-shogi
mate-found node. A mate-found node is not overwritten to solver. Figure 4 shows that required clock cycles for move
speed up tree search. generation is 54 + N . N is the number of valid moves by
Hash Table is a 1 M x 108 bit of external memory. Ta- the attacker or the defender in a position. In all modules,
ble 1 shows the structure of Hash Table. If more memory required clock cycles except N is always constant and does
resource is available, larger hash table is preferable to avoid not depend on the number of moves to be generated.
hash collision.
clock 1 11 22 33 35 54+N
Figure 3 shows the structure of Tree Search Circuit. BlackDirectCv scan (11) or (11)
Board Stack is a memory where board data are stored. BlackIndirectCover scan (11) or (11)
The stored data are used to avoid re-calculating board data DirectMask scan (11) or (11)
DiffensiveCapture (6)
Blockade (11)