Coder Social home page Coder Social logo

chisel-tutorial's Introduction

Chisel Tutorials (Release branch)

These are the tutorials for Chisel.

Chisel is an open-source hardware construction language developed at UC Berkeley that supports advanced hardware design using highly parameterized generators and layered domain-specific hardware languages.

Getting the Repo

$ git clone https://github.com/ucb-bar/chisel-tutorial.git
$ cd chisel-tutorial
$ git fetch origin
$ git checkout release

Executing Chisel

####Testing Your System First make sure that you have sbt (the scala build tool) installed. See details in sbt.

$ sbt run

This will generate and test a simple block (Hello) that always outputs the number 42 (aka 0x2a). You should see [success] on the last line of output (from sbt) and PASSED on the line before indicating the block passed the testcase. If you are doing this for the first time, sbt will automatically download the appropriate versions of Chisel3, the Chisel Testers harness and Scala and cache them (usually in ~/.ivy2).

Completing the Tutorials

To learn Chisel, we recommend learning by example and just trying things out. To help with this, we have produced exercises with circuits (src/main/scala/problems) and their associated test harnesses (src/test/scala/problems) which have clearly marked places to complete their functionality and simple test cases. You can compare your work with our sample solutions in (src/main/scala/solutions) and (src/test/scala/solutions). This hierarchical organization and separation of circuits and tests is a good practice and we encourage you to understand it and use it in the future. Typically when you work on a problem you will have two open editor windows (vi, emacs, IDE, etc) one to edit the circuit and the other to edit the tests.

To speed things up, we will keep sbt running. To get started:

$ sbt

Mux2

This should already work. Try

> test:runMain problems.Launcher Mux2

Note that Mux2 is defined in Mux4.scala.

Mux4

You can instantiate a module with val foo = Module(new Bar())

> test:runMain problems.Launcher Mux4

Counter

You can conditionally update a value without a mux by using when (cond) { foo := bar }

> test:runMain problems.Launcher Counter

Vending Machine

> test:runMain problems.Launcher VendingMachine

Memo

The type of memory that's inferred is based on how you handle the read and write enables. This is pretty much the same as how Xilinx and Altera infer memories.

> test:runMain problems.Launcher Memo

Mul

> test:runMain problems.Launcher Mul

RealGCD

> test:runMain problems.Launcher RealGCD

To check that all of your solutions are correct:

$ ./run-problem.sh all

To run all of our reference solutions:

$ ./run-solution.sh all

Note: ./run-problem.sh, ./run-solution.sh, ./run-examples.sh are convenience scripts to invoke tests

Learning More Chisel

In addition to the problems and the solutions, we have also provided some examples of more complex circuits (src/main/scala/examples) and (src/test/scala/examples). You should take a look at the source and test them out:

$ ./run-examples.sh all

The wiki attached to this repo contains more information on working with Chisel. Additional documentation may be found on the chisel3 repo wiki and the documentation section of the website.

Fixes/Updates

If you wish to submit pull requests for changes to this repo, plus check out the master branch, and make your pull requests against that branch.

chisel-tutorial's People

Contributors

aaronjanse avatar albert-magyar avatar amsharifian avatar asmitde avatar azureskyresearch avatar bqwer avatar chick avatar cjdrake avatar colinschmidt avatar danluu avatar donggyukim avatar dt27182 avatar edwardcwang avatar felixonmars avatar grebe avatar huytbvo avatar j-marjanovic avatar jackbackrack avatar jeffesquivels avatar muojp avatar oharboe avatar palmer-dabbelt avatar pranith avatar sbeamer avatar schoeberl avatar timkpaine avatar ucbjrl avatar winksaville avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chisel-tutorial's Issues

Cat(x,y) and Fill(x,y) are utilities and require separate import statement

To use Cat(x,y) and Fill(x,y) one need to import chisel3.utils._ besides import chisel3._
It's demonstrated in examples so it's not critical issue but I believe it should be stated in Chisel Tutorial in explicit way.

When you are reading a tutorial you assume that you don't need to do anything special to be able to use all Chisel operators ( Cat(x,y) and Fill(x,y) are mentioned in section "5. Builtin Operators" and in "Table 1: Chisel operators on builtin data types" )

Chisel Manual and Chisel CheatSheet doesn't mention it either.
Chisel 3 Wiki mentions only import chisel3._ in xviii and xix.

After reading Scala documentation I expected that import chisel3._ would automatically import chisel3.utils._ but it seems to be wrong. If you don't import chisel3.utils._ while using Cat(x,y) or Fill(x,y) you will get compilation error: not found: value Cat or not found: value Fill

Facing issue while generating verilog

Following the steps here
At the "Generating Verilog" step when I run ./run-examples.sh GCD --backend-name verilator command, I get an error like so:

`D --backend-name verilator
[process_args] java_version = '1.8.0_151'
 Executing command line:
java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-jar
/usr/share/sbt-launcher-packaging/bin/sbt-launch.jar
"test:run-main examples.Launcher GCD --backend-name verilator"

[info] Loading project definition from /home/sairamganti/Documents/devenv/chisel-tutorial/project
[info] Set current project to chisel-tutorial (in build file:/home/sairamganti/Documents/devenv/chisel-tutorial/)
[info] Running examples.Launcher GCD --backend-name verilator
Starting tutorial GCD
[info] [0.001] Elaborating design...
[info] [0.076] Done elaborating.
Total FIRRTL Compile Time: 878.7 ms
verilator --cc /home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD/GCD.v --assert -Wno-fatal -Wno-WIDTH -Wno-STMTDLY --trace -O1 --top-module GCD +define+TOP_TYPE=VGCD +define+PRINTF_COND=!GCD.reset +define+STOP_COND=!GCD.reset -CFLAGS -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h -Mdir /home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD --exe /home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD/GCD-harness.cpp
make: Entering directory '/home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD'
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h   -c -o GCD-harness.o /home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD/GCD-harness.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h   -c -o verilated.o /usr/local/share/verilator/include/verilated.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h   -c -o verilated_vcd_c.o /usr/local/share/verilator/include/verilated_vcd_c.cpp
/usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VGCD.cpp > VGCD__ALLcls.cpp
/usr/bin/perl /usr/local/share/verilator/bin/verilator_includer -DVL_INCLUDE_OPT=include VGCD__Trace.cpp VGCD__Syms.cpp VGCD__Trace__Slow.cpp > VGCD__ALLsup.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h   -c -o VGCD__ALLcls.o VGCD__ALLcls.cpp
g++  -I.  -MMD -I/usr/local/share/verilator/include -I/usr/local/share/verilator/include/vltstd -DVL_PRINTF=printf -DVM_COVERAGE=0 -DVM_SC=0 -DVM_TRACE=1 -Wno-sign-compare -Wno-uninitialized -Wno-unused-but-set-variable -Wno-unused-parameter -Wno-unused-variable -Wno-shadow     -Wno-undefined-bool-conversion -O1 -DTOP_TYPE=VGCD -DVL_USER_FINISH -include VGCD.h   -c -o VGCD__ALLsup.o VGCD__ALLsup.cpp
      Archiving VGCD__ALL.a ...
ar r VGCD__ALL.a VGCD__ALLcls.o VGCD__ALLsup.o
ranlib VGCD__ALL.a
g++    GCD-harness.o verilated.o verilated_vcd_c.o VGCD__ALL.a    -o VGCD -lm -lstdc++  2>&1 | c++filt
verilated.o: In function `VL_FINISH_MT(char const*, int, char const*)':
verilated.cpp:(.text+0x7): undefined reference to `vl_finish(char const*, int, char const*)'
collect2: error: ld returned 1 exit status
make: Leaving directory '/home/sairamganti/Documents/devenv/chisel-tutorial/test_run_dir/examples/GCD'
java.lang.IllegalArgumentException: requirement failed: test_run_dir/examples/GCD/VGCD doesn't exist
	at scala.Predef$.require(Predef.scala:224)
	at chisel3.iotesters.TesterProcess$.apply(PeekPokeTesterUtils.scala:153)
	at chisel3.iotesters.SimApiInterface.<init>(SimApiInterface.scala:36)
	at chisel3.iotesters.VerilatorBackend.<init>(VerilatorBackend.scala:281)
	at chisel3.iotesters.setupVerilatorBackend$.apply(VerilatorBackend.scala:270)
	at chisel3.iotesters.Driver$$anonfun$execute$1$$anonfun$apply$mcZ$sp$1.apply$mcZ$sp(Driver.scala:53)
	at chisel3.iotesters.Driver$$anonfun$execute$1$$anonfun$apply$mcZ$sp$1.apply(Driver.scala:38)
	at chisel3.iotesters.Driver$$anonfun$execute$1$$anonfun$apply$mcZ$sp$1.apply(Driver.scala:38)
	at logger.Logger$$anonfun$makeScope$1.apply(Logger.scala:129)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
	at logger.Logger$.makeScope(Logger.scala:127)
	at chisel3.iotesters.Driver$$anonfun$execute$1.apply$mcZ$sp(Driver.scala:38)
	at chisel3.iotesters.Driver$$anonfun$execute$1.apply(Driver.scala:38)
	at chisel3.iotesters.Driver$$anonfun$execute$1.apply(Driver.scala:38)
	at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
	at chisel3.iotesters.Driver$.execute(Driver.scala:37)
	at examples.Launcher$$anonfun$13.apply(Launcher.scala:70)
	at examples.Launcher$$anonfun$13.apply(Launcher.scala:69)
	at utils.TutorialRunner$$anonfun$apply$2.apply(TutorialRunner.scala:43)
	at utils.TutorialRunner$$anonfun$apply$2.apply(TutorialRunner.scala:36)
	at scala.collection.immutable.List.foreach(List.scala:392)
	at utils.TutorialRunner$.apply(TutorialRunner.scala:36)
	at examples.Launcher$.main(Launcher.scala:111)
	at examples.Launcher.main(Launcher.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.Run.invokeMain(Run.scala:67)
	at sbt.Run.run0(Run.scala:61)
	at sbt.Run.sbt$Run$$execute$1(Run.scala:51)
	at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55)
	at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
	at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
	at sbt.Logger$$anon$4.apply(Logger.scala:84)
	at sbt.TrapExit$App.run(TrapExit.scala:248)
	at java.lang.Thread.run(Thread.java:748)
================================================================================
Errors: 1: in the following tutorials
Tutorial GCD: exception requirement failed: test_run_dir/examples/GCD/VGCD doesn't exist
================================================================================

`_

Any help?

Conditional Assignments and Memories tutorial issue

Hi, I think there is an issue in this tutorial in the line "val read_port1 = UInt(32.W)". Should it be "val read_port1 = Wire(UInt(32.W))"? Because UInt is a bare Chisel type and the following exception takes a place: "ExpectedHardwareException ... must be hardware, not a bare Chisel type" if just UInt is used.

error with sbt run

  at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
    at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
    at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
    at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1429)
    at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1403)
    at scala.Function1.$anonfun$compose$1(Function1.scala:44)
    at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
    at sbt.std.Transform$$anon$4.work(System.scala:66)
    at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
    at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
    at sbt.Execute.work(Execute.scala:271)
    at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
    at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

[info] Attempting to fetch org.scala-sbt:compiler-bridge_2.11:1.1.1.
[error] ## Exception when compiling 56 sources to C:\Users\salman\chisel-tutorial\target\scala-2.11\classes
[error] null
[error] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[error] java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[error] java.base/java.lang.reflect.Method.invoke(Unknown Source)
[error] sbt.internal.inc.RawCompiler.getReporter$1(RawCompiler.scala:50)
[error] sbt.internal.inc.RawCompiler.apply(RawCompiler.scala:71)
[error] sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$6(AnalyzingCompiler.scala:350)
[error] sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:327)
[error] sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4(AnalyzingCompiler.scala:346)
[error] sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4$adapted(AnalyzingCompiler.scala:341)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2(AnalyzingCompiler.scala:341)
[error] sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2$adapted(AnalyzingCompiler.scala:335)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] sbt.internal.inc.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:335)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$3(ZincComponentCompiler.scala:271)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$3$adapted(ZincComponentCompiler.scala:256)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$2(ZincComponentCompiler.scala:256)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] sbt.internal.util.BufferedLogger.bufferQuietly(BufferedLogger.scala:106)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$1(ZincComponentCompiler.scala:256)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$1$adapted(ZincComponentCompiler.scala:253)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] sbt.internal.inc.ZincComponentCompiler.compileAndInstall(ZincComponentCompiler.scala:253)
[error] sbt.internal.inc.ZincComponentCompiler.$anonfun$compiledBridgeJar$1(ZincComponentCompiler.scala:219)
[error] sbt.internal.inc.IfMissing$Define.run(IfMissing.scala:19)
[error] sbt.internal.inc.ZincComponentManager.createAndCache$1(ZincComponentManager.scala:46)
[error] sbt.internal.inc.ZincComponentManager.$anonfun$files$3(ZincComponentManager.scala:57)
[error] sbt.internal.inc.ZincComponentManager.getOrElse$1(ZincComponentManager.scala:38)
[error] sbt.internal.inc.ZincComponentManager.$anonfun$files$2(ZincComponentManager.scala:57)
[error] sbt.internal.inc.ZincComponentManager$$anon$1.call(ZincComponentManager.scala:87)
[error] xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] xsbt.boot.Using$.withResource(Using.scala:10)
[error] xsbt.boot.Using$.apply(Using.scala:9)
[error] xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] xsbt.boot.Locks$.apply(Locks.scala:28)
[error] sbt.internal.inc.ZincComponentManager.lock(ZincComponentManager.scala:87)
[error] sbt.internal.inc.ZincComponentManager.$anonfun$lockSecondaryCache$1(ZincComponentManager.scala:84)
[error] scala.Option.map(Option.scala:146)
[error] sbt.internal.inc.ZincComponentManager.lockSecondaryCache(ZincComponentManager.scala:82)
[error] sbt.internal.inc.ZincComponentManager.fromSecondary$1(ZincComponentManager.scala:55)
[error] sbt.internal.inc.ZincComponentManager.$anonfun$files$6(ZincComponentManager.scala:61)
[error] sbt.internal.inc.ZincComponentManager.getOrElse$1(ZincComponentManager.scala:38)
[error] sbt.internal.inc.ZincComponentManager.$anonfun$files$5(ZincComponentManager.scala:61)
[error] sbt.internal.inc.ZincComponentManager$$anon$1.call(ZincComponentManager.scala:87)
[error] xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] xsbt.boot.Using$.withResource(Using.scala:10)
[error] xsbt.boot.Using$.apply(Using.scala:9)
[error] xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] xsbt.boot.Locks$.apply(Locks.scala:28)
[error] sbt.internal.inc.ZincComponentManager.lock(ZincComponentManager.scala:87)
[error] sbt.internal.inc.ZincComponentManager.lockLocalCache(ZincComponentManager.scala:78)
[error] sbt.internal.inc.ZincComponentManager.files(ZincComponentManager.scala:61)
[error] sbt.internal.inc.ZincComponentManager.file(ZincComponentManager.scala:66)
[error] sbt.internal.inc.ZincComponentCompiler.compiledBridgeJar(ZincComponentCompiler.scala:219)
[error] sbt.internal.inc.ZincComponentCompiler$ZincCompilerBridgeProvider.compiledBridge(ZincComponentCompiler.scala:84)
[error] sbt.internal.inc.ZincComponentCompiler$ZincCompilerBridgeProvider.fetchCompiledBridge(ZincComponentCompiler.scala:91)
[error] sbt.internal.inc.AnalyzingCompiler.loader(AnalyzingCompiler.scala:249)
[error] sbt.internal.inc.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:267)
[error] sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:234)
[error] sbt.internal.inc.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:134)
[error] sbt.internal.inc.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:121)
[error] sbt.internal.inc.FreshCompilerCache.apply(CompilerCache.scala:78)
[error] sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:88)
[error] sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
[error] scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
[error] sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
[error] sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
[error] sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
[error] sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
[error] sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
[error] sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
[error] sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error] sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error] sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error] sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error] sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error] sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error] sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1429)
[error] sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1403)
[error] scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] sbt.std.Transform$$anon$4.work(System.scala:66)
[error] sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] sbt.Execute.work(Execute.scala:271)
[error] sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[error] java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[error] java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[error] java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[error] java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[error] java.base/java.lang.Thread.run(Unknown Source)
[error]
[error] java.lang.NullPointerException
[error] at scala.reflect.io.JavaToolsPlatformArchive.iterator(ZipArchive.scala:301)
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] at scala.reflect.io.AbstractFile.foreach(AbstractFile.scala:92)
[error] at scala.tools.nsc.util.DirectoryClassPath.traverse(ClassPath.scala:277)
[error] at scala.tools.nsc.util.DirectoryClassPath.x$15$lzycompute(ClassPath.scala:299)
[error] at scala.tools.nsc.util.DirectoryClassPath.x$15(ClassPath.scala:299)
[error] at scala.tools.nsc.util.DirectoryClassPath.packages$lzycompute(ClassPath.scala:299)
[error] at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:299)
[error] at scala.tools.nsc.util.DirectoryClassPath.packages(ClassPath.scala:264)
[error] at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:358)
[error] at scala.tools.nsc.util.MergedClassPath$$anonfun$packages$1.apply(ClassPath.scala:358)
[error] at scala.collection.Iterator$class.foreach(Iterator.scala:891)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
[error] at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at scala.tools.nsc.util.MergedClassPath.packages$lzycompute(ClassPath.scala:358)
[error] at scala.tools.nsc.util.MergedClassPath.packages(ClassPath.scala:353)
[error] at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader$$anonfun$doComplete$1.apply$mcV$sp(SymbolLoaders.scala:269)
[error] at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader$$anonfun$doComplete$1.apply(SymbolLoaders.scala:260)
[error] at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader$$anonfun$doComplete$1.apply(SymbolLoaders.scala:260)
[error] at scala.reflect.internal.SymbolTable.enteringPhase(SymbolTable.scala:235)
[error] at scala.tools.nsc.symtab.SymbolLoaders$PackageLoader.doComplete(SymbolLoaders.scala:260)
[error] at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:211)
[error] at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1535)
[error] at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:256)
[error] at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:73)
[error] at scala.tools.nsc.Global.rootMirror(Global.scala:71)
[error] at scala.tools.nsc.Global.rootMirror(Global.scala:39)
[error] at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:257)
[error] at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:257)
[error] at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1390)
[error] at scala.tools.nsc.Global$Run.(Global.scala:1242)
[error] at scala.tools.nsc.Driver.doCompile(Driver.scala:31)
[error] at scala.tools.nsc.MainClass.doCompile(Main.scala:23)
[error] at scala.tools.nsc.Driver.process(Driver.scala:51)
[error] at scala.tools.nsc.Main.process(Main.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[error] at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[error] at sbt.internal.inc.RawCompiler.getReporter$1(RawCompiler.scala:50)
[error] at sbt.internal.inc.RawCompiler.apply(RawCompiler.scala:71)
[error] at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$6(AnalyzingCompiler.scala:350)
[error] at sbt.internal.inc.AnalyzingCompiler$.handleCompilationError$1(AnalyzingCompiler.scala:327)
[error] at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4(AnalyzingCompiler.scala:346)
[error] at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$4$adapted(AnalyzingCompiler.scala:341)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2(AnalyzingCompiler.scala:341)
[error] at sbt.internal.inc.AnalyzingCompiler$.$anonfun$compileSources$2$adapted(AnalyzingCompiler.scala:335)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] at sbt.internal.inc.AnalyzingCompiler$.compileSources(AnalyzingCompiler.scala:335)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$3(ZincComponentCompiler.scala:271)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$3$adapted(ZincComponentCompiler.scala:256)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$2(ZincComponentCompiler.scala:256)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.internal.util.BufferedLogger.bufferQuietly(BufferedLogger.scala:106)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$1(ZincComponentCompiler.scala:256)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compileAndInstall$1$adapted(ZincComponentCompiler.scala:253)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:376)
[error] at sbt.io.IO$.withTemporaryDirectory(IO.scala:383)
[error] at sbt.internal.inc.ZincComponentCompiler.compileAndInstall(ZincComponentCompiler.scala:253)
[error] at sbt.internal.inc.ZincComponentCompiler.$anonfun$compiledBridgeJar$1(ZincComponentCompiler.scala:219)
[error] at sbt.internal.inc.IfMissing$Define.run(IfMissing.scala:19)
[error] at sbt.internal.inc.ZincComponentManager.createAndCache$1(ZincComponentManager.scala:46)
[error] at sbt.internal.inc.ZincComponentManager.$anonfun$files$3(ZincComponentManager.scala:57)
[error] at sbt.internal.inc.ZincComponentManager.getOrElse$1(ZincComponentManager.scala:38)
[error] at sbt.internal.inc.ZincComponentManager.$anonfun$files$2(ZincComponentManager.scala:57)
[error] at sbt.internal.inc.ZincComponentManager$$anon$1.call(ZincComponentManager.scala:87)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.inc.ZincComponentManager.lock(ZincComponentManager.scala:87)
[error] at sbt.internal.inc.ZincComponentManager.$anonfun$lockSecondaryCache$1(ZincComponentManager.scala:84)
[error] at scala.Option.map(Option.scala:146)
[error] at sbt.internal.inc.ZincComponentManager.lockSecondaryCache(ZincComponentManager.scala:82)
[error] at sbt.internal.inc.ZincComponentManager.fromSecondary$1(ZincComponentManager.scala:55)
[error] at sbt.internal.inc.ZincComponentManager.$anonfun$files$6(ZincComponentManager.scala:61)
[error] at sbt.internal.inc.ZincComponentManager.getOrElse$1(ZincComponentManager.scala:38)
[error] at sbt.internal.inc.ZincComponentManager.$anonfun$files$5(ZincComponentManager.scala:61)
[error] at sbt.internal.inc.ZincComponentManager$$anon$1.call(ZincComponentManager.scala:87)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.inc.ZincComponentManager.lock(ZincComponentManager.scala:87)
[error] at sbt.internal.inc.ZincComponentManager.lockLocalCache(ZincComponentManager.scala:78)
[error] at sbt.internal.inc.ZincComponentManager.files(ZincComponentManager.scala:61)
[error] at sbt.internal.inc.ZincComponentManager.file(ZincComponentManager.scala:66)
[error] at sbt.internal.inc.ZincComponentCompiler.compiledBridgeJar(ZincComponentCompiler.scala:219)
[error] at sbt.internal.inc.ZincComponentCompiler$ZincCompilerBridgeProvider.compiledBridge(ZincComponentCompiler.scala:84)
[error] at sbt.internal.inc.ZincComponentCompiler$ZincCompilerBridgeProvider.fetchCompiledBridge(ZincComponentCompiler.scala:91)
[error] at sbt.internal.inc.AnalyzingCompiler.loader(AnalyzingCompiler.scala:249)
[error] at sbt.internal.inc.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:267)
[error] at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:234)
[error] at sbt.internal.inc.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:134)
[error] at sbt.internal.inc.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:121)
[error] at sbt.internal.inc.FreshCompilerCache.apply(CompilerCache.scala:78)
[error] at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:88)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
[error] at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
[error] at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
[error] at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
[error] at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
[error] at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
[error] at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
[error] at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
[error] at sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error] at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error] at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error] at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error] at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error] at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1429)
[error] at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1403)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[error] at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[error] at java.base/java.lang.Thread.run(Unknown Source)
[error] (Compile / compileIncremental) java.lang.reflect.InvocationTargetException
[error] Total time: 19 s, completed Jul 31, 2018, 4:07:46 AM

Documentation on tutorial wrong: missing GCD.scala

Going through the tutorial documentation and the first example is missing from the directory location specified. "The Basics" page directs the user to src/main/scala/examples/ and open up GCD.scala but that doesn't exist. Fortunately the documentation includes the contents of the file but this should be clarified or cleaned up.

Error when running the examples

Hi. sbt run and test:run-main problems.Launcher Mux2 work fine. But all other examples fail.

test:run-main problems.Launcher Mux4

Produces:

[info] Running problems.Launcher Mux4
Starting tutorial Mux4
[info] [0.002] Elaborating design...
[info] [0.089] Done elaborating.
Total FIRRTL Compile Time: 195.8 ms
Total FIRRTL Compile Time: 38.1 ms
End of dependency graph
Circuit state created
[info] [0.001] SEED 1498765114985
[info] [0.009] EXPECT AT 9   io_out got 0 expected 1 FAIL
[info] [0.009] EXPECT AT 10   io_out got 0 expected 1 FAIL
[info] [0.010] EXPECT AT 11   io_out got 0 expected 1 FAIL
[info] [0.011] EXPECT AT 12   io_out got 0 expected 1 FAIL
[info] [0.012] EXPECT AT 13   io_out got 0 expected 1 FAIL
[info] [0.013] EXPECT AT 14   io_out got 0 expected 1 FAIL
[info] [0.014] EXPECT AT 15   io_out got 0 expected 1 FAIL
[info] [0.014] EXPECT AT 16   io_out got 0 expected 1 FAIL
[info] [0.016] EXPECT AT 19   io_out got 0 expected 1 FAIL
[info] [0.017] EXPECT AT 20   io_out got 0 expected 1 FAIL
[info] [0.019] EXPECT AT 23   io_out got 0 expected 1 FAIL
[info] [0.019] EXPECT AT 24   io_out got 0 expected 1 FAIL
[info] [0.021] EXPECT AT 27   io_out got 0 expected 1 FAIL
[info] [0.022] EXPECT AT 28   io_out got 0 expected 1 FAIL
[info] [0.024] EXPECT AT 31   io_out got 0 expected 1 FAIL
[info] [0.024] EXPECT AT 32   io_out got 0 expected 1 FAIL
[info] [0.027] EXPECT AT 37   io_out got 0 expected 1 FAIL
[info] [0.028] EXPECT AT 38   io_out got 0 expected 1 FAIL
[info] [0.029] EXPECT AT 39   io_out got 0 expected 1 FAIL
[info] [0.029] EXPECT AT 40   io_out got 0 expected 1 FAIL
[info] [0.032] EXPECT AT 45   io_out got 0 expected 1 FAIL
[info] [0.033] EXPECT AT 46   io_out got 0 expected 1 FAIL
[info] [0.033] EXPECT AT 47   io_out got 0 expected 1 FAIL
[info] [0.034] EXPECT AT 48   io_out got 0 expected 1 FAIL
[info] [0.035] EXPECT AT 50   io_out got 0 expected 1 FAIL
[info] [0.036] EXPECT AT 52   io_out got 0 expected 1 FAIL
[info] [0.037] EXPECT AT 54   io_out got 0 expected 1 FAIL
[info] [0.038] EXPECT AT 56   io_out got 0 expected 1 FAIL
[info] [0.039] EXPECT AT 58   io_out got 0 expected 1 FAIL
[info] [0.041] EXPECT AT 60   io_out got 0 expected 1 FAIL
[info] [0.042] EXPECT AT 62   io_out got 0 expected 1 FAIL
[info] [0.043] EXPECT AT 64   io_out got 0 expected 1 FAIL
test Mux4 Success: 32 tests passed in 69 cycles taking 0.049389 seconds
[info] [0.043] RAN 64 CYCLES FAILED FIRST AT CYCLE 9
================================================================================
Errors: 1: in the following tutorials
Tutorial Mux4: test error occurred
================================================================================

Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread `"run-main-0"
`java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
        [trace] Stack trace suppressed: run last test:runMain for the full output.
[error] (test:runMain) Nonzero exit code: 1
[error] Total time: 1 s, completed 29-Jun-2017 2:38:35 PM

And the output for last test:runMain

[info] Running problems.Launcher Mux4
[debug] Waiting for threads to exit or System.exit to be called.
[debug]   Classpath:
[debug]         /home/soroosh/soroosh/chisel-tutorial/target/scala-2.11/test-classes
[debug]         /home/soroosh/soroosh/chisel-tutorial/target/scala-2.11/classes
[debug]         /home/soroosh/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar
[debug]         /home/soroosh/.ivy2/cache/edu.berkeley.cs/chisel3_2.11/jars/chisel3_2.11-3.0-SNAPSHOT.jar
[debug]         /home/soroosh/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.7.jar
[debug]         /home/soroosh/.ivy2/cache/edu.berkeley.cs/firrtl_2.11/jars/firrtl_2.11-1.0-SNAPSHOT.jar
[debug]         /home/soroosh/.ivy2/cache/com.typesafe.scala-logging/scala-logging_2.11/bundles/scala-logging_2.11-3.5.0.jar
[debug]         /home/soroosh/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.21.jar
[debug]         /home/soroosh/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.7.jar
[debug]         /home/soroosh/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.1.7.jar
[debug]         /home/soroosh/.ivy2/cache/com.github.scopt/scopt_2.11/jars/scopt_2.11-3.5.0.jar
[debug]         /home/soroosh/.ivy2/cache/net.jcazevedo/moultingyaml_2.11/jars/moultingyaml_2.11-0.4.0.jar
[debug]         /home/soroosh/.ivy2/cache/com.github.nscala-time/nscala-time_2.11/jars/nscala-time_2.11-2.14.0.jar
[debug]         /home/soroosh/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.9.4.jar
[debug]         /home/soroosh/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.2.jar
[debug]         /home/soroosh/.ivy2/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.17.jar
[debug]         /home/soroosh/.ivy2/cache/org.antlr/antlr4/jars/antlr4-4.5.3.jar
[debug]         /home/soroosh/.ivy2/cache/org.antlr/antlr4-runtime/jars/antlr4-runtime-4.5.3.jar
[debug]         /home/soroosh/.ivy2/cache/edu.berkeley.cs/chisel-iotesters_2.11/jars/chisel-iotesters_2.11-1.1-SNAPSHOT.jar
[debug]         /home/soroosh/.ivy2/cache/edu.berkeley.cs/firrtl-interpreter_2.11/jars/firrtl-interpreter_2.11-1.0-SNAPSHOT.jar
[debug]         /home/soroosh/.ivy2/cache/org.scalatest/scalatest_2.11/bundles/scalatest_2.11-3.0.1.jar
[debug]         /home/soroosh/.ivy2/cache/org.scalactic/scalactic_2.11/bundles/scalactic_2.11-3.0.1.jar
[debug]         /home/soroosh/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.5.jar
[debug]         /home/soroosh/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11/bundles/scala-parser-combinators_2.11-1.0.4.jar
[debug]         /home/soroosh/.ivy2/cache/org.scalacheck/scalacheck_2.11/jars/scalacheck_2.11-1.13.4.jar
[debug]         /home/soroosh/.ivy2/cache/org.scala-sbt/test-interface/jars/test-interface-1.0.jar
[debug]         /home/soroosh/.ivy2/cache/org.scala-lang.modules/scala-jline/bundles/scala-jline-2.12.1.jar
[debug]         /home/soroosh/.ivy2/cache/org.fusesource.jansi/jansi/jars/jansi-1.11.jar
[debug] Waiting for thread run-main-0 to terminate.
[debug] Interrupting thread run-main-0
[debug]         Interrupted run-main-0
[debug]         Thread run-main-0 exited.
[debug] Interrupting remaining threads (should be all daemons).
[debug] Sandboxed run complete..
java.lang.RuntimeException: Nonzero exit code: 1
        at scala.sys.package$.error(package.scala:27)
        at sbt.BuildCommon$$anonfun$toError$1.apply(Defaults.scala:2081)
        at sbt.BuildCommon$$anonfun$toError$1.apply(Defaults.scala:2081)
        at scala.Option.foreach(Option.scala:236)
        at sbt.BuildCommon$class.toError(Defaults.scala:2081)
        at sbt.Defaults$.toError(Defaults.scala:39)
        at sbt.Defaults$$anonfun$runMainTask$1$$anonfun$apply$36$$anonfun$apply$37.apply(Defaults.scala:740)
        at sbt.Defaults$$anonfun$runMainTask$1$$anonfun$apply$36$$anonfun$apply$37.apply(Defaults.scala:738)
        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)
        at sbt.Execute.work(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
[error] (test:runMain) Nonzero exit code: 1

"File name too long" in sbt

Hi, I got an error when trying to run the first example written in README. The branch is the latest release.

$ sbt
[info] Loading project definition from /home/sato/chisel-tutorial/project
[info] Set current project to chisel-tutorial (in build file:/home/sato/chisel-tutorial/)
> test:run-main problems.Launcher Mux2
[info] Compiling 56 Scala sources to /home/sato/chisel-tutorial/target/scala-2.11/classes...
[info] Compiling 63 Scala sources to /home/sato/chisel-tutorial/target/scala-2.11/test-classes...
[error] ファイル名が長すぎます
[error] one error found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 20 s, completed 2018/02/08 15:25:38

("ファイル名が長すぎます" means "File name too long".)

As a temporary fix, I changed build.sbt and add another line and it seems to be working:

scalacOptions ++= Seq("-Xmax-classfile-name","140")

Is there any better solution for this issue?

java.lang.Runtimeexception

360 20180528152044939
i follow the quick_start and then i run into this error when run this command ( test:run-main problems.Launcher Mux4) does anyone have idea

problem in build.sbt

Hi, when I issue " sbt run", it generated this kind of error. But when I changed the type, it's fixed. Is there anyone who's interested to fix this?

My sbt version is 1.1.0.
And my setting in build.sbt is like this:
name := "chisel-tutorial"
scalaVersion := "2.12.4"
crossScalaVersions := Seq("2.11.11", "2.12.3")

/Users/Powei/Dropbox/riscv/chisel/chisel-tutorial/build.sbt:7: error: scrutinee is incompatible with pattern type;
found : Int
required: Long
case Some((2, scalaMajor: Int)) if scalaMajor < 12 => Seq()
^
/Users/Powei/Dropbox/riscv/chisel/chisel-tutorial/build.sbt:19: error: scrutinee is incompatible with pattern type;
found : Int
required: Long
case Some((2, scalaMajor: Int)) if scalaMajor < 12 =>

Thanks in advance.

sbt run error

I get a similar problem as #124 even while i am on the release branch.
Could anyone please help me ?
I am using Ubuntu 18.04 and sbt 1.1.1
Below is the output -

[info] Loading project definition from /home/arna/chisel-tutorial/project
[info] Loading settings from build.sbt ...
[info] Set current project to chisel-tutorial (in build file:/home/arna/chisel-tutorial/)
[info] Updating ...
[warn] module not found: edu.berkeley.cs#chisel3_2.11;3.1.+
[warn] ==== local: tried
[warn] /home/arna/.ivy2/local/edu.berkeley.cs/chisel3_2.11/[revision]/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/edu/berkeley/cs/chisel3_2.11/[revision]/chisel3_2.11-[revision].pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/arna/.sbt/preloaded/edu.berkeley.cs/chisel3_2.11/[revision]/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/arna/.sbt/preloaded/edu/berkeley/cs/chisel3_2.11/[revision]/chisel3_2.11-[revision].pom
[warn] ==== sonatype-snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel3_2.11/[revision]/chisel3_2.11-[revision].pom
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel3_2.11/[revision]/chisel3_2.11-[revision].pom
[warn] module not found: edu.berkeley.cs#chisel-iotesters_2.11;1.2.+
[warn] ==== local: tried
[warn] /home/arna/.ivy2/local/edu.berkeley.cs/chisel-iotesters_2.11/[revision]/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/edu/berkeley/cs/chisel-iotesters_2.11/[revision]/chisel-iotesters_2.11-[revision].pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/arna/.sbt/preloaded/edu.berkeley.cs/chisel-iotesters_2.11/[revision]/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/arna/.sbt/preloaded/edu/berkeley/cs/chisel-iotesters_2.11/[revision]/chisel-iotesters_2.11-[revision].pom
[warn] ==== sonatype-snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel-iotesters_2.11/[revision]/chisel-iotesters_2.11-[revision].pom
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel-iotesters_2.11/[revision]/chisel-iotesters_2.11-[revision].pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-lang#scala-library;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-library;2.11.12 {scala-tool=[default, optional(default)], compile=[default(compile)]}::
[warn] public: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[warn] sonatype-snapshots: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[warn] sonatype-releases: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[warn] :: edu.berkeley.cs#chisel3_2.11;3.1.+: not found
[warn] :: edu.berkeley.cs#chisel-iotesters_2.11;1.2.+: not found
[warn] :: org.scala-lang#scala-compiler;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-compiler;2.11.12 {scala-tool=[default, optional(default)]}::
[warn] public: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[warn] sonatype-snapshots: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[warn] sonatype-releases: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.scala-lang:scala-library:2.11.12 ((sbt.Classpaths.jvmBaseSettings) Defaults.scala#L2055)
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.1.0
[warn] edu.berkeley.cs:chisel3_2.11:3.1.+ (/home/arna/chisel-tutorial/build.sbt#L46-48)
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.1.0
[warn] edu.berkeley.cs:chisel-iotesters_2.11:1.2.+ (/home/arna/chisel-tutorial/build.sbt#L46-48)
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.1.0
[warn] org.scala-lang:scala-compiler:2.11.12
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.1.0
[error] sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-library;2.11.12 {scala-tool=[default, optional(default)], compile=[default(compile)]}::
[error] public: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[error] sonatype-snapshots: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error] sonatype-releases: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error]
[error] unresolved dependency: edu.berkeley.cs#chisel3_2.11;3.1.+: not found
[error] unresolved dependency: edu.berkeley.cs#chisel-iotesters_2.11;1.2.+: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-compiler;2.11.12 {scala-tool=[default, optional(default)]}::
[error] public: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[error] sonatype-snapshots: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error] sonatype-releases: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error]
[error] at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:331)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:205)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:243)
[error] at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error] at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:242)
[error] at sbt.internal.librarymanagement.IvyActions$.updateEither(IvyActions.scala:190)
[error] at sbt.librarymanagement.ivy.IvyDependencyResolution.update(IvyDependencyResolution.scala:20)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:56)
[error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:46)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:99)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(LibraryManagement.scala:112)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:224)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:112)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:95)
[error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:126)
[error] at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2383)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: org.scala-lang#scala-library;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-library;2.11.12 {scala-tool=[default, optional(default)], compile=[default(compile)]}::
[error] public: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[error] sonatype-snapshots: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error] sonatype-releases: unable to get resource for org/scala-lang#scala-library;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-library/2.11.12/scala-library-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error]
[error] unresolved dependency: edu.berkeley.cs#chisel3_2.11;3.1.+: not found
[error] unresolved dependency: edu.berkeley.cs#chisel-iotesters_2.11;1.2.+: not found
[error] unresolved dependency: org.scala-lang#scala-compiler;2.11.12: Resolution failed several times for dependency: org.scala-lang#scala-compiler;2.11.12 {scala-tool=[default, optional(default)]}::
[error] public: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/64:ff9b:0:0:0:0:9765:28d1:443
[error] sonatype-snapshots: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/snapshots/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error] sonatype-releases: unable to get resource for org/scala-lang#scala-compiler;2.11.12: res=https://oss.sonatype.org/content/repositories/releases/org/scala-lang/scala-compiler/2.11.12/scala-compiler-2.11.12.pom: java.net.ConnectException: Failed to connect to oss.sonatype.org/64:ff9b:0:0:0:0:22c7:6fed:443
[error] Total time: 26 s, completed 16 May, 2018 10:10:58 AM

Build Failure

I'm trying to build the latest version of the chisel tutorial but I'm getting a build failure

palmer palmer-caldesktop examples $ make Adder4.out
sbt "run Adder4 --genHarness --compile --test --backend c " | tee Adder4.out
[info] Loading project definition from /home/palmer/.local/src/chisel-tutorial/examples/project
[info] Updating {file:/home/palmer/.local/src/chisel-tutorial/examples/project/}examples-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to chisel-tutorial (in build file:/home/palmer/.local/src/chisel-tutorial/examples/)
[info] Updating {file:/home/palmer/.local/src/chisel-tutorial/examples/}examples...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 27 Scala sources to /home/palmer/.local/src/chisel-tutorial/examples/target/scala-2.10/classes...
[error] /home/palmer/.local/src/chisel-tutorial/examples/examples.scala:74: not found: type VecSearch
[error] chiselMainTest(tutArgs, () => Module(new VecSearch())){
[error] ^
[error] one error found
error Compilation failed
[error] Total time: 3 s, completed Feb 26, 2014 10:37:23 AM

I believe I have the latest version of Chisel

palmer palmer-caldesktop chisel $ git describe
v2.1-95-g88f1944

I've done "sbt publish-local" (and I also tried removing ~/.sbt and ~/.ivy2, for good measure).

Need a consistent naming convention on variables

IMO, a consistent coding style, including naming convention, is important for good code.

While starting my own Chisel project some time ago, I faced some port mismatch issues, and found it was caused by inconsistent port naming. I then traced my study history back to this repository.

Long story short, here are the examples:

I think we need some guideline on this, for example ScalaStyle?

Error on generating Verilog

Hi all,
I get the following error when generating Verilog with the command
./run-examples GCD --backend-name verilator

/home/beatsnbytes/Documents/Git_Projects/to_experiment/lowrisc/verilator/include/verilated.cpp: In function ‘void vl_hash(bool, std::string)’:
/home/beatsnbytes/Documents/Git_Projects/to_experiment/lowrisc/verilator/include/verilated.cpp:1149:37: error: no matching function for call to ‘std::basic_ifstream<char>::basic_ifstream(std::string&)’
     std::ifstream infile(config_file);
                                     ^
/home/beatsnbytes/Documents/Git_Projects/to_experiment/lowrisc/verilator/include/verilated.cpp:1149:37: note: candidates are:
In file included from /home/beatsnbytes/Documents/Git_Projects/to_experiment/lowrisc/verilator/include/verilated.cpp:35:0:
/usr/include/c++/4.8/fstream:467:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char; _Traits = std::char_traits<char>; std::ios_base::openmode = std::_Ios_Openmode]
       basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in)
       ^
/usr/include/c++/4.8/fstream:467:7: note:   no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘const char*’
/usr/include/c++/4.8/fstream:453:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char; _Traits = std::char_traits<char>]
       basic_ifstream() : __istream_type(), _M_filebuf()
       ^
/usr/include/c++/4.8/fstream:453:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/4.8/fstream:427:11: note: std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)
     class basic_ifstream : public basic_istream<_CharT, _Traits>
           ^
/usr/include/c++/4.8/fstream:427:11: note:   no known conversion for argument 1 from ‘std::string {aka std::basic_string<char>}’ to ‘const std::basic_ifstream<char>&’
At global scope:
cc1plus: warning: unrecognized command line option "-Wno-undefined-bool-conversion" [enabled by default]
make: *** [verilated.o] Error 1
make: *** Waiting for unfinished jobs....
make: Leaving directory `/home/beatsnbytes/chisel-workspace/chisel-tutorial/test_run_dir/examples/GCD'
================================================================================
Errors: 1: in the following tutorials
Tutorial GCD: throwable assertion failed: 
================================================================================

Is there a mismatch of Chisel3 with Verilator. My installed version is

Verilator 3.922 2018-03-17 rev UNKNOWN_REV

Generated VCD

The problems/solutions are great.
Is there any way to generate vcd files for added usefulness?

There is some mention in the older documentation but this does not seem relevant for latest pull.

xorR is broken in chisel-tutorial

I observed that the xorR operator is broken when used within this tutorial which I think is due to an old FIRRTL backend as described in:
chipsalliance/treadle#78

Now I tried to update the FIRRTL (and chisel version) in the build.sbt, however this results in several errors of the PeekPokeTester. Would it be possible to update this tutorial to use the current FIRRTL and chisel?

Regards
Alex

not clear whether solutions Mux4Tests actually tests Mux4

In freshly cloned chisel tutorial:

sbt
[info] Loading project definition from /home/sols/src/chisel-tutorial/project
[info] Updating {file:/home/sols/src/chisel-tutorial/project/}chisel-tutorial-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to chisel-tutorial (in build file:/home/sols/src/chisel-tutorial/)
> test:run-main solutions.Launcher Mux4
[info] Updating {file:/home/sols/src/chisel-tutorial/}chisel-tutorial...
[info] Resolving edu.berkeley.cs#chisel3_2.11;3.0-SNAPSHOT ...
[warn] Unable to reparse edu.berkeley.cs#chisel3_2.11;3.0-SNAPSHOT from sonatype-snapshots, using Mon Dec 12 14:29:21 PST 2016
[warn] Choosing sonatype-snapshots for edu.berkeley.cs#chisel3_2.11;3.0-SNAPSHOT
[info] Resolving edu.berkeley.cs#firrtl_2.11;1.0-SNAPSHOT ...
[warn] Unable to reparse edu.berkeley.cs#firrtl_2.11;1.0-SNAPSHOT from sonatype-snapshots, using Mon Dec 12 14:27:04 PST 2016
[warn] Choosing sonatype-snapshots for edu.berkeley.cs#firrtl_2.11;1.0-SNAPSHOT
[info] Resolving edu.berkeley.cs#chisel-iotesters_2.11;1.1-SNAPSHOT ...
[warn] Unable to reparse edu.berkeley.cs#chisel-iotesters_2.11;1.1-SNAPSHOT from sonatype-snapshots, using Mon Dec 12 14:30:08 PST 2016
[warn] Choosing sonatype-snapshots for edu.berkeley.cs#chisel-iotesters_2.11;1.1-SNAPSHOT
[info] Resolving edu.berkeley.cs#firrtl-interpreter_2.11;1.0-SNAPSHOT ...
[warn] Unable to reparse edu.berkeley.cs#firrtl-interpreter_2.11;1.0-SNAPSHOT from sonatype-snapshots, using Mon Dec 12 14:28:03 PST 2016
[warn] Choosing sonatype-snapshots for edu.berkeley.cs#firrtl-interpreter_2.11;1.0-SNAPSHOT
[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 54 Scala sources to /home/sols/src/chisel-tutorial/target/scala-2.11/classes...
[info] Compiling 61 Scala sources to /home/sols/src/chisel-tutorial/target/scala-2.11/test-classes...
[info] Running solutions.Launcher Mux4
Starting tutorial Mux4
[info] [0.002] Elaborating design...
[info] [0.121] Done elaborating.
[info] [0.000] Elaborating design...
[info] [0.009] Done elaborating.
End of dependency graph
Circuit state created
SEED 1484855745028
test Mux2 Success: 64 tests passed in 69 cycles taking 0.141813 seconds
RAN 64 CYCLES PASSED
Tutorials passing: 1
[success] Total time: 27 s, completed Jan 19, 2017 11:55:45 AM

Why does it say test Mux2 Success?

I added println in src/test/scala/solutions/Mux4.scala:

git diff
diff --git a/src/test/scala/solutions/Mux4.scala b/src/test/scala/solutions/Mux4.scala
index eab22b0..419004f 100644
--- a/src/test/scala/solutions/Mux4.scala
+++ b/src/test/scala/solutions/Mux4.scala
@@ -4,6 +4,7 @@ package solutions
 import Chisel.iotesters.PeekPokeTester
 
 class Mux4Tests(c: Mux4) extends PeekPokeTester(c) {
+  println("actually running Mux4Tests")
   for (s0 <- 0 until 2) {
     for (s1 <- 0 until 2) {
       for(i0 <- 0 until 2) {
@@ -28,4 +29,5 @@ class Mux4Tests(c: Mux4) extends PeekPokeTester(c) {
       } 
     }
   }
+  println("actually finished Mux4Tests")
 }

println does the right thing:

> test:run-main solutions.Launcher Mux4
[info] Compiling 1 Scala source to /home/sols/src/chisel-tutorial/target/scala-2.11/test-classes...
[info] Running solutions.Launcher Mux4
Starting tutorial Mux4
[info] [0.001] Elaborating design...
[info] [0.061] Done elaborating.
[info] [0.000] Elaborating design...
[info] [0.005] Done elaborating.
End of dependency graph
Circuit state created
SEED 1484856079504
actually running Mux4Tests
actually finished Mux4Tests
test Mux2 Success: 64 tests passed in 69 cycles taking 0.068705 seconds
RAN 64 CYCLES PASSED
Tutorials passing: 1
[success] Total time: 3 s, completed Jan 19, 2017 12:01:19 PM

sbt run get error

[info] Attempting to fetch org.scala-sbt:compiler-bridge_2.12:1.2.5.
[warn] [FAILED ] org.scala-sbt#compiler-bridge_2.12;1.2.5!compiler-bridge_2.12.jar(src): java.lang.NullPointerException (178ms)
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.scala-sbt#util-interface;1.2.2: java.lang.NullPointerException
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] The compiler bridge sources org.scala-sbt:compiler-bridge_2.12:1.2.5:compile could not be retrieved.
[error]
[error] Note: Unresolved dependencies path:
[error] org.scala-sbt:util-interface:1.2.2
[error] +- org.scala-sbt:compiler-interface:1.2.5
[error] +- org.scala-sbt:compiler-bridge_2.12:1.2.5

blackboxes generates disconnects outputs and setName doesn't work

I was playing around with Chisel's BlackBoxes, and I noticed that they
do not behave as I would expect. They are entirely broken in 2.0.6, but
I got them to do something in 2.1-SNAPSHOT. The code in the attachment

package example

import Chisel._
import Node._

class FooIO extends Bundle() {
val input = Bits(INPUT, width = 8)
val output = Bits(OUTPUT, width = 8)
}

class FooBox extends BlackBox {
val io = new FooIO()
setName("weird_legacy_module_name")
io.input.setName("I")
io.output.setName("O")
}

class Foo extends Module {
val io = new FooIO()
val foo = Module(new FooBox())
io <> foo.io
}

object FooMain {
def main(args: Array[String]): Unit = {
chiselMain(args, () => Module(new Foo()))
}
}

generates the following Verilog code:

module Foo(
input [7:0] io_input,
output[7:0] io_output
);
FooBox foo(
.I( io_input )
//.O( )
);
endmodule

  • The output of "Foo" is not connected to the output of the Blackbox
    "FooBox" (io <> foo.io should do that). I think there is already a bug
    filed for that.
  • I would have expected setName to set the name of the module.
    Apparently it does not do that. The signal names are renamed properly,
    however.

sbt problem

Hello,
I am facing an error while I'm trying to sbt run:
[error] (compile:compile) sbt.InvalidComponent: Could not find required component 'compiler-interface-src'
Any ideas anyone?
Thanks.

Terminal initialization failed, JLine incompatibility detected

Using the Vagrant tutorial

vagrant@precise64:~/chisel-tutorial/hello$ make
set -e -o pipefail; "sbt" -Dsbt.log.noformat=true -DchiselVersion="2.+" "run Hello --genHarness --compile --test --backe
nd c --vcd --targetDir /home/vagrant/chisel-tutorial/generated/hello " | tee /home/vagrant/chisel-tutorial/generated/hel
lo/Hello.out
tee: /home/vagrant/chisel-tutorial/generated/hello/Hello.out: No such file or directory
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:123)
at sbt.ConsoleLogger$.(ConsoleLogger.scala:117)
at sbt.ConsoleLogger$.(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:43)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:60)
at sbt.StandardMain$.initialState(Main.scala:69)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$.run(Launch.scala:55)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:60)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)

java.lang.IncompatibleClassChangeError: JLine incompatibility detected. Check that the sbt launcher is version 0.13.x o
r later.
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:134)
at sbt.ConsoleLogger$.(ConsoleLogger.scala:117)
at sbt.ConsoleLogger$.(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:43)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:60)
at sbt.StandardMain$.initialState(Main.scala:69)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$.run(Launch.scala:55)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:60)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IncompatibleClassChangeError: JLine incompatibility detected. Check that the sbt
launcher is version 0.13.x or later.
make: *** [/home/vagrant/chisel-tutorial/generated/hello/Hello.out] Error 1
vagrant@precise64:~/chisel-tutorial/hello$

question about Firrtl(IR) optimization

// See LICENSE.txt for license details.
package solutions

import chisel3._

// Problem:
//
// 'out' should be the sum of 'in0' and 'in1'
// Adder width should be parametrized
//
class Adder(val w: Int) extends Module {
  val io = IO(new Bundle {
    val in0 = Input(UInt(w.W))
    val in1 = Input(UInt(w.W))
    val out = Output(UInt(w.W))
  })
  io.out := io.in0 + io.in1
}

above is the scala code for Adder in $TUT_DIR/src/main/scala/problems/
when I run ./run-solution.sh Adder --backend-name verilator
I got the corresponding Verilog code
module Adder(
input clock,
input reset,
input [7:0] io_in0,
input [7:0] io_in1,
output [7:0] io_out
);
wire [8:0] _T_11; // @[Adder.scala 17:20]
assign _T_11 = io_in0 + io_in1; // @[Adder.scala 17:20]
assign io_out = io_in0 + io_in1; // @[Adder.scala 17:10]
endmodule

Here assign _T_11 = io_in0 + io_in1; // @[Adder.scala 17:20] is a line of deadcode, which in my eyes wastes a build-in adder thus should be eliminated. And it is easy to fulfill using dead code elimination for IR. So is it a bug for current chisel3 implementation?

synchronous memory description

I think the synchronous memory description needs some rework. As far as I understand the synchronous memory has changed from Chisel 2 to 3 that the read address is already in a register in the memory module. True? Then it should be mentioned in the tutorial.

This already gives us what we call synchronous read. Why is then in the example another register involved at the output of the synchronous memory? This gives a memory with two cycles latency.

One can always add a register at the output to improve the maximum clock frequency (and FPGA memory blocks have output register in block RAMs that can be used). But I don't think this should be in the tutorial.

sbt run target

I'm new to Scala and sbt and I can't figure out how sbt run target is specified.
I took interest in this tutorial structure as it can show how to make mixed projects with Scala and Chisel. And I couldn't get even first step. Why sbt run runs Hello.scala? I've red several sections of sbt documentation, searched StackOverflow and still I don't get how mainClass is specified to Hello.scala in chisel-tutorial. There is no mention of mainClass anywhere, no build.sbt rules, no Build.scala in project directory, there are other sources in src/main so probably Hello.scala isn't default. Where should I search for it?

error sbt run

Hi,
I am on MAC OS, I did as indicated in the README of chisel3
brew install sbt verilator
When I wanted to try this tutorial, and that I do sbt run I have :

[info] Loading project definition from /Users/ipere/chisel-tutorial/project
[info] Updating ProjectRef(uri("file:/Users/ipere/chisel-tutorial/project/"), "chisel-tutorial-build")...
Waiting for lock on /Users/ipere/.ivy2/.sbt.ivy.lock to be available...

I tried a second time, I have the same thing and it stays frozen for at least 10 minutes, I stopped it then.

Thanks in advance

Absense of bc binary makes false error message

sbt run fails with the following misleading message about java's absence

» sbt run
/usr/share/sbt/bin/sbt-launch-lib.bash: line 207: bc: command not found

The java installation you have is not up to date
requires at least version 1.6+, you have
version 1.8

Please go to http://www.java.com/getjava/ and download
a valid Java Runtime and install before running .

Cann't generate verilog

Hi, when i follow the Wiki try to generate verilog: TESTER_BACKENDS=verilator ./run-examples.sh GCD. It only generate GCD.anno, GCD.fir and GCD.lo.fir, and i get the following information:
[process_args] java_version = '1.7'

Executing command line:

java
-Xms1024m
-Xmx1024m
-XX:ReservedCodeCacheSize=128m
-XX:MaxPermSize=256m
-jar
/usr/share/sbt/bin/sbt-launch.jar
"test:run-main examples.Launcher GCD"

[info] Loading project definition from /home/zhangyl/Project/chisel/chisel-tutorial/project
[info] Set current project to chisel-tutorial (in build file:/home/zhangyl/Project/chisel/chisel-tutorial/)
[info] Running examples.Launcher GCD
Starting tutorial GCD
[info] [0.004] Elaborating design...
[info] [0.282] Done elaborating.
Total FIRRTL Compile Time: 2140.0 ms
Total FIRRTL Compile Time: 68.9 ms
End of dependency graph
Circuit state created
[info] [0.001] SEED 1508412833942
test GCD Success: 3 tests passed in 29 cycles taking 0.057114 seconds
[info] [0.042] RAN 24 CYCLES PASSED
Tutorials passing: 1
[success] Total time: 6 s, completed Oct 19, 2017 7:33:57 PM

My ubuntu's version is 14.04, and i have installed verilator.

AdderTest.scala get a wrong testing

  for (t <- 0 until 4) {
    val rnd0 = rnd.nextInt(c.n)
    val rnd1 = rnd.nextInt(c.n)
    val rnd2 = rnd.nextInt(1)

    poke(c.io.A, rnd0)
    poke(c.io.B, rnd1)
    poke(c.io.Cin, rnd2)
    step(1)
    val rsum = rnd0 + rnd1 + rnd2
    val mask = BigInt("1"*c.n, 2)
    expect(c.io.Sum, rsum &  mask)
    expect(c.io.Cout, rsum % 1)
  }

rnd0, rnd1, rnd2 got a wrong number
rnd0 and rnd1 should be a random int with c.n bit, but this give 0 < x < c.n
rnd2 using val rnd2 = rnd.nextInt(1) always give 0

and the except io.Cout using rsum % 1 get always 0
because the rnd0 and rnd1 is too small, so the test always success

I suggest using

  for (t <- 0 until 4) {
    val rnd0 = rnd.nextInt(1<<c.n)
    val rnd1 = rnd.nextInt(1<<c.n)
    val rnd2 = rnd.nextInt(2)

    poke(c.io.A, rnd0)
    poke(c.io.B, rnd1)
    poke(c.io.Cin, rnd2)
    step(1)
    val rsum = rnd0 + rnd1 + rnd2
    val mask = BigInt("1"*c.n, 2)
    expect(c.io.Sum, rsum &  mask)
    expect(c.io.Cout, ((1 << c.n) & rsum) >> c.n)
  }

Difference between 'to' and 'until' in for loop

For the VecShiftRegisterParam problem, I see that using 'until' in the for loop as follows fails, but using 'to' passes. What is the difference between the two?

class VecShiftRegisterParam(val n: Int, val w: Int) extends Module {
  val io = IO(new Bundle {
    val in  = Input(UInt(w.W))
    val out = Output(UInt(w.W))
  })

  // Implement below ----------
  val values = Seq.fill(n) {0.U(w.W)}
  val regs = RegInit(Vec(values))

  for (i <- 0 until n-2) {
    regs(i) := regs(i+1)
  }

  regs(n-1) := io.in
  io.out := regs(0)
}

dependency not found

I used master branch, 8b306ae

 edu.berkeley.cs:chisel-iotesters_2.11:1.2-SNAPSHOT:
    not found:
      /home/colin4124/.ivy2/local/edu.berkeley.cs/chisel-iotesters_2.11/1.2-SNAPSHOT/ivys/ivy.xml
      https://repo1.maven.org/maven2/edu/berkeley/cs/chisel-iotesters_2.11/1.2-SNAPSHOT/chisel-iotesters_2.11-1.2-SNAPSHOT.pom
      https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel-iotesters_2.11/1.2-SNAPSHOT/chisel-iotesters_2.11-1.2-SNAPSHOT.pom
      https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel-iotesters_2.11/1.2-SNAPSHOT/chisel-iotesters_2.11-1.2-SNAPSHOT.pom
  edu.berkeley.cs:chisel3_2.11:3.1-SNAPSHOT:
    not found:
      /home/colin4124/.ivy2/local/edu.berkeley.cs/chisel3_2.11/3.1-SNAPSHOT/ivys/ivy.xml
      https://repo1.maven.org/maven2/edu/berkeley/cs/chisel3_2.11/3.1-SNAPSHOT/chisel3_2.11-3.1-SNAPSHOT.pom
      https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel3_2.11/3.1-SNAPSHOT/chisel3_2.11-3.1-SNAPSHOT.pom
      https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel3_2.11/3.1-SNAPSHOT/chisel3_2.11-3.1-SNAPSHOT.pom

I used release version, it does not support val in = Input(UInt(1.W)) :value W is not a member of Int. The chisel3 version in build.sbt is 3.0-SNAPSHOT. Does 3.0-SNAPSHOT not support UInt(1.W) ?

So I want to try master which chisel3 version is 3.1-SNAPSHOT, but I encounter above problem and I can't test for it.

Probably typos in the Wiki?

There are several words in the Wiki formatted as follows: abc+. I assume the plus has no meaning is is some translation/typo mistake. If this is the case I can fix them when reading along.

README

Wouldn't it be nicer and shorter to show the make target for the examples, such as "make Mux4.out" in folder problem instead of the verbose sbt string? The complete sbt string could be shown for a singe example.

If you agree on this simplification, I can do the change with a pull request.

Martin

sbt run problem

Hello,
I did as the tutorial does. And I got a problem. When I sbt run, I got many errors

gjc@302f:/chisel-tutorial$ sbt run
[info] Loading project definition from /home/gjc/chisel-tutorial/project
[info] Updating ProjectRef(uri("file:/home/gjc/chisel-tutorial/project/"), "chisel-tutorial-build")...
[info] Done updating.
[info] Loading settings from build.sbt ...
[info] Set current project to chisel-tutorial (in build file:/home/gjc/chisel-tutorial/)
[info] Updating ...
[warn] module not found: edu.berkeley.cs#chisel3_2.11;3.2-SNAPSHOT
[warn] ==== local: tried
[warn] /home/gjc/.ivy2/local/edu.berkeley.cs/chisel3_2.11/3.2-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/edu/berkeley/cs/chisel3_2.11/3.2-SNAPSHOT/chisel3_2.11-3.2-SNAPSHOT.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/gjc/.sbt/preloaded/edu.berkeley.cs/chisel3_2.11/3.2-SNAPSHOT/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/gjc/.sbt/preloaded/edu/berkeley/cs/chisel3_2.11/3.2-SNAPSHOT/chisel3_2.11-3.2-SNAPSHOT.pom
[warn] ==== sonatype-snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel3_2.11/3.2-SNAPSHOT/chisel3_2.11-3.2-SNAPSHOT.pom
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel3_2.11/3.2-SNAPSHOT/chisel3_2.11-3.2-SNAPSHOT.pom
[warn] module not found: edu.berkeley.cs#chisel-iotesters_2.11;1.3-SNAPSHOT
[warn] ==== local: tried
[warn] /home/gjc/.ivy2/local/edu.berkeley.cs/chisel-iotesters_2.11/1.3-SNAPSHOT/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/edu/berkeley/cs/chisel-iotesters_2.11/1.3-SNAPSHOT/chisel-iotesters_2.11-1.3-SNAPSHOT.pom
[warn] ==== local-preloaded-ivy: tried
[warn] /home/gjc/.sbt/preloaded/edu.berkeley.cs/chisel-iotesters_2.11/1.3-SNAPSHOT/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn] file:////home/gjc/.sbt/preloaded/edu/berkeley/cs/chisel-iotesters_2.11/1.3-SNAPSHOT/chisel-iotesters_2.11-1.3-SNAPSHOT.pom
[warn] ==== sonatype-snapshots: tried
[warn] https://oss.sonatype.org/content/repositories/snapshots/edu/berkeley/cs/chisel-iotesters_2.11/1.3-SNAPSHOT/chisel-iotesters_2.11-1.3-SNAPSHOT.pom
[warn] ==== sonatype-releases: tried
[warn] https://oss.sonatype.org/content/repositories/releases/edu/berkeley/cs/chisel-iotesters_2.11/1.3-SNAPSHOT/chisel-iotesters_2.11-1.3-SNAPSHOT.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: edu.berkeley.cs#chisel3_2.11;3.2-SNAPSHOT: not found
[warn] :: edu.berkeley.cs#chisel-iotesters_2.11;1.3-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] edu.berkeley.cs:chisel3_2.11:3.2-SNAPSHOT (/home/gjc/chisel-tutorial/build.sbt#L46-48)
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.2-SNAPSHOT
[warn] edu.berkeley.cs:chisel-iotesters_2.11:1.3-SNAPSHOT (/home/gjc/chisel-tutorial/build.sbt#L46-48)
[warn] +- edu.berkeley.cs:chisel-tutorial_2.11:3.2-SNAPSHOT
[error] sbt.librarymanagement.ResolveException: unresolved dependency: edu.berkeley.cs#chisel3_2.11;3.2-SNAPSHOT: not found
[error] unresolved dependency: edu.berkeley.cs#chisel-iotesters_2.11;1.3-SNAPSHOT: not found
[error] at sbt.internal.librarymanagement.IvyActions$.resolveAndRetrieve(IvyActions.scala:331)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$updateEither$1(IvyActions.scala:205)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:243)
[error] at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error] at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:242)
[error] at sbt.internal.librarymanagement.IvyActions$.updateEither(IvyActions.scala:190)
[error] at sbt.librarymanagement.ivy.IvyDependencyResolution.update(IvyDependencyResolution.scala:20)
[error] at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:56)
[error] at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:46)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:99)
[error] at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:68)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$19(LibraryManagement.scala:112)
[error] at scala.util.control.Exception$Catch.apply(Exception.scala:224)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:112)
[error] at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:95)
[error] at sbt.util.Tracked$.$anonfun$inputChanged$1(Tracked.scala:149)
[error] at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:126)
[error] at sbt.Classpaths$.$anonfun$updateTask$5(Defaults.scala:2383)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:271)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (update) sbt.librarymanagement.ResolveException: unresolved dependency: edu.berkeley.cs#chisel3_2.11;3.2-SNAPSHOT: not found
[error] unresolved dependency: edu.berkeley.cs#chisel-iotesters_2.11;1.3-SNAPSHOT: not found
[error] Total time: 80 s, completed Apr 20, 2018 10:07:44 PM
gjc@302f:
/chisel-tutorial$

anyone can help me, please
Thank you.

when is a combinatorial construct

I think the following text is missleading:

"The when statement tells Chisel to perform the operation on a positive clock edge if the condition is true, treating the left hand assignments as synchronous. This is similar to how Verilog uses always @ (posedge clk) to specify synchronous logic."

when is a combinational construct, basically a multiplexer. Only registers "perform an operation on a positive clock edge".

erorr running ./run-examples.sh GCD --backend-name verilator

verilated.o: In function VL_FINISH_MT(char const*, int, char const*)': verilated.cpp:(.text+0x7): undefined reference to vl_finish(char const, int, char const)'
collect2: error: ld returned 1 exit status
VGCD.mk:64: recipe for target 'VGCD' failed
make: Leaving directory '/home/salman/chisel-tutorial/test_run_dir/examples/GCD'
make: *** [VGCD] Error 1

Errors: 1: in the following tutorials
Tutorial GCD: throwable assertion failed:

how to run chisel-tutorial in the IntelliJ IDE with Scala and SBT plug-ins?

I imported the chisel-tutorial into IntelliJ and it recognized the sbt project. Inside the sbt console I can successfully run the builds and tests, but when I try to use the editor, the environment can't resolve the chisel3 import.

Being new to scala, sbt, chisel, and the IntelliJ scala/sbt environment, I need a little help finding the pieces in the environment that are not configured correctly.

can I generate verilog without sbt ?

could someone help me to solve the error ? thanks first.

I don't like sbt very much, and try to transform *.scala to *.v as below:

  1. download 'chisel3_2.12-3.1.6.jar' from https://mvnrepository.com/artifact/edu.berkeley.cs/chisel3
  2. download scala-2.12.8
  3. add java/bin, scala/bin to PATH environment
  4. run shell command
    $ scalac -classpath lib/chisel3_2.12-3.1.6.jar -d classes GCD.scala

I got error.
src\intro\GCD.scala:23: error: value load is not a member of chisel3.Bundle when (io.load) { ^ src\intro\GCD.scala:24: error: value a is not a member of chisel3.Bundle x := io.a; y := io.b ^ src\intro\GCD.scala:24: error: value b is not a member of chisel3.Bundle x := io.a; y := io.b ^ src\intro\GCD.scala:33: error: value out is not a member of chisel3.Bundle io.out := x ^ src\intro\GCD.scala:34: error: value valid is not a member of chisel3.Bundle io.valid := y === 0.U ^

GCD.scala

// See LICENSE.txt for license details.
package examples

import chisel3._

class GCD extends Module {
  val io = IO(new Bundle {
    val a     = Input(UInt(16.W))
    val b     = Input(UInt(16.W))
    val load  = Input(Bool())
    val out   = Output(UInt(16.W))
    val valid = Output(Bool())
  })
  val x = Reg(UInt())
  val y = Reg(UInt())

  when (io.load) {
    x := io.a; y := io.b
  } .otherwise {
    when (x > y) {
      x := x - y
    } .elsewhen (x <= y) {
      y := y - x
    }
  }

  io.out := x
  io.valid := y === 0.U
}

Single port RAM in Chisel Tutorial

I believe there is incorrect description of single port memory in Chisel Tutorial 3.0 (beta)
Currently it looks like two port memory that can't read and write at the same time:

val ram1p = Mem(1024, UInt(width = 32))
val reg_raddr = Reg(UInt())
when (wen) { ram1p(waddr) := wdata }
.elsewhen (ren) { reg_raddr := raddr }
val rdata = `ram1p(reg_raddr)

Should be memory with only one address port:

val ram1p = Mem(1024, UInt(width = 32))
val reg_addr = Reg(UInt())
when (wen) { ram1p(addr) := wdata }
.elsewhen (ren) { reg_addr := addr }
val rdata = ram1p(reg_addr)

References:
Altera VHDL Examples
Xilinx Block Memory Generator User Guide Page 43

BlackBox clock + reset

Hi,

These time, i had a lot of fun with chisel, realy. But there are 1 point that blocking me, and that's not demonstrated in chisel-tutorial :

How create a BlackBox chisel code where a instance could be like that =>

  MyBlackBox bb_Instance_forClockA(.clk(clockA),.reset(resetA),
       ...
  );
  MyBlackBox bb_Instance_forClockB(.clk(clockB),.reset(resetB),
       ...
  );

As you can see, any instance of the blackbox have the same IO name, event if they don't have same clock source.

In addition, i think show the method to do blackbox with parameter (setVerilogParameters(s".myParam($myParam)") could be great.

This example could be very usefull : D

discrepancy between Verilog and firrtl simulation

The code passes the test:

class RealGCDInput extends Bundle {
  val a = UInt(16.W)
  val b = UInt(16.W)
}

class RealGCD extends Module {
  val io  = IO(new Bundle {
    val in  = DeqIO(new RealGCDInput())
    val out = Output(Valid(UInt(16.W)))
  })

  // Implement below ----------
  val valid = Reg(init = false.B)
  val done  = Reg(init = false.B)
  val a = Reg(UInt())
  val b = Reg(UInt())

  io.in.ready  := !valid
  io.out.valid := done
  io.out.bits  := a

  printf ("now  a=%d b=%d valid=%d io.in.valid=%d\n", a, b, valid, io.in.valid)
  when (!valid && io.in.valid ) {
    a     := io.in.bits.a
    b     := io.in.bits.b
    printf ("new  a=%d b=%d\n", a, b)
    valid := true.B
    done  := false.B
  }
  .elsewhen (valid) {
    when (a === b) {
      valid := false.B
      done  := true.B
      printf ("done a=%d b=%d\n", a, b)
    }
    .elsewhen (a < b) {
      b := b - a
      printf ("a<b  a=%d b=%d\n", a, b)
    }
    .otherwise {
      a := a - b
      printf ("b>a  a=%d b=%d\n", a, b)
    }
  }
  // Implement above ----------

}

However, the output does not have anything printed by printf ("new a=%d b=%d\n", a, b):

test:run-main problems.Launcher RealGCD
[info] Compiling 1 Scala source to /home/sols/src/chisel-tutorial/target/scala-2.11/classes...
[info] Running problems.Launcher RealGCD
Starting tutorial RealGCD
[info] [0.002] Elaborating design...
[info] [0.141] Done elaborating.
[info] [0.000] Elaborating design...
[info] [0.011] Done elaborating.
End of dependency graph
Circuit state created
SEED 1484943270543
now  a=48 b=32 valid=1 io.in.valid=1
b>a  a=48 b=32
now  a=16 b=32 valid=1 io.in.valid=0
a<b  a=16 b=32
now  a=16 b=16 valid=1 io.in.valid=0
done a=16 b=16
now  a=16 b=16 valid=0 io.in.valid=0
now  a=7 b=3 valid=1 io.in.valid=1
b>a  a=7 b=3
now  a=4 b=3 valid=1 io.in.valid=0
b>a  a=4 b=3
now  a=1 b=3 valid=1 io.in.valid=0
a<b  a=1 b=3
now  a=1 b=2 valid=1 io.in.valid=0
a<b  a=1 b=2
now  a=1 b=1 valid=1 io.in.valid=0
done a=1 b=1
now  a=1 b=1 valid=0 io.in.valid=0
now  a=100 b=10 valid=1 io.in.valid=1
b>a  a=100 b=10
now  a=90 b=10 valid=1 io.in.valid=0
b>a  a=90 b=10
now  a=80 b=10 valid=1 io.in.valid=0
b>a  a=80 b=10
now  a=70 b=10 valid=1 io.in.valid=0
b>a  a=70 b=10
now  a=60 b=10 valid=1 io.in.valid=0
b>a  a=60 b=10
now  a=50 b=10 valid=1 io.in.valid=0
b>a  a=50 b=10
now  a=40 b=10 valid=1 io.in.valid=0
b>a  a=40 b=10
now  a=30 b=10 valid=1 io.in.valid=0
b>a  a=30 b=10
now  a=20 b=10 valid=1 io.in.valid=0
b>a  a=20 b=10
now  a=10 b=10 valid=1 io.in.valid=0
done a=10 b=10
now  a=10 b=10 valid=0 io.in.valid=0
test RealGCD Success: 3 tests passed in 26 cycles taking 0.076821 seconds
RAN 21 CYCLES PASSED
Tutorials passing: 1
[success] Total time: 6 s, completed Jan 20, 2017 12:14:31 PM

Error in Using PeekPokeTester

When I try to run a script like run-examples.sh, I get the following errors for all modules:

[error] $dir/chisel-tutorial/src/test/scala/problems/Accumulator.scala:6: inferred type arguments [problems.Accumulator] do not conform to type PeekPokeTester's type parameter bounds [+T <: Chisel.Module]
[error] Error occurred in an application involving default arguments.
[error] class AccumulatorTests(c: Accumulator) extends PeekPokeTester(c) {
[error] ^
[error] $dir/chisel-tutorial/src/test/scala/problems/Accumulator.scala:6: type mismatch;
[error] found : problems.Accumulator
[error] required: T
[error] Error occurred in an application involving default arguments.
[error] class AccumulatorTests(c: Accumulator) extends PeekPokeTester(c) {
[error] ^

Do I need to change anything to make the tutorials work again?

Incorrect description of shift operators in Chisel Tutorial

Section 5.1 of tutorial describes Fill(), >> and << using undefined functions maxNum(n) and minNum(n)

Chisel CheatSheet for Chisel 2.2 described this operations as one would expect:

z = x << n     ;   wz = wx + n
z = x >> n     ;   wz = wx - n
z = Fill(n, x) ;   wz = wx*n

Then there are dynamic shifts, which take variable as argument.

z = x << y     ;   wz = wx + maxVal(y)
z = x >> y     ;   wz = wx - minVal(y)

They are also correctly described in Chisel CheatSheet for Chisel 2.2
(with definition of maxVal(y) and minVal(y))
But strangely dynamic shifts got omitted in Chisel Tutorial 3.0

Because of all above it is unclear from tutorial how >> and << work.

the first example does not work

test:run-main problems.Launcher Mux2

produces:

[info] Loading project definition from /home/sols/src/chisel-tutorial/project
[info] Set current project to chisel-tutorial (in build file:/home/sols/src/chisel-tutorial/)
> test:run-main examples.Launcher Mux2
[info] Running examples.Launcher Mux2
================================================================================
Errors: 1: in the following tutorials
Bad tutorial name: Mux2
================================================================================

Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread "run-main-0"
java.lang.RuntimeException: Nonzero exit code: 1
	at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last test:runMain for the full output.
[error] (test:runMain) Nonzero exit code: 1
[error] Total time: 1 s, completed Jan 18, 2017 3:12:15 PM

To fix it:

git diff
diff --git a/src/test/scala/problems/Launcher.scala b/src/test/scala/problems/Launcher.scala
index 94fbff7..1ce917e 100644
--- a/src/test/scala/problems/Launcher.scala
+++ b/src/test/scala/problems/Launcher.scala
@@ -62,6 +62,11 @@ object Launcher {
         (c) => new RealGCDTests(c)
       }
     },
+    "Mux2" -> { (backendName: String) =>
+      Driver(() => new Mux2(), backendName) {
+        (c) => new Mux2Tests(c)
+      }
+    },
     "Mux4" -> { (backendName: String) =>
       Driver(() => new Mux4(), backendName) {
         (c) => new Mux4Tests(c)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.