scope bit-indexed modport binding

This commit is contained in:
Zachary Snow 2024-04-16 08:40:26 -04:00
parent 6226472c93
commit 261beffd0f
4 changed files with 14 additions and 2 deletions

View File

@ -44,7 +44,7 @@ jobs:
- macOS-13 - macOS-13
needs: build needs: build
env: env:
IVERILOG_REF: f31d0dcbc5ddcd97e1e2e6f7bc7eb0f5a547fe16 IVERILOG_REF: ef7f0a8f38782dfc0872b1e352ccf32343c10bb8
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install Dependencies (macOS) - name: Install Dependencies (macOS)

View File

@ -26,6 +26,7 @@
* Fixed unconverted multidimensional struct fields within dimension queries * Fixed unconverted multidimensional struct fields within dimension queries
* Fixed non-typenames (e.g., from packages or subsequent declarations) * Fixed non-typenames (e.g., from packages or subsequent declarations)
improperly shadowing the names of `struct` pattern fields improperly shadowing the names of `struct` pattern fields
* Fixed shadowing of interface array indices passed to port connections
* Fixed failure to resolve typenames suffixed with dimensions in contexts * Fixed failure to resolve typenames suffixed with dimensions in contexts
permitting both types and expressions, e.g., `$bits(T[W-1:0])` permitting both types and expressions, e.g., `$bits(T[W-1:0])`
* Fixed errant constant folding of shadowed non-trivial localparams * Fixed errant constant folding of shadowed non-trivial localparams

View File

@ -222,7 +222,10 @@ convertDescription tops parts (Part att ext Module lif name ports items) =
then Nothing then Nothing
else Just (portName, modportBinding) else Just (portName, modportBinding)
where where
modportBinding = (substitutions, replaceBit modportE) modportBinding =
( substitutions
, scopeExprWithScopes modports $ replaceBit modportE
)
substitutions = substitutions =
genSubstitutions modports base instanceE modportE genSubstitutions modports base instanceE modportE
maybeInfo = maybeInfo =

View File

@ -38,6 +38,8 @@ module Convert.Scoper
, replaceInExpr , replaceInExpr
, scopeExpr , scopeExpr
, scopeType , scopeType
, scopeExprWithScopes
, scopeTypeWithScopes
, insertElem , insertElem
, removeElem , removeElem
, injectItem , injectItem
@ -209,6 +211,12 @@ scopeType = traverseNestedTypesM $ traverseTypeExprsM scopeExpr
{-# INLINABLE scopeExpr #-} {-# INLINABLE scopeExpr #-}
{-# INLINABLE scopeType #-} {-# INLINABLE scopeType #-}
scopeExprWithScopes :: Scopes a -> Expr -> Expr
scopeExprWithScopes scopes = flip evalState scopes . scopeExpr
scopeTypeWithScopes :: Scopes a -> Type -> Type
scopeTypeWithScopes scopes = flip evalState scopes . scopeType
class ScopePath k where class ScopePath k where
toTiers :: Scopes a -> k -> [Tier] toTiers :: Scopes a -> k -> [Tier]