step by step - building the rule
This commit is contained in:
parent
b4c7537a85
commit
f6d44f1277
38
bs/Bus.bs
38
bs/Bus.bs
|
@ -10,12 +10,18 @@ import Arbiter
|
||||||
clientRequest :: Arbiter.ArbiterClient_IFC -> Action
|
clientRequest :: Arbiter.ArbiterClient_IFC -> Action
|
||||||
clientRequest ifc = ifc.request
|
clientRequest ifc = ifc.request
|
||||||
|
|
||||||
mkBus :: Vector numClients (BusClient inFlightTransactions)
|
busRequestToAddr :: BusRequest -> Addr
|
||||||
|
busRequestToAddr req = case req of
|
||||||
|
BusReadRequest (ReadRequest addr _) -> addr
|
||||||
|
WriteReadRequest (WriteRequest addr _) -> addr
|
||||||
|
|
||||||
|
mkBus :: (Addr -> Integer)
|
||||||
|
-> Vector numClients (BusClient inFlightTransactions)
|
||||||
-> Vector numServers (BusServer inFlightTransactions numClients)
|
-> Vector numServers (BusServer inFlightTransactions numClients)
|
||||||
-> Module Empty
|
-> Module Empty
|
||||||
mkBus clientVec serverVec = do
|
mkBus addrToServerTranslation clientVec serverVec = do
|
||||||
tagEngineByClient :: Vector numClients (TagEngine inFlightTransactions)
|
tagEngineByClientVec :: Vector numClients (TagEngine inFlightTransactions)
|
||||||
tagEngineByClient <- replicateM mkTagEngine
|
tagEngineByClientVec <- replicateM mkTagEngine
|
||||||
|
|
||||||
arbiterByServer :: Vector numServers (Arbiter_IFC numClients)
|
arbiterByServer :: Vector numServers (Arbiter_IFC numClients)
|
||||||
arbiterByServer <- replicateM (mkArbiter False)
|
arbiterByServer <- replicateM (mkArbiter False)
|
||||||
|
@ -23,7 +29,27 @@ mkBus clientVec serverVec = do
|
||||||
addRules |>
|
addRules |>
|
||||||
rules
|
rules
|
||||||
"placeholder rule": when True ==> do
|
"placeholder rule": when True ==> do
|
||||||
let selectedArbiter = (select arbiterByServer 0)
|
let selectedServerArbiter = (select arbiterByServer 0)
|
||||||
mapM_ clientRequest selectedArbiter.clients
|
mapM_ clientRequest selectedServerArbiter.clients
|
||||||
|
|
||||||
|
"connect request client 0": when True ==> do
|
||||||
|
let
|
||||||
|
clientIdx :: Integer = 0
|
||||||
|
selectedClient ::(BusClient inFlightTransactions)
|
||||||
|
selectedClient = (select clientVec clientIdx)
|
||||||
|
selectedTagEngine = (select tagEngineByClientVec clientIdx)
|
||||||
|
|
||||||
|
tag <- selectedTagEngine.requestTag
|
||||||
|
|
||||||
|
busRequest :: BusRequest
|
||||||
|
busRequest <- selectedClient.dequeueRequest tag
|
||||||
|
|
||||||
|
let
|
||||||
|
addr = busRequestToAddr busRequest
|
||||||
|
targetServerIdx = addrToServerTranslation addr
|
||||||
|
targetServer = (select serverVec targetServerIdx)
|
||||||
|
|
||||||
|
-- targetServer
|
||||||
|
action {}
|
||||||
|
|
||||||
return $ interface Empty { }
|
return $ interface Empty { }
|
||||||
|
|
Loading…
Reference in a new issue