-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVSimTop.bs
37 lines (33 loc) · 1020 Bytes
/
VSimTop.bs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package VSimTop where
import ChessState
import MoveUpdate
import SearchCore
import ShallowSearchCores
import CShow
import GetPut
import ClientServer
searchDepth :: Depth
searchDepth = 3
{-# verilog sysChessVSim #-}
sysChessVSim :: Module Empty
sysChessVSim = module
searchCore <- mkShallowParallelSearchCore
moveUpdate <- mkMoveUpdate
state <- mkReg initialState
init <- mkReg False
rules
"init": when not init ==> do
$display (cshow state)
searchCore.server.request.put $ defaultValue {rid=0; state=state; depth=searchDepth;}
init := True
"get_result": when init ==> do
result <- searchCore.server.response.get
$display (cshow result)
case result.bestMove of
Just m -> moveUpdate.enq state m
Nothing -> $finish
"put_query": when init ==> do
$display moveUpdate.nextState
state := moveUpdate.nextState
searchCore.server.request.put $ defaultValue {rid=0; state=moveUpdate.nextState; depth=searchDepth;}
moveUpdate.deq