1

I'm trying to use chisel 3.

I tried to test GCD.scala file in the chisel project template repo using sbt test and sbt "test-only example.GCD" commands following the answer to a previous question. But this gives an error(s) that I cannot find the reason for. I didn't do any changes to the build.sbt file or repo layout. I'm posting only the last part of the error message since it is very long and repetitive.

[info] Loading project definition from /home/isuru/fyp/ChiselProjects/TrialProject/project
[info] Set current project to chisel-module-template (in build file:/home/isuru/fyp/ChiselProjects/TrialProject/)
[info] Compiling 1 Scala source to /home/isuru/fyp/ChiselProjects/TrialProject/target/scala-2.11/classes...
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:5: not found: object Chisel3
[error] import Chisel3._
[error]        ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:7: not found: type Module
[error] class GCD extends Module {
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:8: not found: type Bundle
[error]   val io = new Bundle {
[error]                ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:9: not found: value UInt
[error]     val a  = UInt(INPUT,  16)
[error]              ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:9: not found: value INPUT
[error]     val a  = UInt(INPUT,  16)
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:10: not found: value UInt
[error]     val b  = UInt(INPUT,  16)
[error]              ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:10: not found: value INPUT
[error]     val b  = UInt(INPUT,  16)
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:11: not found: value Bool
[error]     val e  = Bool(INPUT)
[error]              ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:11: not found: value INPUT
[error]     val e  = Bool(INPUT)
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:12: not found: value UInt
[error]     val z  = UInt(OUTPUT, 16)
[error]              ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:12: not found: value OUTPUT
[error]     val z  = UInt(OUTPUT, 16)
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:13: not found: value Bool
[error]     val v  = Bool(OUTPUT)
[error]              ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:13: not found: value OUTPUT
[error]     val v  = Bool(OUTPUT)
[error]                   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:15: not found: value Reg
[error]   val x  = Reg(UInt())
[error]            ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:15: not found: value UInt
[error]   val x  = Reg(UInt())
[error]                ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:16: not found: value Reg
[error]   val y  = Reg(UInt())
[error]            ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:16: not found: value UInt
[error]   val y  = Reg(UInt())
[error]                ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:17: not found: value when
[error]   when   (x > y) { x := x - y }
[error]   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:18: not found: value unless
[error]   unless (x > y) { y := y - x }
[error]   ^
[error] /home/isuru/fyp/ChiselProjects/TrialProject/src/main/scala/example/GCD.scala:19: not found: value when
[error]   when (io.e) { x := io.a; y := io.b }
[error]   ^
[error] 20 errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 2 s, completed Dec 1, 2016 8:26:25 PM

2 Answers 2

2

The errors you have shown suggest that sbt is somehow not finding Chisel, could you by chance show the full list of errors (especially early on ones)? With the following sequence of commands I am unable to reproduce the errors you are seeing:

git clone [email protected]:ucb-bar/chisel-template.git    
cd chisel-template    
sbt test

It is not the cause of this issue, but to run the test in chisel-template you should actually run sbt "test-only examples.test.GCDTester". example.GCD is the top of the design, but to run the test you have to refer to the Tester class in src/test/scala/examples/test/GCDUnitTest.scala.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks jkoenig for the fast response. I edited the question to include complete error message. However, now I cloned the template again and ran sbt test and test-only for GCDTester in that new directory. Both work fine. So, is the error somehow due to a problem with my previous clone of the template? Thanks again for the advice.
No problem! So in your original example, the issue is import Chisel3._. The package name is actually chisel3 and packages are case sensitive in Scala! I'm glad the clean clone is working! My guess is that previously it was just a typo.
Thanks again. I had absolutely no idea what was going wrong. Otherwise I would've posted the whole error messages in the original question. Sorry about that.
No worries at all! I had similar problems when I was learning Chisel, there is a lot of new stuff involved!
-1

I just encountered this same problem when making my own chisel project. However it was not that the import chisel3._ was wrong. The problem I had was I did not have a build.sbt file included in my directory.

I found my solution here. https://chisel.eecs.berkeley.edu/2.0.6/getting-started.html

2 Comments

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review
The solution is to make sure a build.sbt file is in the same directory as the project that is giving this error. The link mentions this requirement under section 6.1, it states "In order to create your own projects from scratch, you will need to create a directory, a Chisel source file, and a build.sbt configuration file."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.