@@ -15,7 +15,6 @@ import Clash.Prelude
1515import Clash.Class.BitPackC (ByteOrder (.. ), Bytes )
1616import Data.Constraint
1717import Data.Constraint.Nat.Lemmas
18- import Data.Type.Equality ((:~:) (Refl ))
1918import Protocols (ToConstBwd )
2019import Protocols.MemoryMap (Mm )
2120import Protocols.Wishbone
@@ -154,24 +153,13 @@ getDataLe (RegisterBank (reverse -> vec)) =
154153 case timesDivRU @ bw @ (BitSize a ) of
155154 Dict -> unpack . snd $ split @ _ @ (Pad a bw ) @ (BitSize a ) (pack vec)
156155
157- {- | Coerces a tuple of index n and a boolean to index (n*2) where the LSB of the result
158- is determined by the boolean.
159- -}
160- mul2Index ::
161- forall n b .
162- (KnownNat n , 1 <= n , BitPack b , BitSize b ~ 1 ) =>
163- Index n ->
164- b ->
165- Index (n * 2 )
166- mul2Index n b = case clogProductRule @ n of Refl -> bitCoerce (n, b)
167-
168156-- | Coerces an index of size (n*2) to index n with the LSB as separate boolean.
169157div2Index ::
170- forall n b .
171- (KnownNat n , 1 <= n , BitPack b , BitSize b ~ 1 ) =>
158+ forall n .
159+ (KnownNat n , 1 <= n ) =>
172160 Index (n * 2 ) ->
173- (Index n , b )
174- div2Index = case clogProductRule @ n of Refl -> bitCoerce
161+ (Index n , Bool )
162+ div2Index idx = (resize (idx `shiftR` 1 ), lsb idx == 1 )
175163
176164-- | Delays the output controls to align them with the actual read / write timing.
177165delayControls ::
0 commit comments