Skip to content

Commit

Permalink
modify proceduralContinuousAssignment, reglValue (AST).
Browse files Browse the repository at this point in the history
  • Loading branch information
kei-os committed Dec 27, 2008
1 parent 7bdb324 commit 75f99d7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2008-12-27 kei-os <[email protected]>

* proceduralContinuousAssignment, reglValueを AST化。

2008-12-26 kei-os <[email protected]>

* NetType_, RegType_ データ型を追加。
Expand Down
51 changes: 26 additions & 25 deletions Vparsec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ data ModuleItem_ = MI_PARAM_DECL String -- XXX TODO impl

data Stmt_ = ST_BLOCKING_ASSIGN BlockAssign_
| ST_NON_BLOCKING_ASSIGN BlockAssign_
| ST_CONTINUOUS_ASSIGN String -- XXX TODO impl
| ST_PROCEDURAL_ASSIGN RegAssign_
| ST_TIMING_CONTROL_STMT TimingControl_
| ST_CONDITIONAL_STMT String -- XXX TODO impl
-- | ST_CASE_STMT String
Expand All @@ -90,8 +90,9 @@ data NBAssign_ = ASSIGN LValue_ DelayOrEvent_ Expr_ deriving (Eq, Show) -- b
type BAssign_ = NBAssign_ -- nonBlockingAssignment

data NetAssign_ = NET_ASSIGN LValue_ Expr_ deriving (Eq, Show)
data CAssign_ = C_NET_ASSIGN [NetAssign_] deriving (Eq, Show)

-- XXX first, support only "assign"
data ProcAssign_ = PROC_ASSIGN LValue_ Expr_ deriving (Eq, Show)

data TimingControl_ = TIMING_CONTROL DelayOrEvent_ Stmt_ deriving (Eq, Show)

Expand Down Expand Up @@ -143,6 +144,8 @@ data LValue_ = LV_IDENT String
| LV_CONCAT [Expr_]
deriving (Eq, Show)

--type RegLValue_ = LValue_ -- XXX pending

data BlockAssign_ = BLOCK_ASSIGN LValue_ DelayOrEvent_ Expr_ deriving (Eq, Show)

------------------------------------------------------------
Expand Down Expand Up @@ -576,21 +579,20 @@ nonBlockingAssignment
<?> "nonBlockingAssignment"

proceduralContinuousAssignments :: Parser Stmt_
proceduralContinuousAssignments = try(do { a <- symbol "assign"
; b <- lexeme regAssignment
; c <- semi
-- ; return $ a ++ b ++ c})
; return $ ST_CONTINUOUS_ASSIGN $ "ST_CONTINUOUS_ASSIGN:1 "}) -- FIXME : temp
<|> try(do { a <- symbol "deassign"
; b <- lexeme reglValue
; c <- semi
-- ; return $ a ++ b ++ c })
; return $ ST_CONTINUOUS_ASSIGN $ "ST_CONTINUOUS_ASSIGN:2 " }) -- FIXME : temp
-- <|> force regAssignment; -- not impl
-- <|> force netAssignment; -- not impl
-- <|> release reglValue; -- not impl
-- <|> release netlValue; -- not impl
<?> "proceduralContinuousAssignments"
proceduralContinuousAssignments
= try(do { symbol "assign"
; r <- lexeme regAssignment -- reg_lvalue = expression
; semi
; return $ ST_PROCEDURAL_ASSIGN r }) -- FIXME : temp
-- <|> try(do { symbol "deassign" -- not support yet
-- ; r <- lexeme reglValue
-- ; semi
-- ; return $ ST_CONTINUOUS_ASSIGN $ "ST_CONTINUOUS_ASSIGN:2 " })
-- <|> force regAssignment; -- not impl
-- <|> force netAssignment; -- not impl
-- <|> release reglValue; -- not impl
-- <|> release netlValue; -- not impl
<?> "proceduralContinuousAssignments"

proceduralTimingControlStatement :: Parser Stmt_
proceduralTimingControlStatement
Expand All @@ -614,11 +616,11 @@ conditionalStatement = do { a <- symbol "if"
-- ; return $ a ++ b }
; return $ a }

regAssignment :: Parser String
regAssignment = do { a <- lexeme reglValue
; b <- symbol "="
; c <- lexeme expression
; return $ a ++ b {-++ c-} ++ "expression:ok " }
regAssignment :: Parser RegAssign_
regAssignment = do { lv <- lexeme reglValue
; symbol "="
; expr <- lexeme expression
; return $ REG_ASSIGN lv expr }
<?> "regAssignment"

--seqBlock :: Parser String
Expand Down Expand Up @@ -707,9 +709,8 @@ lvalue = do { id <- identifier; return $ LV_IDENT id }
<|> do { c <- concatenation; return $ LV_CONCAT c }
<?> "lvalue"

reglValue :: Parser String
--reglValue = lvalue -- XXX TODO : enable
reglValue = do { a <- lvalue; return "reglValue:ok " }
reglValue :: Parser LValue_ -- XXX pending : RegLValue_
reglValue = lvalue
<?> "reglValue"

expression :: Parser Expr_
Expand Down

0 comments on commit 75f99d7

Please sign in to comment.