aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/antlr4')
-rw-r--r--src/main/antlr4/FIRRTL.g416
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/antlr4/FIRRTL.g4 b/src/main/antlr4/FIRRTL.g4
index 4ceed9f0..f4d9d3f8 100644
--- a/src/main/antlr4/FIRRTL.g4
+++ b/src/main/antlr4/FIRRTL.g4
@@ -63,7 +63,7 @@ circuit
module
: 'module' id ':' info? INDENT port* moduleBlock DEDENT
- | 'extmodule' id ':' info? INDENT port* DEDENT
+ | 'extmodule' id ':' info? INDENT port* defname? parameter* DEDENT
;
port
@@ -89,6 +89,16 @@ field
: 'flip'? id ':' type
;
+defname
+ : 'defname' '=' id NEWLINE
+ ;
+
+parameter
+ : 'parameter' id '=' IntLit NEWLINE
+ | 'parameter' id '=' StringLit NEWLINE
+ | 'parameter' id '=' DoubleLit NEWLINE
+ ;
+
moduleBlock
: simple_stmt*
;
@@ -291,6 +301,10 @@ IntLit
| '"' 'h' ( HexDigit )+ '"'
;
+DoubleLit
+ : ( '+' | '-' )? Digit+ '.' Digit+ ( 'E' Digit+ )?
+ ;
+
fragment
Nondigit
: [a-zA-Z_]