chisel2-deprecated
chisel2-deprecated copied to clipboard
Java Exception (and useless error message) on a Reg of Vec of size 0
I'm experiencing a java.lang.UnsupportedOperationException: empty.head that is caused by a Reg(Vec()) of size 0.
val num_stages = 0
val r_valids = Reg(init = Vec.fill(num_stages) { Bool(false) })
This code worked at least 3 weeks ago (ff885f8), but is not broken on master (f0180d9). Despite what commit (62994f25b6f81c65d9ae4ee8a8e112ae720f11aa) says, I am not seeing any compatibility warning on this.
cd /scratch/celio/clean-rocket-chip && java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar sbt-launch.jar "project rocketchip" "run rocketchip Top BOOMCPPConfig --W0W --minimumCompatibility 3.0.0 --backend c --configName BOOMCPPConfig --compileInitializationUnoptimized --targetDir /scratch/clean-rocket-chip/emulator/generated-src --noIoDebug"
To re-create:
git clone https://github.com/ucb-bar/rocket-chip.git
cd rocket-chip
git checkout boom
git submodule update --init
cd chisel2; git checkout master; git pull (update chisel 2 to latest master)
cd ../emulator
make CONFIG=BOOMCPPConfig
Full stack dump:
[error] (run-main-0) java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at rocketchip.TestGenerator$$anonfun$21.apply(Testing.scala:179)
at rocketchip.TestGenerator$$anonfun$21.apply(Testing.scala:176)
at Chisel.Driver$$anonfun$executeUnwrapped$2$$anonfun$apply$1.apply(Driver.scala:102)
at Chisel.Driver$$anonfun$executeUnwrapped$2$$anonfun$apply$1.apply(Driver.scala:102)
at Chisel.Module$.Chisel$Module$$init(Module.scala:65)
at Chisel.Module$.apply(Module.scala:50)
at Chisel.Driver$$anonfun$executeUnwrapped$2.apply(Driver.scala:102)
at Chisel.Driver$$anonfun$executeUnwrapped$2.apply(Driver.scala:102)
at Chisel.Driver$.execute(Driver.scala:107)
at Chisel.Driver$.executeUnwrapped(Driver.scala:102)
Caused by: java.lang.UnsupportedOperationException: empty.head
at scala.collection.immutable.Vector.head(Vector.scala:193)
at Chisel.Vec$$anonfun$4.apply(Vec.scala:71)
at Chisel.Vec$$anonfun$4.apply(Vec.scala:71)
at Chisel.Vec$.tabulate(Vec.scala:95)
at Chisel.Vec.cloneType(Vec.scala:237)
at Chisel.Vec.cloneType(Vec.scala:117)
at Chisel.Reg$.apply(Reg.scala:89)
at Chisel.Reg$.apply(Reg.scala:83)
at boom.PipelinedFunctionalUnit.<init>(functional_unit.scala:194)
at boom.MemAddrCalcUnit.<init>(functional_unit.scala:540)
at boom.MemExeUnit$$anonfun$20.apply(execute.scala:347)
at boom.MemExeUnit$$anonfun$20.apply(execute.scala:347)
at Chisel.Module$.Chisel$Module$$init(Module.scala:65)
at Chisel.Module$.apply(Module.scala:50)
java.lang.RuntimeException: Nonzero exit code: 1
at scala.sys.package$.error(package.scala:27)
at sbt.BuildCommon$$anonfun$toError$1.apply(Defaults.scala:2077)
at sbt.BuildCommon$$anonfun$toError$1.apply(Defaults.scala:2077)
at scala.Option.foreach(Option.scala:236)
at sbt.BuildCommon$class.toError(Defaults.scala:2077)
at sbt.Defaults$.toError(Defaults.scala:39)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$38$$anonfun$apply$39.apply(Defaults.scala:750)
at sbt.Defaults$$anonfun$runTask$1$$anonfun$apply$38$$anonfun$apply$39.apply(Defaults.scala:748)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[error] (rocketchip/compile:run) Nonzero exit code: 1
[error] Total time: 10 s, completed May 12, 2016 3:13:29 PM