aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-parser.stanza
diff options
context:
space:
mode:
authorazidar2015-04-22 15:24:18 -0700
committerazidar2015-04-22 15:24:18 -0700
commita4f7aa2b81a021f21a49bd4059d051bc0f949880 (patch)
tree3817d244f207bdebaec3e9e4d3601d0ecef546c6 /src/main/stanza/ir-parser.stanza
parent3b3e1117fa3f346e70d3b8d50b7fd91842fb753b (diff)
Switched to stricter primop width constraints. Implemented Pad. Added some missing primops
Diffstat (limited to 'src/main/stanza/ir-parser.stanza')
-rw-r--r--src/main/stanza/ir-parser.stanza16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/main/stanza/ir-parser.stanza b/src/main/stanza/ir-parser.stanza
index 6ec0c4d2..1772d773 100644
--- a/src/main/stanza/ir-parser.stanza
+++ b/src/main/stanza/ir-parser.stanza
@@ -203,13 +203,19 @@ defsyntax firrtl :
operators[`bit-or-reduce] = BIT-OR-REDUCE-OP
operators[`bit-xor-reduce] = BIT-XOR-REDUCE-OP
+ defrule width :
+ width = (?) :
+ UnknownWidth()
+ width = (?width:#int) :
+ IntWidth(ut(width))
+
defrule exp-form :
- exp-form = (UInt (@do ?value:#int ?width:#int)) :
- UIntValue(ut(value), IntWidth(ut(width)))
+ exp-form = (UInt (@do ?value:#int ?width:#width)) :
+ UIntValue(ut(value), width)
exp-form = (UInt (@do ?value:#int)) :
UIntValue(ut(value), UnknownWidth())
- exp-form = (SInt (@do ?value:#int ?width:#int)) :
- SIntValue(ut(value), IntWidth(ut(width)))
+ exp-form = (SInt (@do ?value:#int ?width:#width)) :
+ SIntValue(ut(value), width)
exp-form = (SInt (@do ?value:#int)) :
SIntValue(ut(value), UnknownWidth())
exp-form = (WritePort (@do ?mem:#exp ?index:#exp ?enable:#exp)) :
@@ -218,6 +224,8 @@ defsyntax firrtl :
ReadPort(mem, index, UnknownType(), enable)
exp-form = (Register (@do ?value:#exp ?enable:#exp)) :
Register(UnknownType(),value,enable)
+ exp-form = (Pad (@do ?value:#exp ?width:#width)) :
+ Pad(value,width,UnknownType())
exp-form = (?op:#symbol (@do ?es:#exp ... ?ints:#int ...)) :
println("Op-symbol is:~" % [op])
match(get?(operators, ut(op), false)) :