diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-12-03 17:49:28 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-12-03 17:49:28 -0700 |
commit | f371a310affd9501f48aa8ade4670f9a29070cad (patch) | |
tree | 3c7815e1d3672f425787855a0f25513cce49db9c /src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | |
parent | 673c99472da3de2d52bd29fec91978166f008766 (diff) | |
download | fiddle-f371a310affd9501f48aa8ade4670f9a29070cad.tar.gz fiddle-f371a310affd9501f48aa8ade4670f9a29070cad.tar.bz2 fiddle-f371a310affd9501f48aa8ade4670f9a29070cad.zip |
Implement new syntactic-sugar for skip_to(). Allows specifying the offset directly on a register
Diffstat (limited to 'src/Language/Fiddle/Ast/Internal/SyntaxTree.hs')
-rw-r--r-- | src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs index a4f98e3..0e4894e 100644 --- a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs +++ b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs @@ -50,6 +50,7 @@ module Language.Fiddle.Ast.Internal.SyntaxTree EnumBody (..), EnumConstantDecl (..), PackageBody (..), + RegisterPosition(..), -- Helper Functions regSzToBits, mapDirected, @@ -507,6 +508,9 @@ data ObjType stage f a where ObjType stage f a deriving (Typeable, Generic, Alter, Annotated, Typeable, Walk) +newtype RegisterPosition = RegisterPosition (Maybe Text) + deriving newtype (Eq, Ord, Show, Generic, FromJSON, ToJSON) + -- | Represents a declaration inside an object type, such as a register, an -- assertion, or a substructure. data ObjTypeDecl stage f a where @@ -557,6 +561,9 @@ data ObjTypeDecl stage f a where regIdent :: Guaranteed (stage .>= Qualified) (Identifier f a), -- | Size of the register. regSize :: Variant (stage .>= Qualified) RegSz (Expression Bits stage f a), + -- | Declared register position. This gets turned into a "skip-to" + -- statement during expansion. + regPos :: When (stage .< Expanded) RegisterPosition, -- | Optional register body. regBody :: Maybe (RegisterBody stage f a), -- | Annotation for the register declaration. |