package BusTypes( BusVal(..), BusError(..), TransactionSize(..), ReadRequest(..), WriteRequest(..) ) where import Types data BusError = UnMapped | UnAligned deriving (Bits, Eq, FShow) data TransactionSize = SizeByte | SizeHalfWord | SizeFullWord | SizeDoubleWord | SizeQuadWord deriving (Bits, Eq, FShow) data BusVal = BusByte Byte | BusHalfWord HalfWord | BusFullWord FullWord | BusDoubleWord DoubleWord | BusQuadWord QuadWord deriving (Bits, Eq, FShow) data ReadRequest = ReadRequest Addr TransactionSize deriving (Bits, Eq, FShow) 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 Master's request method -- if and only if it's the Bus Master's turn to make a request, and the Bus Master -- 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 masters's perspective, the response should not be called by the -- arbiter until the master 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