initial support for Bus types
This commit is contained in:
parent
66464daf0c
commit
21a3ee7f7a
7
bs/Bus.bs
Normal file
7
bs/Bus.bs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
package Bus(a) where
|
||||||
|
|
||||||
|
import Types
|
||||||
|
import BusTypes
|
||||||
|
|
||||||
|
a :: UInt 5
|
||||||
|
a = 3
|
33
bs/BusTypes.bs
Normal file
33
bs/BusTypes.bs
Normal 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
|
|
@ -5,6 +5,7 @@ import Core
|
||||||
import Serializer
|
import Serializer
|
||||||
import BRAM
|
import BRAM
|
||||||
import CBindings
|
import CBindings
|
||||||
|
import Bus
|
||||||
|
|
||||||
type FCLK = 25000000
|
type FCLK = 25000000
|
||||||
type BAUD = 9600
|
type BAUD = 9600
|
||||||
|
@ -24,7 +25,7 @@ mkTop = do
|
||||||
persistLed :: Reg (Bit 8) <- mkReg 0
|
persistLed :: Reg (Bit 8) <- mkReg 0
|
||||||
messageM $ "Hallo!!" + (realToString 5)
|
messageM $ "Hallo!!" + (realToString 5)
|
||||||
|
|
||||||
-- refactor such that the following rules are let-bound to
|
-- refactor such that the following rules are let-bound to
|
||||||
-- `attachIO` identifier
|
-- `attachIO` identifier
|
||||||
addRules $
|
addRules $
|
||||||
rules
|
rules
|
||||||
|
@ -43,7 +44,7 @@ mkTop = do
|
||||||
return $
|
return $
|
||||||
interface ITop
|
interface ITop
|
||||||
ftdi_rxd = serializer.bitLineOut
|
ftdi_rxd = serializer.bitLineOut
|
||||||
ftdi_txd bitIn =
|
ftdi_txd bitIn =
|
||||||
do
|
do
|
||||||
deserializer.putBitIn bitIn
|
deserializer.putBitIn bitIn
|
||||||
led = persistLed
|
led = persistLed
|
||||||
|
@ -73,4 +74,4 @@ mkSim = do
|
||||||
do
|
do
|
||||||
restoreTerminal
|
restoreTerminal
|
||||||
$display "GOT CTRL+C"
|
$display "GOT CTRL+C"
|
||||||
$finish
|
$finish
|
||||||
|
|
15
bs/Types.bs
Normal file
15
bs/Types.bs
Normal 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
|
Loading…
Reference in a new issue