still workikng on Bus types

This commit is contained in:
Yehowshua Immanuel 2025-03-17 09:16:22 -04:00
parent 21a3ee7f7a
commit 550b3731b4
2 changed files with 85 additions and 3 deletions

View file

@ -1,4 +1,10 @@
package BusTypes(BusVal, TransactionSize) where
package BusTypes(
BusVal(..),
BusError(..),
TransactionSize(..),
ReadRequest(..),
WriteRequest(..)
) where
import Types
@ -29,5 +35,34 @@ data ReadRequest = ReadRequest Addr TransactionSize
data WriteRequest = WriteRequest Addr BusVal
deriving (Bits, Eq, FShow)
type ReadResponse = Either BusError BusVal
type WriteResponse = Either BusError ()
data BusRequest
= BusReadRequest ReadRequest
| WriteReadRequest WriteRequest
deriving (Bits, Eq, FShow)
data BusResponse
= BusReadResponse ReadResponse
| BusWriteResponse WriteResponse
deriving (Bits, Eq, FShow)
interface BusMaster =
-- The Bus arbiter will call the Bus Client's request method
-- if and only if it's the Bus Client's turn to make a request, and the Bus Client
-- has a request to make.
-- It is up to the BusMaster to guard it's request method such that calling
-- it's request method is only valid when the BusMaster has a request to make.
-- This has implications about for the implementor of BusMaster, namely, that it
-- should hold its request until it's request method gets called.
request :: BusRequest
-- From the client's perspective, the response should not be called until
-- the client is ready to accept the response. In other words, response
-- should be guarded by the client.
response :: BusResponse -> Action
type Token = UInt 5
a :: UInt 5
a = 3