diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-11-26 22:55:13 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-11-26 22:55:13 -0700 |
commit | 7f5b64062ed975f856892d95e74b8d2f917ade66 (patch) | |
tree | 762b837c9fd461b8e1be5e852a3a560eeeda4d78 /src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | |
parent | 4f43488bdd32b610f7771dc01a12541fdb17b9af (diff) | |
download | fiddle-7f5b64062ed975f856892d95e74b8d2f917ade66.tar.gz fiddle-7f5b64062ed975f856892d95e74b8d2f917ade66.tar.bz2 fiddle-7f5b64062ed975f856892d95e74b8d2f917ade66.zip |
Added syntax for skip_to and buffer.
buffer tells fiddle to create a buffer of a number of bytes.
skip_to tells fiddle to skip to some new offset. It's essentially an
unnamed buffer
Diffstat (limited to 'src/Language/Fiddle/Ast/Internal/SyntaxTree.hs')
-rw-r--r-- | src/Language/Fiddle/Ast/Internal/SyntaxTree.hs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs index b597a25..2774507 100644 --- a/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs +++ b/src/Language/Fiddle/Ast/Internal/SyntaxTree.hs @@ -18,7 +18,7 @@ module Language.Fiddle.Ast.Internal.SyntaxTree FieldSpan (..), QRegMetadata (..), QBitsMetadata (..), - RegSz(..), + RegSz (..), -- Witness Types Witness (..), -- AST Types @@ -107,7 +107,7 @@ deriving instance (FromJSON (When s (FieldSpan Bytes))) => FromJSON (QRegMetadata s) -data RegSz = RegSz8 | RegSz16 | RegSz32 | RegSz64 +data RegSz = RegSz8 | RegSz16 | RegSz32 | RegSz64 deriving (Eq, Ord, Show, Enum, Generic, ToJSON, FromJSON) regSzToBits :: RegSz -> N Bits @@ -519,6 +519,30 @@ data ObjTypeDecl stage f a where assertAnnot :: a } -> ObjTypeDecl stage f a + -- | A character buffer + BufferDecl :: + { -- | Metadata about this declaration. + qRegMeta :: When (stage .>= Qualified) (QRegMetadata (stage .>= Checked)), + -- | Identifier for this buffer + bufIdent :: Guaranteed (stage .>= Qualified) (Identifier f a), + -- | Size of this buffer + bufSize :: ConstExpression Bytes stage f a, + -- | Annotation for this buf statement. + bufAnnot :: a + } -> + ObjTypeDecl stage f a + SkipToStatement :: + { -- | Witness that we are in the proper stage. These statements will turn + -- into buffer statements during the consistency check. + disableSkipToStatementsAfterConsistencyCheck :: Witness (stage .< Checked), + -- | Metadata + qRegMeta :: When (stage .>= Qualified) (QRegMetadata (stage .>= Checked)), + -- | The address to skip to. + skipToExpression :: ConstExpression Bytes stage f a, + -- | The annotation of the skipToStatement + skipToAnnot :: a + } -> + ObjTypeDecl stage f a -- | A register declaration. RegisterDecl :: { -- | Offset within the register. Calculated during the consistency check. |