|
1 | 1 | {-|
|
2 | 2 | Copyright : (C) 2015-2016, University of Twente,
|
3 | 3 | 2017-2018, Google Inc.,
|
4 |
| - 2021-2023, QBayLogic B.V., |
| 4 | + 2021-2024, QBayLogic B.V., |
5 | 5 | 2022 , Google Inc.
|
6 | 6 | License : BSD2 (see the file LICENSE)
|
7 | 7 | Maintainer : QBayLogic B.V. <[email protected]>
|
@@ -65,7 +65,7 @@ import Clash.Netlist.Types hiding (intWidth, usages,
|
65 | 65 | import Clash.Netlist.Util
|
66 | 66 | import Clash.Signal.Internal (ActiveEdge (..))
|
67 | 67 | import Clash.Util
|
68 |
| - (SrcSpan, noSrcSpan, curLoc, makeCached, indexNote) |
| 68 | + (SrcSpan, clogBase, noSrcSpan, curLoc, makeCached, indexNote) |
69 | 69 | import Clash.Util.Graph (reverseTopSort)
|
70 | 70 |
|
71 | 71 | -- | State for the 'Clash.Backend.SystemVerilog.SystemVerilogM' monad:
|
@@ -1228,7 +1228,9 @@ expr_ _ (BlackBoxE pNm _ _ _ _ bbCtx _)
|
1228 | 1228 | expr_ _ (BlackBoxE pNm _ _ _ _ bbCtx _)
|
1229 | 1229 | | pNm == "Clash.Sized.Internal.Index.fromInteger#"
|
1230 | 1230 | , [Literal _ (NumLit n), Literal _ i] <- extractLiterals bbCtx
|
1231 |
| - = exprLitSV (Just (Index (fromInteger n),fromInteger n)) i |
| 1231 | + , Just k <- clogBase 2 n |
| 1232 | + , let k' = max 1 k |
| 1233 | + = exprLitSV (Just (Index (fromInteger n),k')) i |
1232 | 1234 |
|
1233 | 1235 | expr_ b (BlackBoxE _ libs imps inc bs bbCtx b') =
|
1234 | 1236 | parenIf (b || b') (Ap (renderBlackBox libs imps inc bs bbCtx <*> pure 0))
|
|
0 commit comments