value is not a member of chisel3.Bundle

Viewed 1363

sbt does not recognize a bundle. Errors are these:

[error] /home/xxx/src/main/scala/NoC.scala:12:8: value Grant is not a member of chisel3.Bundle
[error]     io.Grant := io.Req & !io.Rls
[error]        ^
[error] /home/xxx/src/main/scala/NoC.scala:12:20: value Req is not a member of chisel3.Bundle
[error]     io.Grant := io.Req & !io.Rls
[error]                    ^
[error] /home/xxx/src/main/scala/NoC.scala:12:30: value Rls is not a member of chisel3.Bundle
[error]     io.Grant := io.Req & !io.Rls
[error]                              ^

Reproducible code is;

//Priority Encoder
class P_Encoder() extends Module {
    val io = IO(new Bundle {
        val Req         = Input(Bool())    //Requests
        val Rls         = Input(Bool())    //Releases
        val Grant       = Output(Bool())   //Grants
    })

    io.Grant := io.Req & !io.Rls
}

Probably I missed something on grammers, but not yet find out. Does anyone can point out?

1 Answers

This is due to a change in type inference between Scala 2.11 and 2.12. You can work around this issue by adding -Xsource:2.11 to your scalacOptions in your build.sbt. You'll see this in most chisel3 projects like the chisel-template, rocket-chip, and sifive/freedom. It's generally a good idea to create new projects from the chisel-template until you are comfortable with the Scala ecosystem and the related tools (like SBT).

Related