Exceptions while generating C++ Backend

80 views
Skip to first unread message

Arka Maity

unread,
Oct 15, 2015, 4:22:07 AM10/15/15
to chisel-users
Hi Everyone,
                    I am encountering a strange "java.lang.StringIndexOutOfBoundsException: String index out of range: 4" after the "[info] [27.087] NO COMBINATIONAL LOOP FOUND" statement, while generating the C++ Backend. I am using Array("--backend", "c", "--genHarness", "--targetDir", "cppBackend","--compile", "--test", "--Wall","--debug") as the first argument for ChiselMainTest method. I do not encounter such errors while generating the Verilog Backend.

                    My source code is huge and spans multiple files. Just wondering if anyone has any clue about this issue.

sincerely Arka

Kamyar Mohajerani

unread,
Oct 15, 2015, 5:12:08 AM10/15/15
to chisel-users

hi,
could u at least include the stack trace? what version of chisel are u building with?


--
You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
To post to this group, send email to chisel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/2546999f-6769-45c4-9828-5560331fc6b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arka Maity

unread,
Oct 15, 2015, 5:38:48 AM10/15/15
to chisel-users, kam...@ieee.org

Hi,
     Apologies for being vague. I am using the latest chisel release (whatever that is), by specifying "latest.release" in my build.sbt. The stack trace is given below

CPP elaborate
[info] [15.123] // COMPILING < (class MM_IP_NoC.FabricWrapper)>(33)
[info] [16.397] giving names
[info] [17.607] executing custom transforms
[info] [17.608] adding clocks and resets
[info] [18.321] inferring widths
[info] [20.059] checking widths
[info] [20.795] lowering complex nodes to primitives
[info] [20.795] removing type nodes
[info] [21.367] compiling 314255 nodes
[info] [21.367] computing memory ports
[info] [22.384] resolving nodes to the components
[info] [26.108] creating clock domains
[info] [26.479] pruning unconnected IOs
[info] [26.528] checking for unconnected ports
[info] [26.563] checking for combinational loops
[info] [26.969] NO COMBINATIONAL LOOP FOUND
[error] (run-main-0) java.lang.StringIndexOutOfBoundsException: String index out of range: 4

java.lang.StringIndexOutOfBoundsException: String index out of range: 4
    at java.lang.String.charAt(String.java:658)
    at scala.collection.immutable.StringLike$class.apply(StringLike.scala:53)
    at scala.collection.immutable.WrappedString.apply(WrappedString.scala:31)
    at scala.collection.immutable.WrappedString.apply(WrappedString.scala:31)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.immutable.Range.foreach(Range.scala:141)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at Chisel.Backend.genIndent(Backend.scala:721)
    at Chisel.Backend$$anonfun$printStack$1.apply(Backend.scala:724)
    at Chisel.Backend$$anonfun$printStack$1.apply(Backend.scala:723)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
    at scala.collection.AbstractTraversable.map(Traversable.scala:105)
    at Chisel.Backend.printStack(Backend.scala:723)
    at Chisel.Backend.elaborate(Backend.scala:920)
    at Chisel.CppBackend.elaborate(Cpp.scala:1360)
    at Chisel.Driver$.execute(Driver.scala:92)
    at Chisel.Driver$.apply(Driver.scala:40)
    at Chisel.Driver$.apply(Driver.scala:51)
    at Chisel.chiselMain$.apply(hcl.scala:63)
    at Chisel.chiselMainTest$.apply(hcl.scala:76)
    at MM_IP_NoC.MM_IP_NoC$.main(main.scala:111)
    at MM_IP_NoC.MM_IP_NoC.main(main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
[trace] Stack trace suppressed: run last MM_IP_NoC/compile:run for the full output.
java.lang.RuntimeException: Nonzero exit code: 1
    at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last MM_IP_NoC/compile:run for the full output.
[error] (MM_IP_NoC/compile:run) Nonzero exit code: 1

The main.scala from MM_IP_NoC package belongs me. The line 111 from main scala which throws this error
contains

110         case "FabricWrapperTest" => ( chiselMainTest(myargs, moduleToTest)                         
111                       { c => new FabricWrapperTest(c.asInstanceOf[FabricWrapper]) } )

where, moduleToTest = () => Module(new FabricWrapper(TestParams.SRC, TestParams.DST)).

I am meanwhile trying to reproduce the exception for a simple case. I would post the source code, if I able to come up with one.

sincerely Arka

Donggyu Kim

unread,
Oct 18, 2015, 5:59:04 PM10/18/15
to chisel-users, kam...@ieee.org
Hi Arka,

First of all, please check it works without '--Wall'. I have examined the function causing the problem, but it is a very simple function and I cannot reproduce this bug with scala 2.11. Try it with scala 2.11, and let me know if you still have the same problem.

Thanks,
Donggyu

Arka Maity

unread,
Oct 19, 2015, 2:37:05 AM10/19/15
to chisel...@googlegroups.com
Hi Donggyu,
                  Thanks a lot for your response. The code compiles successfully without --Wall option, and I am getting expected results.

                   I tried next with "--Wall" option but with an added "scalaVersion := 2.11.4", in my build.sbt file. I get some other exception sbt.ResolveException, I am trying to figure out how to debug this . btw what version of scala is used by default ?

Arka

--
You received this message because you are subscribed to a topic in the Google Groups "chisel-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/chisel-users/ikFU6A2m9kI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chisel-users...@googlegroups.com.

To post to this group, send email to chisel...@googlegroups.com.

Arka Maity

unread,
Oct 19, 2015, 4:07:04 AM10/19/15
to chisel...@googlegroups.com
Hi Donggyu,
                  Well I resolved the sbt exception, but I do get the same error message with scalaVersion := 2.11.4 with --Wall option enabled.
                  Is it something to do with any bug in my code?
Arka

Donggyu Kim

unread,
Oct 19, 2015, 5:10:31 AM10/19/15
to chisel-users
I doubt it's a scala bug because you got the error from a very trivial function. Let us find a way to avoid it for the next release.
Reply all
Reply to author
Forward
0 new messages