diff --git a/bs/Bus.bs b/bs/Bus.bs new file mode 100644 index 0000000..0faaa54 --- /dev/null +++ b/bs/Bus.bs @@ -0,0 +1,7 @@ +package Bus(a) where + +import Types +import BusTypes + +a :: UInt 5 +a = 3 diff --git a/bs/BusTypes.bs b/bs/BusTypes.bs new file mode 100644 index 0000000..e7cba2c --- /dev/null +++ b/bs/BusTypes.bs @@ -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 diff --git a/bs/Top.bs b/bs/Top.bs index a360a20..b1f7105 100644 --- a/bs/Top.bs +++ b/bs/Top.bs @@ -5,6 +5,7 @@ import Core import Serializer import BRAM import CBindings +import Bus type FCLK = 25000000 type BAUD = 9600 @@ -24,7 +25,7 @@ mkTop = do persistLed :: Reg (Bit 8) <- mkReg 0 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 addRules $ rules @@ -43,7 +44,7 @@ mkTop = do return $ interface ITop ftdi_rxd = serializer.bitLineOut - ftdi_txd bitIn = + ftdi_txd bitIn = do deserializer.putBitIn bitIn led = persistLed @@ -73,4 +74,4 @@ mkSim = do do restoreTerminal $display "GOT CTRL+C" - $finish \ No newline at end of file + $finish diff --git a/bs/Types.bs b/bs/Types.bs new file mode 100644 index 0000000..bbb6903 --- /dev/null +++ b/bs/Types.bs @@ -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