potential scaffolding for new approach
This commit is contained in:
parent
180eeeefbe
commit
f3acae0c1c
26
bs/Bus.bs
26
bs/Bus.bs
|
@ -25,11 +25,6 @@ dummyRule =
|
|||
"test rule": when True ==> do
|
||||
$display "test rule"
|
||||
|
||||
data DispatchFromClient inFlightTransactions numServers
|
||||
= DispatchRequest (TaggedBusRequest inFlightTransactions) (MkServerIdx numServers)
|
||||
| BypassResponse (TaggedBusResponse inFlightTransactions)
|
||||
deriving (Bits, Eq, FShow)
|
||||
|
||||
-- we need a way to make serverMap safer...
|
||||
mkBus :: (Addr -> Maybe (MkServerIdx numServers))
|
||||
-> Module (Bus inFlightTransactions numClients numServers)
|
||||
|
@ -48,13 +43,6 @@ mkBus serverMap = do
|
|||
responseArbiterByClient :: Vector numClients (Arbiter.Arbiter_IFC (TAdd numServers 1))
|
||||
responseArbiterByClient <- replicateM (mkArbiter False)
|
||||
|
||||
-- After we inspect the head/oldest request in the `clientRequestQueues` and perform an
|
||||
-- arbiter request to the destination arbiter, we need to inspect for grant in another
|
||||
-- rule as I don't believe grant and request can be called simultaneously.
|
||||
-- The following vector allows us to move
|
||||
dispatchByClient :: Vector numClients (Wire (DispatchFromClient inFlightTransactions numServers))
|
||||
dispatchByClient <- replicateM mkWire
|
||||
|
||||
-- There are `numServer` servers, each of which needs its own arbiter as
|
||||
-- there are up to `numClient` clients that may wish to submit a response
|
||||
-- to a given server.
|
||||
|
@ -87,17 +75,13 @@ mkBus serverMap = do
|
|||
selectedClientRequestQueue = (select clientRequestQueues clientIdx)
|
||||
in
|
||||
rules
|
||||
(sprintf "dispatch client request %d" clientIdx): when True ==> do
|
||||
(sprintf "client[%d] route request" clientIdx): when True ==> do
|
||||
let
|
||||
clientRequest :: TaggedBusRequest inFlightTransactions
|
||||
clientRequest = selectedClientRequestQueue.first
|
||||
|
||||
targetAddr :: Addr = busRequestToAddr |> clientRequest.busRequest
|
||||
targetServerIdx :: (Maybe (MkServerIdx numServers)) = serverMap targetAddr
|
||||
|
||||
dispatchByClientWire :: Wire (DispatchFromClient inFlightTransactions numServers)
|
||||
dispatchByClientWire = (select dispatchByClient clientIdx)
|
||||
|
||||
case targetServerIdx of
|
||||
Just serverIdx -> do
|
||||
let
|
||||
|
@ -106,7 +90,6 @@ mkBus serverMap = do
|
|||
arbiterClientSlot :: Arbiter.ArbiterClient_IFC
|
||||
arbiterClientSlot = (select targetServerArbiter.clients clientIdx)
|
||||
arbiterClientSlot.request
|
||||
dispatchByClientWire := DispatchRequest clientRequest serverIdx
|
||||
Nothing -> do
|
||||
let
|
||||
targetClientResponseArbiter :: Arbiter.Arbiter_IFC (TAdd numServers 1)
|
||||
|
@ -119,6 +102,7 @@ mkBus serverMap = do
|
|||
-- and should instead forward the `BusError UnMapped` response
|
||||
-- back to the client. Vector.last selects arbiter `n`
|
||||
clientResponseArbiterSlot = Vector.last targetClientResponseArbiter.clients
|
||||
let
|
||||
responseUnMapped = case clientRequest.busRequest of
|
||||
BusReadRequest _ -> BusReadResponse (Left UnMapped)
|
||||
BusWriteRequest _ -> BusWriteResponse (Left UnMapped)
|
||||
|
@ -127,9 +111,11 @@ mkBus serverMap = do
|
|||
tag = clientRequest.tag;
|
||||
busResponse = responseUnMapped
|
||||
}
|
||||
|
||||
clientResponseArbiterSlot.request
|
||||
dispatchByClientWire := BypassResponse response
|
||||
|
||||
(sprintf "client[%d] arbit server response" clientIdx): when True ==> do
|
||||
return |> action {}
|
||||
|
||||
|
||||
addRules |> foldr (<+>) (rules {}) clientRules
|
||||
|
||||
|
|
Loading…
Reference in a new issue