aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--src/main/scala/firrtl/IR.scala4
-rw-r--r--src/main/scala/firrtl/Parser.scala2
-rw-r--r--src/main/scala/firrtl/Passes.scala4
-rw-r--r--src/main/stanza/compilers.stanza2
-rw-r--r--src/main/stanza/firrtl-ir.stanza2
-rw-r--r--src/main/stanza/ir-parser.stanza4
-rw-r--r--src/main/stanza/ir-utils.stanza7
-rw-r--r--src/main/stanza/passes.stanza34
-rw-r--r--src/main/stanza/primop.stanza2
-rw-r--r--src/main/stanza/verilog.stanza55
-rw-r--r--test/features/Printf.fir17
-rw-r--r--test/features/Stop.fir13
-rw-r--r--test/parser/gcd.fir2
-rw-r--r--test/passes/inline-indexers/simple10.fir18
-rw-r--r--test/passes/inline-indexers/simple11.fir157
-rw-r--r--test/performance/Vector1000.fir7
-rw-r--r--test/performance/Vector2000.fir7
-rw-r--r--test/performance/Vector4000.fir7
-rw-r--r--test/performance/Vector8000.fir7
20 files changed, 295 insertions, 59 deletions
diff --git a/Makefile b/Makefile
index 68ab6c60..099b2af9 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,9 @@ regress:
passes:
cd $(test_dir)/passes && lit -v . --path=$(root_dir)/utils/bin/
+perf:
+ cd $(test_dir)/performance && lit -v . --path=$(root_dir)/utils/bin/
+
errors:
cd $(test_dir)/errors && lit -v . --path=$(root_dir)/utils/bin/
diff --git a/src/main/scala/firrtl/IR.scala b/src/main/scala/firrtl/IR.scala
index 1e7c4ced..3dbf3dae 100644
--- a/src/main/scala/firrtl/IR.scala
+++ b/src/main/scala/firrtl/IR.scala
@@ -9,6 +9,10 @@ package firrtl
import scala.collection.Seq
// Should this be defined elsewhere?
+/*
+Structure containing source locator information.
+Member of most Stmt case classes.
+*/
trait Info
case object NoInfo extends Info
case class FileInfo(file: String, line: Int, column: Int) extends Info {
diff --git a/src/main/scala/firrtl/Parser.scala b/src/main/scala/firrtl/Parser.scala
index 00cd110e..98864e92 100644
--- a/src/main/scala/firrtl/Parser.scala
+++ b/src/main/scala/firrtl/Parser.scala
@@ -22,7 +22,7 @@ object Parser
val tokens = new CommonTokenStream(lexer)
val parser = new FIRRTLParser(tokens)
- // FIXME Dangerous
+ // FIXME Dangerous (TODO)
parser.getInterpreter.setPredictionMode(PredictionMode.SLL)
// Concrete Syntax Tree
diff --git a/src/main/scala/firrtl/Passes.scala b/src/main/scala/firrtl/Passes.scala
index f5691c45..5aa74630 100644
--- a/src/main/scala/firrtl/Passes.scala
+++ b/src/main/scala/firrtl/Passes.scala
@@ -36,9 +36,7 @@ object Passes {
* and passing an environment to all statements in pre-order
* traversal, and resolving types in expressions in post-
* order traversal.
- * Type propagation for primary ops are defined here.
- * Notable cases: LetRec requires updating environment before
- * resolving the subexpressions in its elements.
+ * Type propagation for primary ops are defined in Primops.scala.
* Type errors are not checked in this pass, as this is
* postponed for a later/earlier pass.
*/
diff --git a/src/main/stanza/compilers.stanza b/src/main/stanza/compilers.stanza
index 4d12ddcb..88a4141a 100644
--- a/src/main/stanza/compilers.stanza
+++ b/src/main/stanza/compilers.stanza
@@ -62,6 +62,8 @@ public defmethod passes (c:StandardVerilog) -> List<Pass> :
;ExpandIndexedConnects() ;W
InlineIndexed()
InferTypes() ;R
+ ResolveGenders() ;W
+ CheckTypes() ;R
CheckGenders() ;W
ExpandWhens() ;W
InferWidths() ;R
diff --git a/src/main/stanza/firrtl-ir.stanza b/src/main/stanza/firrtl-ir.stanza
index 5bc1ea68..d3f60646 100644
--- a/src/main/stanza/firrtl-ir.stanza
+++ b/src/main/stanza/firrtl-ir.stanza
@@ -158,10 +158,12 @@ public defstruct Connect <: Stmt : ;LOW
public defstruct StopStmt <: Stmt : ;LOW
info: FileInfo with: (as-method => true)
ret: Int
+ clk: Expression
public defstruct PrintfStmt <: Stmt : ;LOW
info: FileInfo with: (as-method => true)
string: String
args: List<Expression>
+ clk: Expression
public defstruct EmptyStmt <: Stmt ;LOW
diff --git a/src/main/stanza/ir-parser.stanza b/src/main/stanza/ir-parser.stanza
index a4ca89f7..c4480afb 100644
--- a/src/main/stanza/ir-parser.stanza
+++ b/src/main/stanza/ir-parser.stanza
@@ -246,8 +246,8 @@ defsyntax firrtl :
stmt = (write accessor ?name:#id! #=! ?s:#exp![?i:#exp$]) : DefAccessor(first-info(form),name,s,i,WRITE)
stmt = (infer accessor ?name:#id! #=! ?s:#exp![?i:#exp$]) : DefAccessor(first-info(form),name,s,i,INFER)
stmt = (rdwr accessor ?name:#id! #=! ?s:#exp![?i:#exp$]) : DefAccessor(first-info(form),name,s, i,RDWR)
- stmt = (stop(?ret:#int)) : StopStmt(first-info(form),ret)
- stmt = (printf(?str:#string ?es:#exp ...)) : PrintfStmt(first-info(form),str,es)
+ stmt = (stop( ?clk:#exp!, ?ret:#int)) : StopStmt(first-info(form),ret,clk)
+ stmt = (printf( ?clk:#exp!, ?str:#string ?es:#exp ...)) : PrintfStmt(first-info(form),str,es,clk)
stmt = (?s:#stmt/when) : s
stmt = (?x:#exp := ?y:#exp!) : Connect(first-info(form),x, y)
diff --git a/src/main/stanza/ir-utils.stanza b/src/main/stanza/ir-utils.stanza
index dbcf3b73..9bcf1fd9 100644
--- a/src/main/stanza/ir-utils.stanza
+++ b/src/main/stanza/ir-utils.stanza
@@ -279,9 +279,9 @@ defmethod print (o:OutputStream, c:Stmt) :
(c:EmptyStmt) :
print(o, "skip")
(c:StopStmt) :
- print-all(o, ["stop(" ret(c) ")"])
+ print-all(o, ["stop(" clk(c) ", " ret(c) ")"])
(c:PrintfStmt) :
- print-all(o, ["printf("]) ;"
+ print-all(o, ["printf(" clk(c) ", " ]) ;"
print-all(o, join(List(escape(string(c)),args(c)), ", "))
print(o, ")")
@@ -376,7 +376,8 @@ defmethod map (f: Expression -> Expression, c:Stmt) -> Stmt :
(c:Connect) : Connect(info(c),f(loc(c)), f(exp(c)))
(c:BulkConnect) : BulkConnect(info(c),f(loc(c)), f(exp(c)))
(c:OnReset) : OnReset(info(c),f(loc(c)),f(exp(c)))
- (c:PrintfStmt) : PrintfStmt(info(c),string(c),map(f,args(c)))
+ (c:PrintfStmt) : PrintfStmt(info(c),string(c),map(f,args(c)),f(clk(c)))
+ (c:StopStmt) : StopStmt(info(c),ret(c),f(clk(c)))
(c) : c
public defmulti map<?T> (f: Stmt -> Stmt, c:?T&Stmt) -> T
diff --git a/src/main/stanza/passes.stanza b/src/main/stanza/passes.stanza
index e31b30a9..02323181 100644
--- a/src/main/stanza/passes.stanza
+++ b/src/main/stanza/passes.stanza
@@ -365,7 +365,7 @@ defn remove-special-chars (c:Circuit) :
(s:Connect) : Connect(info(s),rename-e(loc(s)),rename-e(exp(s)))
(s:EmptyStmt) : s
(s:StopStmt) : s
- (s:PrintfStmt) : PrintfStmt(info(s),string(s),map(rename-e,args(s)))
+ (s:PrintfStmt) : PrintfStmt(info(s),string(s),map(rename-e,args(s)),rename-e(clk(s)))
Circuit(info(c),modules*, rename(main(c))) where :
val modules* =
@@ -821,7 +821,7 @@ defn resolve-genders (c:Circuit) :
val alt* = resolve-stmt(alt(s))
Conditionally(info(s),pred*,conseq*,alt*)
(s:PrintfStmt) :
- PrintfStmt(info(s),string(s),map(resolve-expr{_,MALE},args(s)))
+ PrintfStmt(info(s),string(s),map(resolve-expr{_,MALE},args(s)),clk(s))
(s) : map(resolve-stmt,s)
defn resolve-expr (e:Expression,desired:Gender) -> Expression :
@@ -977,10 +977,10 @@ defn expand-expr (e:Expression) -> List<EF> :
if inst?(e) :
for f in fields(type(e) as BundleType) map-append :
for x in generate-entry(name(f),type(f)) map :
- EF(WSubfield(e,name(x),type(x),gender(e)),flip(f) * flip(x))
+ EF(WSubfield(e,name(x),type(x),gender(e) * flip(x)),flip(f) * flip(x))
else :
for x in generate-entry(name(e),type(e)) map :
- EF(WRef(name(x),type(x),kind(e),gender(e)), flip(x))
+ EF(WRef(name(x),type(x),kind(e),gender(e) * flip(x)), flip(x))
(e:WSubfield) :
val f = {_ as Field} $
for f in fields(type(exp(e)) as BundleType) find : name(f) == name(e)
@@ -1002,8 +1002,13 @@ defn expand-expr (e:Expression) -> List<EF> :
;val v = exp(head(expand-expr(value(e))))
;list(EF(Pad(v,width(e),type(e)),DEFAULT))
(e:DoPrim) :
- val args = for x in args(e) map : exp(head(expand-expr(x)))
- list(EF(DoPrim(op(e),args,consts(e),type(e)),DEFAULT))
+ val vargs = Vector<Expression>()
+ val vflips = Vector<Flip>()
+ for x in args(e) do :
+ val r = head(expand-expr(x))
+ add(vargs,exp(r))
+ add(vflips,flip(r))
+ list(EF(DoPrim(op(e),to-list(vargs),consts(e),type(e)),DEFAULT))
(e) : list(EF(e,DEFAULT))
defn lower-ports (ports:List<Port>) -> List<Port> :
@@ -1134,7 +1139,7 @@ defn lower (body:Stmt) -> Stmt :
Conditionally(info(s),exp(head $ expand-expr(pred(s))),lower-stmt(conseq(s)),lower-stmt(alt(s)))
(s:PrintfStmt) :
val args* = for x in args(s) map : exp(head(expand-expr(x)))
- PrintfStmt(info(s),string(s),args*)
+ PrintfStmt(info(s),string(s),args*,clk(s))
(s:Begin|EmptyStmt|StopStmt) : map(lower-stmt,s)
lower-stmt(body)
@@ -1267,7 +1272,12 @@ defn inline-indexed-m (m:InModule) -> InModule :
val cond = Conditionally(info(s),eq,Connect(info(s),e,replace-ref),EmptyStmt())
add(stmts,map(inline-indexed-s,cond))
(s:DecToIndexer) :
- if (gender(replace-ref) != MALE) : error("Shouldn't be here")
+ if (gender(replace-ref) != MALE) :
+ println(gender(replace-ref))
+ println(replace-ref)
+ println(indexed-dec)
+ println(indexer)
+ error("Shouldn't be here")
val cnct = Connect(info(s),replace-ref,head(exps(s)))
add(stmts,map(inline-indexed-e,cnct))
;println-all(["exps: " exps(s)])
@@ -2089,7 +2099,7 @@ defn gen-constraints (m:Module, h:HashTable<Symbol,Type>, v:Vector<WGeq>) -> Mod
add(v,WGeq(width!(type(l)),width!(type(e))))
Connect(info(s),l,e)
(s:PrintfStmt) :
- PrintfStmt(info(s),string(s),map(gen-constraints,args(s)))
+ PrintfStmt(info(s),string(s),map(gen-constraints,args(s)),gen-constraints(clk(s)))
(s:Conditionally) :
val p = gen-constraints(pred(s))
add(v,WGeq(width!(type(p)),LongWidth(1)))
@@ -2373,7 +2383,7 @@ defn split-exp (c:Circuit) :
(c:PrintfStmt) :
val args* = for x in args(c) map :
map(split-exp-e{_,false,info(c)},x)
- val conseq* = PrintfStmt(info(c),string(c),args*)
+ val conseq* = PrintfStmt(info(c),string(c),args*,clk(c))
add(v,Conditionally(info(s),pred*,conseq*,alt(s)))
(c:StopStmt) :
add(v,Conditionally(info(s),pred*,c,alt(s)))
@@ -2383,7 +2393,7 @@ defn split-exp (c:Circuit) :
(s:PrintfStmt) :
val args* = for x in args(s) map :
map(split-exp-e{_,false,info(s)},x)
- add(v,PrintfStmt(info(s),string(s),args*))
+ add(v,PrintfStmt(info(s),string(s),args*,clk(s)))
(s:DefNode) :
val exp* = map(split-exp-e{_,name(s),info(s)},value(s))
add(v,DefNode(info(s),name(s),exp*))
@@ -2543,7 +2553,7 @@ defn pad-widths-s (s:Stmt) -> Stmt :
val args* = for x in args(s) map :
val i = int-width!(type(x))
pad-widths-e(i,x)
- PrintfStmt(info(s),string(s),args*)
+ PrintfStmt(info(s),string(s),args*,clk(s))
(s:DefNode) :
val i = int-width!(type(value(s)))
val exp* = pad-widths-e(i,value(s))
diff --git a/src/main/stanza/primop.stanza b/src/main/stanza/primop.stanza
index c1a1bfd4..b285e0ee 100644
--- a/src/main/stanza/primop.stanza
+++ b/src/main/stanza/primop.stanza
@@ -73,7 +73,7 @@ public defn primop-gen-constraints (e:DoPrim,v:Vector<WGeq>) -> Type :
val w* = switch {op(e) == _} :
ADD-OP : PlusWidth(get-max(0,1),LongWidth(1))
SUB-OP : PlusWidth(get-max(0,1),LongWidth(1))
- MUL-OP : PlusWidth(get-max(0,1),get-max(0,1))
+ MUL-OP : PlusWidth(width!(args(e)[0]),width!(args(e)[1]))
DIV-OP :
match(type(args(e)[0]),type(args(e)[1])) :
(t0:UIntType,t1:SIntType) : PlusWidth(width!(args(e)[0]),LongWidth(1))
diff --git a/src/main/stanza/verilog.stanza b/src/main/stanza/verilog.stanza
index 5cf42323..b5196dac 100644
--- a/src/main/stanza/verilog.stanza
+++ b/src/main/stanza/verilog.stanza
@@ -139,7 +139,7 @@ defn emit (e:Expression) -> String :
if type(e) typeof SIntType : [emit-as-type(args(e)[0],type(e)) " >>> " emit(args(e)[1])]
else : [emit-as-type(args(e)[0],type(e)) " >> " emit(args(e)[1])]
SHIFT-LEFT-OP : [emit-as-type(args(e)[0],type(e)) " << " consts(e)[0]]
- SHIFT-RIGHT-OP : [emit-as-type(args(e)[0],type(e)) "[" width!(type(args(e)[0])) - to-long(1) ":" consts(e)[0] "]"]
+ SHIFT-RIGHT-OP : [emit(args(e)[0]) "[" width!(type(args(e)[0])) - to-long(1) ":" consts(e)[0] "]"]
;if type(e) typeof SIntType : [emit-as-type(args(e)[0],type(e)) " >>> " consts(e)[0]]
;else : [emit-as-type(args(e)[0],type(e)) " >> " consts(e)[0]]
NEG-OP : ["-{" emit-as-type(args(e)[0],type(e)) "}"]
@@ -152,8 +152,8 @@ defn emit (e:Expression) -> String :
BIT-OR-OP : [emit-as-type(args(e)[0],type(e)) " | " emit-as-type(args(e)[1],type(e))]
BIT-XOR-OP : [emit-as-type(args(e)[0],type(e)) " ^ " emit-as-type(args(e)[1],type(e))]
CONCAT-OP : ["{" emit-as-type(args(e)[0],type(e)) "," emit-as-type(args(e)[1],type(e)) "}"]
- BIT-SELECT-OP : [emit-as-type(args(e)[0],type(e)) "[" consts(e)[0] "]"]
- BITS-SELECT-OP : [emit-as-type(args(e)[0],type(e)) "[" consts(e)[0] ":" consts(e)[1] "]"]
+ BIT-SELECT-OP : [emit(args(e)[0]) "[" consts(e)[0] "]"]
+ BITS-SELECT-OP : [emit(args(e)[0]) "[" consts(e)[0] ":" consts(e)[1] "]"]
BIT-AND-REDUCE-OP :
var v = emit-as-type(args(e)[0],type(e))
for x in tail(args(e)) do :
@@ -182,7 +182,7 @@ defn emit-module (m:InModule) :
val decs = HashTable<Symbol,Stmt>(symbol-hash) ; all declarations, for fast lookups
val cons = HashTable<Symbol,Expression>(symbol-hash) ; all connections
val ens = HashTable<Symbol,Expression>(symbol-hash) ; all enables
- val simuls = Vector<Streamable>()
+ val simuls = HashTable<Symbol,Vector<Streamable>>(symbol-hash)
defn build-table (s:Stmt) -> False :
match(s) :
(s:DefWire|DefPoison|DefRegister|DefAccessor|DefMemory|DefNode|DefInstance) :
@@ -195,19 +195,27 @@ defn emit-module (m:InModule) :
ens[n] = pred(s)
cons[n] = exp(conseq(s) as Connect)
(c:PrintfStmt) :
- add(simuls,["if(" emit(pred(s)) ") begin"])
- add(simuls,[" $fdisplay(32/'h80000002," string-join(List(escape(string(c)),map(emit,args(c))), ", ") ");"])
- add(simuls,["end"])
+ val my-clk-simuls = get?(simuls,get-name(clk(c)),Vector<Streamable>())
+ add(my-clk-simuls,["if(" emit(pred(s)) ") begin"])
+ add(my-clk-simuls,[" $fwrite(STDERR," string-join(List(escape(string(c)),map(emit,args(c))), ", ") ");"])
+ add(my-clk-simuls,["end"])
+ simuls[get-name(clk(c))] = my-clk-simuls
(c:StopStmt) :
- add(simuls,["if(" emit(pred(s)) ") begin"])
- add(simuls,[" $fdisplay(32/'h80000002," ret(c) ");"])
- add(simuls,[" $finish;"])
- add(simuls,["end"])
+ val my-clk-simuls = get?(simuls,get-name(clk(c)),Vector<Streamable>())
+ add(my-clk-simuls,["if(" emit(pred(s)) ") begin"])
+ add(my-clk-simuls,[" $fdisplay(STDERR,\"" ret(c) "\");"])
+ add(my-clk-simuls,[" $finish;"])
+ add(my-clk-simuls,["end"])
+ simuls[get-name(clk(c))] = my-clk-simuls
(s:PrintfStmt) :
- add(simuls,["$fdisplay(32/'h80000002," string-join(List(escape(string(s)),map(emit,args(s))), ", ") ");"])
+ val my-clk-simuls = get?(simuls,get-name(clk(s)),Vector<Streamable>())
+ add(my-clk-simuls,["$fwrite(STDERR," string-join(List(escape(string(s)),map(emit,args(s))), ", ") ");"])
+ simuls[get-name(clk(s))] = my-clk-simuls
(c:StopStmt) :
- add(simuls,["$fdisplay(32/'h80000002," ret(c) ");"])
- add(simuls,["$finish;"])
+ val my-clk-simuls = get?(simuls,get-name(clk(c)),Vector<Streamable>())
+ add(my-clk-simuls,["$fdisplay(STDERR,\"" ret(c) "\");"])
+ add(my-clk-simuls,["$finish;"])
+ simuls[get-name(clk(c))] = my-clk-simuls
(s:Connect) :
val n = get-name(loc(s))
cons[n] = exp(s)
@@ -313,6 +321,8 @@ defn emit-module (m:InModule) :
add(assigns,["assign " name(p) " = " emit(cons[name(p)]) ";"])
if length(ports(m)) == 0 : print(");\n")
+ if length(simuls) != 0 : print-all([" integer STDERR = 32'h80000002;\n"])
+
for w in wires do :
print(" ")
println-all(w)
@@ -353,14 +363,15 @@ defn emit-module (m:InModule) :
println-all(u)
println(" end")
- if length(simuls) != 0 :
- println("`ifndef SYNTHESIS")
- println(" always @(*) begin")
- for x in simuls do :
- print(" ")
- println-all(x)
- println(" end")
- println("`endif")
+ for x in simuls do :
+ if length(value(x)) != 0 :
+ println("`ifndef SYNTHESIS")
+ println-all([" always @(posedge " key(x) ") begin"])
+ for u in value(x) do :
+ print(" ")
+ println-all(u)
+ println(" end")
+ println("`endif")
println("endmodule")
diff --git a/test/features/Printf.fir b/test/features/Printf.fir
index 8449825f..2f8dc985 100644
--- a/test/features/Printf.fir
+++ b/test/features/Printf.fir
@@ -5,15 +5,16 @@ circuit Top :
module Top :
input x : {y : UInt<1>}
input p : UInt<1>
- printf("Hello World!\n")
- printf("Hello World! %x\n", x.y)
+ input clk : Clock
+ printf(clk,"Hello World!\n")
+ printf(clk,"Hello World! %x\n", x.y)
when p :
- printf("In consequence\n")
+ printf(clk,"In consequence\n")
else :
- printf("In alternate\n")
+ printf(clk,"In alternate\n")
-;CHECK: printf("Hello World!\n")
-;CHECK: printf("Hello World! %x\n", x$y)
-;CHECK: when p : printf("In consequence\n")
-;CHECK: when not(p) : printf("In alternate\n")
+;CHECK: printf(clk, "Hello World!\n")
+;CHECK: printf(clk, "Hello World! %x\n", x$y)
+;CHECK: when p : printf(clk, "In consequence\n")
+;CHECK: when not(p) : printf(clk, "In alternate\n")
;CHECK: Done!
diff --git a/test/features/Stop.fir b/test/features/Stop.fir
index fc8869fa..16e25416 100644
--- a/test/features/Stop.fir
+++ b/test/features/Stop.fir
@@ -6,15 +6,16 @@ circuit Top :
module Top :
input p : UInt<1>
input q : UInt<1>
+ input clk : Clock
when p :
- stop(0)
+ stop(clk,0)
when q :
- stop(1)
- stop(3)
+ stop(clk,1)
+ stop(clk,3)
-;CHECK: when p : stop(0)
-;CHECK: when q : stop(1)
-;CHECK: stop(3)
+;CHECK: when p : stop(clk, 0)
+;CHECK: when q : stop(clk, 1)
+;CHECK: stop(clk, 3)
;CHECK: Done!
diff --git a/test/parser/gcd.fir b/test/parser/gcd.fir
index 4b068699..fad3b41d 100644
--- a/test/parser/gcd.fir
+++ b/test/parser/gcd.fir
@@ -47,6 +47,6 @@ circuit GCD :
; CHECK: x := a
; CHECK: y := b
; CHECK: z := x
-; CHECK: node T_20 = eq(y, UInt<1>("h0"))
+; CHECK: node T_20 = eq(y, UInt("h0"))
; CHECK: v := T_20
diff --git a/test/passes/inline-indexers/simple10.fir b/test/passes/inline-indexers/simple10.fir
new file mode 100644
index 00000000..2e09c1c1
--- /dev/null
+++ b/test/passes/inline-indexers/simple10.fir
@@ -0,0 +1,18 @@
+; RUN: firrtl -i %s -o %s.v -X verilog -p cg 2>&1 | tee %s.out | FileCheck %s
+
+;CHECK: Inline Indexers
+;CHECK: Done!
+
+circuit DecoupledAdderTests :
+ module DecoupledAdderTests :
+ input clock : Clock
+ input reset : UInt<1>
+ input T_31 : UInt<1>
+ input T_68 : UInt<1>
+ output out : UInt
+ output io : {}
+ wire T_43 : {flip ready : UInt<1>}[1]
+ T_43[0].ready := UInt(0)
+ infer accessor T_69 = T_43[T_31]
+ node T_78 = and(T_68, T_69.ready)
+ out := T_78
diff --git a/test/passes/inline-indexers/simple11.fir b/test/passes/inline-indexers/simple11.fir
new file mode 100644
index 00000000..295c678d
--- /dev/null
+++ b/test/passes/inline-indexers/simple11.fir
@@ -0,0 +1,157 @@
+; RUN: firrtl -i %s -o %s.v -X verilog -p c 2>&1 | tee %s.out | FileCheck %s
+
+;CHECK: Inline Indexers
+;CHECK: Done!
+
+circuit DecoupledAdderTests :
+ module NewDecoupledAdder :
+ input clock : Clock
+ input reset : UInt<1>
+ output io : {flip in : {flip ready : UInt<1>, valid : UInt<1>, bits : {a : UInt<16>, b : UInt<16>}}, out : {flip ready : UInt<1>, valid : UInt<1>, bits : {c : UInt<16>}}}
+
+ io.out.bits.c := UInt<1>("h00")
+ io.out.valid := UInt<1>("h00")
+ io.in.ready := UInt<1>("h00")
+ reg ready : UInt<1>, clock, reset
+ reg busy : UInt<1>, clock, reset
+ reg a_reg : UInt<16>, clock, reset
+ reg b_reg : UInt<16>, clock, reset
+ io.in.ready := ready
+ when io.in.valid :
+ a_reg := io.in.bits.a
+ b_reg := io.in.bits.b
+ io.in.ready := UInt<1>("h00")
+ ready := UInt<1>("h00")
+ busy := UInt<1>("h01")
+ skip
+ node T_45 = and(busy, io.out.ready)
+ when T_45 :
+ node T_46 = addw(a_reg, b_reg)
+ io.out.bits.c := T_46
+ io.out.valid := UInt<1>("h01")
+ io.in.ready := UInt<1>("h01")
+ busy := UInt<1>("h00")
+ skip
+
+ module DecoupledAdderTests :
+ input clock : Clock
+ input reset : UInt<1>
+ output io : {}
+
+ inst device_under_test of NewDecoupledAdder
+ device_under_test.io.out.ready := UInt<1>("h00")
+ device_under_test.io.in.bits.b := UInt<1>("h00")
+ device_under_test.io.in.bits.a := UInt<1>("h00")
+ device_under_test.io.in.valid := UInt<1>("h00")
+ device_under_test.clock := clock
+ device_under_test.reset := reset
+ reg T_10 : UInt<33>, clock, reset
+ onreset T_10 := UInt<33>("h00")
+ node T_12 = addw(T_10, UInt<1>("h01"))
+ T_10 := T_12
+ node T_14 = eq(reset, UInt<1>("h00"))
+ when T_14 :
+ printf(clock, "ticker %d", T_10)
+ skip
+ node T_16 = gt(T_10, UInt<7>("h064"))
+ when T_16 :
+ node T_18 = eq(reset, UInt<1>("h00"))
+ when T_18 :
+ stop(clock, 0)
+ skip
+ skip
+ node T_20 = eq(reset, UInt<1>("h00"))
+ when T_20 :
+ printf(clock, "device out ready %d, valid %d", device_under_test.io.out.ready, device_under_test.io.out.valid)
+ skip
+ node T_22 = eq(reset, UInt<1>("h00"))
+ when T_22 :
+ printf(clock, "device in ready %d, valid %d", device_under_test.io.in.ready, device_under_test.io.in.valid)
+ skip
+ reg T_24 : UInt<1>, clock, reset
+ onreset T_24 := UInt<1>("h00")
+ reg T_26 : UInt<1>, clock, reset
+ onreset T_26 := UInt<1>("h00")
+ node T_27 = and(T_24, T_26)
+ when T_27 :
+ node T_29 = eq(reset, UInt<1>("h00"))
+ when T_29 :
+ stop(clock, 0)
+ skip
+ skip
+ reg T_31 : UInt<1>, clock, reset
+ onreset T_31 := UInt<1>("h00")
+ reg T_33 : UInt<1>, clock, reset
+ onreset T_33 := UInt<1>("h00")
+ wire T_43 : {flip ready : UInt<1>, valid : UInt<1>, bits : {a : UInt<16>, b : UInt<16>}}[1]
+ T_43[0].bits.b := UInt(0)
+ T_43[0].bits.a := UInt(1)
+ T_43[0].valid := UInt(1)
+ device_under_test.io.in <> T_43[0]
+ wire T_64 : UInt<16>[1]
+ T_64[0] := UInt<16>("h04")
+ node T_68 = eq(T_24, UInt<1>("h00"))
+ infer accessor T_69 = T_43[T_31]
+ node T_78 = and(T_68, T_69.ready)
+ when T_78 :
+ node T_80 = eq(reset, UInt<1>("h00"))
+ when T_80 :
+ printf(clock, "input_event_counter %d", T_31)
+ skip
+ infer accessor T_81 = T_64[T_31]
+ device_under_test.io.in.bits.a := T_81
+ skip
+ wire T_84 : UInt<16>[1]
+ T_84[0] := UInt<16>("h07")
+ node T_88 = eq(T_24, UInt<1>("h00"))
+ infer accessor T_89 = T_43[T_31]
+ node T_98 = and(T_88, T_89.ready)
+ when T_98 :
+ node T_100 = eq(reset, UInt<1>("h00"))
+ when T_100 :
+ printf(clock, "input_event_counter %d", T_31)
+ skip
+ infer accessor T_101 = T_84[T_31]
+ device_under_test.io.in.bits.b := T_101
+ skip
+ node T_103 = eq(T_24, UInt<1>("h00"))
+ infer accessor T_104 = T_43[T_31]
+ node T_113 = and(T_103, T_104.ready)
+ when T_113 :
+ infer accessor T_114 = T_43[T_31]
+ T_114.valid := UInt<1>("h01")
+ node T_125 = addw(T_31, UInt<1>("h01"))
+ T_31 := T_125
+ node T_127 = geq(T_31, UInt<1>("h00"))
+ T_24 := T_127
+ skip
+ node T_129 = eq(T_26, UInt<1>("h00"))
+ when T_129 :
+ node T_131 = addw(T_33, UInt<1>("h01"))
+ T_33 := T_131
+ node T_133 = geq(T_33, UInt<1>("h00"))
+ T_26 := T_133
+ skip
+ wire T_136 : UInt<1>[1]
+ T_136[0] := UInt<1>("h01")
+ wire T_141 : UInt<16>[1]
+ T_141[0] := UInt<16>("h03")
+ node T_145 = eq(T_26, UInt<1>("h00"))
+ infer accessor T_146 = T_136[T_33]
+ node T_147 = and(T_145, T_146)
+ node T_148 = and(T_147, device_under_test.io.out.valid)
+ when T_148 :
+ node T_150 = eq(reset, UInt<1>("h00"))
+ when T_150 :
+ printf(clock, "output_event_counter %d", T_33)
+ skip
+ infer accessor T_151 = T_141[T_33]
+ node T_152 = neq(device_under_test.io.out.bits.c, T_151)
+ when T_152 :
+ infer accessor T_153 = T_141[T_33]
+ node T_155 = eq(reset, UInt<1>("h00"))
+ when T_155 :
+ printf(clock, "Error: event %d out.bits.c was %x should be %x", T_33, device_under_test.io.out.bits.c, T_153)
+ skip
+ skip
+ skip
diff --git a/test/performance/Vector1000.fir b/test/performance/Vector1000.fir
new file mode 100644
index 00000000..f5f15a57
--- /dev/null
+++ b/test/performance/Vector1000.fir
@@ -0,0 +1,7 @@
+; RUN: firrtl -i %s -o %s.v -X verilog 2>&1 | tee %s.out | FileCheck %s
+; CHECK: Done!
+circuit Top :
+ module Top :
+ input in1 : UInt<32>[1000]
+ output out : UInt<32>[1000]
+ out := in1
diff --git a/test/performance/Vector2000.fir b/test/performance/Vector2000.fir
new file mode 100644
index 00000000..fa67732e
--- /dev/null
+++ b/test/performance/Vector2000.fir
@@ -0,0 +1,7 @@
+; RUN: firrtl -i %s -o %s.v -X verilog 2>&1 | tee %s.out | FileCheck %s
+; CHECK: Done!
+circuit Top :
+ module Top :
+ input in1 : UInt<32>[2000]
+ output out : UInt<32>[2000]
+ out := in1
diff --git a/test/performance/Vector4000.fir b/test/performance/Vector4000.fir
new file mode 100644
index 00000000..b7d1617f
--- /dev/null
+++ b/test/performance/Vector4000.fir
@@ -0,0 +1,7 @@
+; RUN: firrtl -i %s -o %s.v -X verilog 2>&1 | tee %s.out | FileCheck %s
+; CHECK: Done!
+circuit Top :
+ module Top :
+ input in1 : UInt<32>[4000]
+ output out : UInt<32>[4000]
+ out := in1
diff --git a/test/performance/Vector8000.fir b/test/performance/Vector8000.fir
new file mode 100644
index 00000000..574145fa
--- /dev/null
+++ b/test/performance/Vector8000.fir
@@ -0,0 +1,7 @@
+; RUN: firrtl -i %s -o %s.v -X verilog 2>&1 | tee %s.out | FileCheck %s
+; CHECK: Done!
+circuit Top :
+ module Top :
+ input in1 : UInt<32>[8000]
+ output out : UInt<32>[8000]
+ out := in1