I seem to have implemented the Cell parser

This commit is contained in:
Yehowshua Immanuel 2024-12-07 19:59:09 -05:00
parent f1a59a13fe
commit 97217ee5bf
2 changed files with 61 additions and 20 deletions

View file

@ -1,12 +1,13 @@
module RTLILParser.AST(
AutoIdxStmt(..) ,ParamStmt(..) ,AutogenId(..)
,Constant(..) ,CellStmt(..) ,PublicId(..)
,AttrStmt(..) ,Value(..) ,Id(..)
,CellId(..) ,CellType(..) ,WireId(..)
,SigSpec(..) ,Slice(..) ,ConnStmt(..)
,WireOption(..) ,WireStmt(..) ,Wire(..)
,MemoryOption(..) ,MemoryStmt(..) ,Memory(..)
,MemoryID(..)
AutoIdxStmt(..) ,ParamStmt(..) ,AutogenId(..)
,Constant(..) ,CellStmt(..) ,PublicId(..)
,AttrStmt(..) ,Value(..) ,Id(..)
,CellId(..) ,CellType(..) ,WireId(..)
,SigSpec(..) ,Slice(..) ,ConnStmt(..)
,WireOption(..) ,WireStmt(..) ,Wire(..)
,MemoryOption(..) ,MemoryStmt(..) ,Memory(..)
,MemoryID(..) ,CellBodyStmt(..) ,ParameterSign(..)
,Cell(..)
) where
import Text.Read (Lexeme(Ident))
import Data.Functor.Contravariant (Contravariant)
@ -84,9 +85,18 @@ data MemoryOption = MemoryOptionWidth Int
deriving (Show)
-- Cells
data Cell = Cell CellStmt [AttrStmt] [CellBodyStmt]
deriving (Show)
data CellStmt = CellStmt CellId CellType deriving (Show)
data CellId = CellId Id deriving (Show)
data CellType = CellType Id deriving (Show)
data ParameterSign = Signed | Real deriving (Show)
data CellBodyStmt = CellBodyParameter
(Maybe ParameterSign)
Id
Constant
| CellConnect Id SigSpec
deriving (Show)
-- Processes
-- Switches