Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mill build tool and make submodules permanent #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ generated-rtl/
target/
project/
verilog/

.metals/
.scala-build/
out/
mill
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "tools/dsptools"]
path = tools/dsptools
url = https://github.com/ucb-bar/dsptools.git
[submodule "tools/rocket-dsp-utils"]
path = tools/rocket-dsp-utils
url = https://github.com/ucb-bar/rocket-dsp-utils.git
[submodule "tools/cde"]
path = tools/cde
url = https://github.com/chipsalliance/cde.git
[submodule "generators/rocket-chip"]
path = generators/rocket-chip
url = https://github.com/chipsalliance/rocket-chip.git
1 change: 1 addition & 0 deletions .mill-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.11.6
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
# SDF-FFT Design Generator
[![Build](https://github.com/milovanovic/sdf-fft/actions/workflows/test.yml/badge.svg)](https://github.com/milovanovic/sdf-fft/actions/workflows/test.yml)

The SDF-FFT Generator is a highly parametrizable Single-Path-Delay-Feedback (SDF) Fast Fourier Transform (FFT) hardware accelerator.


## Prerequisites

The following software packages should be installed prior to running this project:
* [sbt](http://www.scala-sbt.org)
* [sbt](http://www.scala-sbt.org) or
* [mill](https://mill-build.com)
* [Verilator](http://www.veripool.org/wiki/verilator)

## Setup

Proposed design generator is intended to be used inside [chipyard](https://github.com/ucb-bar/chipyard) environment as one of the generators located inside `generators/dsp-blocks`. Anyhow, if you want to use this repository standalone then follow instructions below:

* Clone this repository.
* Clone this repository (with submodules).
* Switch directory.
* Initialize all tools and submodules.
* Compile code, generate verilog or run tests.

```
git clone https://github.com/milovanovic/sdf-fft.git
git clone --recurse-submodules https://github.com/milovanovic/sdf-fft.git
cd sdf-fft
./scripts/init_submodules_and_build_sbt.sh
sbt test
sbt test or ./mill sdf_fft.test
```

#### Note
The shell script `init_submodules_and_build_sbt.sh`, initializes all tools and generators required to run this project. Besides that, it initializes `bulid.sbt` with all correctly defined dependencies. Versions of tools and generators correspond to chipyard 1.9.1 release. The user can replace versions by changing corresponding checkout commits inside the same script.
The shell script `remove_submodules.sh` runs commands that are the inverse of those in `init_submodules_and_build_sbt.sh`.

## Documentation

* doc/sdf_fft_generator.md - detailed documentation about design generator
Expand Down
4 changes: 2 additions & 2 deletions build.sbt.ignore → build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ lazy val hardfloat = (project in rocketChipDir / "hardfloat")
)
)

lazy val rocketMacros = (project in rocketChipDir / "macros")
lazy val `rocket-macros` = (project in rocketChipDir / "macros")
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
Expand All @@ -97,7 +97,7 @@ lazy val rocketMacros = (project in rocketChipDir / "macros")
scalafmtOnCompile := true

lazy val rocketchip = freshProject("rocketchip", rocketChipDir)
.dependsOn(hardfloat, rocketMacros, cde)
.dependsOn(hardfloat, `rocket-macros`, cde)
.settings(commonSettings)
.settings(chiselSettings)
.settings(
Expand Down
87 changes: 87 additions & 0 deletions build.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// import Mill dependency
import mill._
import mill.define.Sources
import mill.modules.Util
import mill.scalalib.TestModule.ScalaTest
import scalalib._
// support BSP
import mill.bsp._
import os._

def scalaVersionString: String = "2.13.10"
def chiselVersionString: String = "3.5.6"

trait SbtScalaModule extends SbtModule {
def millSourcePath = os.pwd
def scalaVersion = scalaVersionString
def scalacOptions = Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit",
"-unchecked",
"-Ymacro-annotations"
)
def ivyDeps = T{Agg(
ivy"org.scala-lang:scala-reflect:$scalaVersionString",
ivy"org.json4s::json4s-jackson:3.6.6",
ivy"org.scalatest::scalatest:3.2.0"
)}
}
trait ChiselScalaModule extends SbtScalaModule { m =>
override def scalacOptions = super.scalacOptions() ++ Seq("-P:chiselplugin:genBundleElements")
override def ivyDeps = Agg(
ivy"edu.berkeley.cs::chisel3:$chiselVersionString",
)
def scalacPluginIvyDeps = Agg(
ivy"edu.berkeley.cs:::chisel3-plugin:$chiselVersionString",
)
object test extends SbtModuleTests with TestModule.ScalaTest {
def ivyDeps = m.ivyDeps() ++ Agg(
ivy"edu.berkeley.cs::chisel-iotesters:2.5.1"
)
}
}
object sdf_fft extends ChiselScalaModule {
def moduleDeps = Seq(
rocketchip,
rocket_dsp_utils
)
}

object rocketchip extends SbtScalaModule {
override def millSourcePath = os.pwd / "generators" / "rocket-chip"
def moduleDeps = Seq(
hardfloat, rocketMacros, cde
)
object rocketMacros extends SbtScalaModule {
override def millSourcePath = os.pwd / "generators" / "rocket-chip" / "macros"
}
}
object hardfloat extends ChiselScalaModule {
override def millSourcePath = os.pwd / "generators" / "rocket-chip" / "hardfloat"
}
object cde extends SbtScalaModule {
override def millSourcePath = os.pwd / "tools" / "cde"
def sources = T.sources{
super.sources() ++ Seq(PathRef(millSourcePath / "cde" / "src" / "chipsalliance" / "rocketchip"))
}
}
object rocket_dsp_utils extends SbtScalaModule {
override def millSourcePath = os.pwd / "tools" / "rocket-dsp-utils"
def moduleDeps = Seq(
rocketchip, cde, dsptools
)
}
object dsptools extends ChiselScalaModule {
override def millSourcePath = os.pwd / "tools" / "dsptools"
override def ivyDeps = Agg(
ivy"edu.berkeley.cs::chisel3:$chiselVersionString",
ivy"org.scalatest::scalatest:3.2.+",
ivy"org.typelevel::spire:0.17.0",
ivy"org.scalanlp::breeze:1.1",
ivy"junit:junit:4.13",
ivy"org.scalacheck::scalacheck:1.14.3",
ivy"edu.berkeley.cs::chisel-iotesters:2.5.1"
)
}
1 change: 1 addition & 0 deletions generators/rocket-chip
Submodule rocket-chip added at 25e2c6
50 changes: 0 additions & 50 deletions scripts/init_submodules_and_build_sbt.sh

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/remove_submodules.sh

This file was deleted.

Loading