I am trying to use the AsyncQueue subrepo (https://github.com/ucb-bar/asyncqueue) in my own project, much as the ClockDividerDemo in Chisel Multiclock Demos (https://github.com/edwardcwang/chisel-multiclock-demo/). However, sbt errs:
[error] ... .scala:9:8: not found: object freechips
[error] import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
[error] ^
[error] one error found
To be specific, I added these lines to the tail of my build.sbt:
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
And this line to my own Scala file:
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
EDIT:
Complete build.sbt:
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.6.0"
lazy val root = (project in file("."))
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
I couldn't find any release published in any artifactory for asyncqueue. To make your project depends on that one, sbt lets you use projects directly from github when they are not packed.
The steps to solve the issue are:
asyncqueue project is defined// instead of
lazy val asyncqueue = (project in file("asyncqueue-lite"))
// use
lazy val asyncqueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
asyncqueue as a dependencylazy val root = (project in file("."))
.dependsOn(asyncqueue) // <- this is how you make your project depends on another one
.settings(
name := "asyncqueue-chisel",
// ...
)
scala to 2.12.17
scala 2.13. Here you have a question about How a core library can be cross-compiled for different scala versionsscala 2.12.18 which is the latest scala 2.12.x released on June 7, 2023ThisBuild / scalaVersion := "2.12.17"
chisel3 to 3.5.5. Using 3.5.6 or 3.6.0 will cause some conflict version. The following error message will be showed[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel
[error] (ssExtractDependencies) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error]
[error] * edu.berkeley.cs:chisel3_2.12:3.5.6 (pvp) is selected over {3.1.+, 3.1.8}
[error] +- asyncqueue-chisel:asyncqueue-chisel_2.12:0.1.0 (depends on 3.5.6)
[error] +- edu.berkeley.cs:chisel-iotesters_2.12:1.2.10 (depends on 3.1.8)
[error] +- asyncqueue-lite:asyncqueue-lite_2.12:1.0.0 (depends on 3.1.+)
This is how you can set the correct chisel3 version
val chiselVersion = "3.5.5"
Now, your build.sbt should look like
ThisBuild / scalaVersion := "2.12.17"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.5.5"
lazy val UcbBarAsyncQueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
lazy val root = (project in file("."))
.dependsOn(UcbBarAsyncQueue)
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
and the line
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
should compile without errors