about Bundle constructor

79 views
Skip to first unread message

Hauk Li

unread,
Mar 2, 2013, 7:57:15 AM3/2/13
to chisel...@googlegroups.com
Hi all,
 
I just begin to learn chisel, and not understand the "view_arg" in Bundle's constructor.  as in  the source code:
 
class Bundle(view_arg: Seq[String] = null)
---------------------------------------------------------
 
the older example like this doesn't work:
 
class MyFloat extends Bundle {
val sign = Bool()
val exponent = Bits(width = 8)
val significand = Bits(width = 23)
}
 
while the modified version pass the compilation:
 
class MyFloat extends Bundle(null) {
val sign = Bool()
val exponent = Bits(width = 8)
val significand = Bits(width = 23)
}
 
any help will be appreciated!
 

Jonathan Bachrach

unread,
Mar 2, 2013, 8:11:59 AM3/2/13
to chisel...@googlegroups.com
bundle's view_arg is deprecated.
you shouldn't need it.
none of our code uses it (e.g., ChiselUtils.scala etc)
in other words, the first version of MyFloat should work.

what version of scala are you using?
what scala compiler settings are you using?
would you please send a backtrace?


--
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/msg/chisel-users/-/qwF9tNQvcpUJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Hauk Li

unread,
Mar 3, 2013, 2:49:36 AM3/3/13
to chisel...@googlegroups.com
i use eclipse with scala ide plugin, the scala version is 2.10.0
before create my scala project i use sbt to build a chisel library, and ref it in the project
 
the ide just complain a syntax error:
"not enough arguments for constructor Bundle: (view_arg: Seq[String])Chisel.Bundle"
 

 

Sebastien Mirolo

unread,
Mar 3, 2013, 4:15:24 AM3/3/13
to chisel...@googlegroups.com
Hi Hauk,

I think your problem is related to a scala version mismatch. When you use sbt, Chisel is compiled with scala-2.9.X at this point.

I have been able to reproduce your problem by running the following commands:

$ cd chisel
$ sbt package
$ cat src/test/scala/Example.scala
import Chisel._

class MyFloat extends Bundle {
val sign = Bool()
val exponent = Bits(width = 8)
val significand = Bits(width = 23)
}

$ scalac-2.9 -cp target/scala-2.9.1/chisel_2.9.1-1.1-SNAPSHOT.jar src/test/scala/Example.scala
$ ls *.class
MyFloat.class

$ rm MyFloat.class
$ scalac-2.10 -cp target/scala-2.9.1/chisel_2.9.1-1.1-SNAPSHOT.jar src/test/scala/Example.scala
src/test/scala/Example.scala:3: error: not enough arguments for constructor Bundle: (view_arg: Seq[String])Chisel.Bundle
class MyFloat extends Bundle {
              ^
one error found

I suggest you stick with scala-2.9 for a while when using Chisel (if possible). In the meantime we will investigate if it is a class binary format mismatch between scala-2.9 and scala-2.10 or just that the scala compiler became a lot more strict about default parameters. Either way I will let you know as soon as we have an estimate of when a scala-2.10 Chisel version will be available.

Thank you very much for this bug report,
Sebastien.


--
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/msg/chisel-users/-/YaEmbL4ISfIJ.

Hauk Li

unread,
Mar 6, 2013, 10:51:38 AM3/6/13
to chisel...@googlegroups.com
Thanks a lot!
 
I will try to rewrite one of my fpga design, with chisel, to implement an interface between fpga and stm32 mcu, expect surprise...
Reply all
Reply to author
Forward
0 new messages