initial support for Bus types

This commit is contained in:
Yehowshua Immanuel 2025-03-14 19:46:08 -04:00
parent 66464daf0c
commit 21a3ee7f7a
4 changed files with 59 additions and 3 deletions

7
bs/Bus.bs Normal file
View file

@ -0,0 +1,7 @@
package Bus(a) where
import Types
import BusTypes
a :: UInt 5
a = 3

33
bs/BusTypes.bs Normal file
View file

@ -0,0 +1,33 @@
package BusTypes(BusVal, TransactionSize) 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)
a :: UInt 5
a = 3

View file

@ -5,6 +5,7 @@ import Core
import Serializer
import BRAM
import CBindings
import Bus
type FCLK = 25000000
type BAUD = 9600

15
bs/Types.bs Normal file
View file

@ -0,0 +1,15 @@
package Types(
Pc, Insn, Addr,
Byte, HalfWord, FullWord, DoubleWord, QuadWord
)
where
type Byte = UInt 8
type HalfWord = UInt 16
type FullWord = UInt 32
type DoubleWord = UInt 64
type QuadWord = UInt 128
type Insn = FullWord
type Pc = DoubleWord
type Addr = DoubleWord