From 3862865b8c70dd21e1a436dd79cfd165bebe5f43 Mon Sep 17 00:00:00 2001 From: azidar Date: Thu, 23 Apr 2015 15:27:43 -0700 Subject: Added new parser. Fixed all Tests. Added on-reset to parser, but don't correctly handle it in compiler. --- src/main/stanza/ir-utils.stanza | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/main/stanza/ir-utils.stanza') diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 86fe56d1..283fe9ea 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -140,7 +140,7 @@ defmethod print (o:OutputStream, e:Expression) : match(e) : (e:Ref) : print(o, name(e)) (e:Subfield) : print-all(o, [exp(e) "." name(e)]) - (e:Index) : print-all(o, [exp(e) "." value(e)]) + (e:Index) : print-all(o, [exp(e) "[" value(e) "]"]) (e:UIntValue) : print-all(o, ["UInt(" value(e) ")"]) (e:SIntValue) : print-all(o, ["SInt(" value(e) ")"]) (e:DoPrim) : @@ -179,6 +179,8 @@ defmethod print (o:OutputStream, c:Stmt) : do(print{o,_}, join(body(c), "\n")) (c:Connect) : print-all(o, [loc(c) " := " exp(c)]) + (c:OnReset) : + print-all(o, ["on-reset " reg(c) " := " exp(c)]) (c:EmptyStmt) : print(o, "skip") print-debug(o,c) @@ -190,11 +192,11 @@ defmethod print (o:OutputStream, t:Type) : (t:UIntType) : match(width(t)) : (w:UnknownWidth) : print-all(o, ["UInt"]) - (w) : print-all(o, ["UInt(" width(t) ")"]) + (w) : print-all(o, ["UInt<" width(t) ">"]) (t:SIntType) : match(width(t)) : (w:UnknownWidth) : print-all(o, ["SInt"]) - (w) : print-all(o, ["SInt(" width(t) ")"]) + (w) : print-all(o, ["SInt<" width(t) ">"]) (t:BundleType) : print(o, "{") print-all(o, join(fields(t), ", ")) @@ -258,6 +260,7 @@ defmethod map (f: Expression -> Expression, c:Stmt) -> Stmt : (c:DefInstance) : DefInstance(name(c), f(module(c))) (c:Conditionally) : Conditionally(f(pred(c)), conseq(c), alt(c)) (c:Connect) : Connect(f(loc(c)), f(exp(c))) + (c:OnReset) : OnReset(f(reg(c)),f(exp(c))) (c) : c public defmulti map (f: Stmt -> Stmt, c:?T&Stmt) -> T -- cgit v1.2.3 From 32148a311e06e8028b95da4bd8b1c888b5d8220f Mon Sep 17 00:00:00 2001 From: azidar Date: Thu, 23 Apr 2015 17:53:29 -0700 Subject: Not finished commmit --- src/main/stanza/ir-utils.stanza | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/stanza/ir-utils.stanza') diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 283fe9ea..507ccf94 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -180,7 +180,7 @@ defmethod print (o:OutputStream, c:Stmt) : (c:Connect) : print-all(o, [loc(c) " := " exp(c)]) (c:OnReset) : - print-all(o, ["on-reset " reg(c) " := " exp(c)]) + print-all(o, ["on-reset " loc(c) " := " exp(c)]) (c:EmptyStmt) : print(o, "skip") print-debug(o,c) @@ -260,7 +260,7 @@ defmethod map (f: Expression -> Expression, c:Stmt) -> Stmt : (c:DefInstance) : DefInstance(name(c), f(module(c))) (c:Conditionally) : Conditionally(f(pred(c)), conseq(c), alt(c)) (c:Connect) : Connect(f(loc(c)), f(exp(c))) - (c:OnReset) : OnReset(f(reg(c)),f(exp(c))) + (c:OnReset) : OnReset(f(loc(c)),f(exp(c))) (c) : c public defmulti map (f: Stmt -> Stmt, c:?T&Stmt) -> T -- cgit v1.2.3 From 2d2120a05549a5d31072aa792dc96fb7e6e7c629 Mon Sep 17 00:00:00 2001 From: azidar Date: Mon, 27 Apr 2015 11:14:06 -0700 Subject: Added on-reset --- src/main/stanza/ir-utils.stanza | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/main/stanza/ir-utils.stanza') diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza index 67dfc89d..1131c1b3 100644 --- a/src/main/stanza/ir-utils.stanza +++ b/src/main/stanza/ir-utils.stanza @@ -129,12 +129,12 @@ defmethod print (o:OutputStream, op:PrimOp) : BIT-AND-OP : "bit-and" BIT-OR-OP : "bit-or" BIT-XOR-OP : "bit-xor" - CONCAT-OP : "cat" - BIT-SELECT-OP : "bit" - BITS-SELECT-OP : "bits" BIT-AND-REDUCE-OP : "bit-and-reduce" BIT-OR-REDUCE-OP : "bit-or-reduce" BIT-XOR-REDUCE-OP : "bit-xor-reduce" + CONCAT-OP : "cat" + BIT-SELECT-OP : "bit" + BITS-SELECT-OP : "bits" defmethod print (o:OutputStream, e:Expression) : match(e) : -- cgit v1.2.3