mirror of
https://github.com/SpinalHDL/SpinalTemplateSbt.git
synced 2025-10-25 08:48:45 +08:00
Compare commits
1 Commits
8e8b22f6ec
...
withAssemb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
514b43937b |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -20,9 +20,6 @@ project/plugins/project/
|
|||||||
.idea
|
.idea
|
||||||
out
|
out
|
||||||
|
|
||||||
# Metals
|
|
||||||
.metals
|
|
||||||
|
|
||||||
# Eclipse
|
# Eclipse
|
||||||
bin/
|
bin/
|
||||||
.classpath
|
.classpath
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
0.9.8
|
|
||||||
38
README.md
38
README.md
@@ -21,9 +21,8 @@ sudo update-alternatives --config javac
|
|||||||
You need to install SBT
|
You need to install SBT
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
|
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
|
||||||
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
|
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
|
||||||
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install sbt
|
sudo apt-get install sbt
|
||||||
```
|
```
|
||||||
@@ -37,7 +36,7 @@ unsetenv VERILATOR_ROOT # For csh; ignore error if on bash
|
|||||||
unset VERILATOR_ROOT # For bash
|
unset VERILATOR_ROOT # For bash
|
||||||
cd verilator
|
cd verilator
|
||||||
git pull # Make sure we're up-to-date
|
git pull # Make sure we're up-to-date
|
||||||
git checkout v4.040
|
git checkout verilator_3_916
|
||||||
autoconf # Create ./configure script
|
autoconf # Create ./configure script
|
||||||
./configure
|
./configure
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
@@ -90,8 +89,6 @@ Normally, this must generate an MyTopLevel.v output files.
|
|||||||
|
|
||||||
## Basics, with Eclipse and its scala plugin
|
## Basics, with Eclipse and its scala plugin
|
||||||
|
|
||||||
First, i "strongly" suggest to use intellij idea instead.
|
|
||||||
|
|
||||||
You need to install :
|
You need to install :
|
||||||
|
|
||||||
- Java JDK
|
- Java JDK
|
||||||
@@ -103,38 +100,9 @@ You need to install :
|
|||||||
And do the following :
|
And do the following :
|
||||||
|
|
||||||
- Clone or download this repository.
|
- Clone or download this repository.
|
||||||
- Revert changes from https://github.com/SpinalHDL/SpinalTemplateSbt/commit/173bbb9bb8cbf70087339104f6ebced9321908dd
|
|
||||||
- Run ```sbt eclipse``` in the ```SpinalTemplateSbt``` directory.
|
- Run ```sbt eclipse``` in the ```SpinalTemplateSbt``` directory.
|
||||||
- Import the eclipse project from eclipse.
|
- Import the eclipse project from eclipse.
|
||||||
- In the project (eclipse project GUI), right click on src/main/scala/mylib/MyTopLevel.scala, right click on MyTopLevelVerilog, and select run it
|
- In the project (eclipse project GUI), right click on src/main/scala/mylib/MyTopLevel.scala, right click on MyTopLevelVerilog, and select run it
|
||||||
|
|
||||||
Normally, this must generate output file ```MyTopLevel.v```.
|
Normally, this must generate output file ```MyTopLevel.v```.
|
||||||
|
|
||||||
## Mill Support (Experimental)
|
|
||||||
|
|
||||||
This Spinal Base Project contains support for the [Mill build tool](https://com-lihaoyi.github.io/mill).
|
|
||||||
|
|
||||||
The prerequisites are the same as for using SBT, except for sbt itself. Additionally, the ```mill``` executable needs to be installed on the path. Download it to ```/usr/local/bin/mill``` or ```~/bin/mill``` according to the [installation instructions](https://com-lihaoyi.github.io/mill/mill/Intro_to_Mill.html#_installation).
|
|
||||||
|
|
||||||
You can clone and use this repository in the following way.
|
|
||||||
|
|
||||||
```sh
|
|
||||||
git clone https://github.com/SpinalHDL/SpinalTemplateSbt.git
|
|
||||||
```
|
|
||||||
|
|
||||||
Open a terminal in the root of it and execute your favorite mill command. At the first execution, the process could take some seconds
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cd SpinalTemplateSbt
|
|
||||||
|
|
||||||
//If you want to generate the Verilog of your design
|
|
||||||
mill mylib.runMain mylib.MyTopLevelVerilog
|
|
||||||
|
|
||||||
//If you want to generate the VHDL of your design
|
|
||||||
mill mylib.runMain mylib.MyTopLevelVhdl
|
|
||||||
|
|
||||||
//If you want to run the scala written testbench
|
|
||||||
mill mylib.runMain mylib.MyTopLevelSim
|
|
||||||
```
|
|
||||||
|
|
||||||
The top level spinal code is defined into src\main\scala\mylib
|
|
||||||
|
|||||||
21
build.sbt
21
build.sbt
@@ -1,16 +1,13 @@
|
|||||||
ThisBuild / version := "1.0"
|
name := "SpinalTemplateSbt"
|
||||||
ThisBuild / scalaVersion := "2.12.16"
|
version := "1.0"
|
||||||
ThisBuild / organization := "org.example"
|
scalaVersion := "2.11.12"
|
||||||
|
val spinalVersion = "1.4.0"
|
||||||
|
|
||||||
val spinalVersion = "1.7.3"
|
libraryDependencies ++= Seq(
|
||||||
val spinalCore = "com.github.spinalhdl" %% "spinalhdl-core" % spinalVersion
|
"com.github.spinalhdl" % "spinalhdl-core_2.11" % spinalVersion,
|
||||||
val spinalLib = "com.github.spinalhdl" %% "spinalhdl-lib" % spinalVersion
|
"com.github.spinalhdl" % "spinalhdl-lib_2.11" % spinalVersion,
|
||||||
val spinalIdslPlugin = compilerPlugin("com.github.spinalhdl" %% "spinalhdl-idsl-plugin" % spinalVersion)
|
compilerPlugin("com.github.spinalhdl" % "spinalhdl-idsl-plugin_2.11" % spinalVersion)
|
||||||
|
|
||||||
lazy val mylib = (project in file("."))
|
|
||||||
.settings(
|
|
||||||
name := "SpinalTemplateSbt",
|
|
||||||
libraryDependencies ++= Seq(spinalCore, spinalLib, spinalIdslPlugin)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
fork := true
|
fork := true
|
||||||
|
EclipseKeys.withSource := true
|
||||||
|
|||||||
13
build.sc
13
build.sc
@@ -1,13 +0,0 @@
|
|||||||
import mill._, scalalib._
|
|
||||||
|
|
||||||
val spinalVersion = "1.7.3"
|
|
||||||
|
|
||||||
object mylib extends SbtModule {
|
|
||||||
def scalaVersion = "2.12.14"
|
|
||||||
override def millSourcePath = os.pwd
|
|
||||||
def ivyDeps = Agg(
|
|
||||||
ivy"com.github.spinalhdl::spinalhdl-core:$spinalVersion",
|
|
||||||
ivy"com.github.spinalhdl::spinalhdl-lib:$spinalVersion"
|
|
||||||
)
|
|
||||||
def scalacPluginIvyDeps = Agg(ivy"com.github.spinalhdl::spinalhdl-idsl-plugin:$spinalVersion")
|
|
||||||
}
|
|
||||||
@@ -1 +1 @@
|
|||||||
sbt.version=1.6.0
|
sbt.version=1.3.3
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.4")
|
||||||
|
|
||||||
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ import scala.util.Random
|
|||||||
//Hardware definition
|
//Hardware definition
|
||||||
class MyTopLevel extends Component {
|
class MyTopLevel extends Component {
|
||||||
val io = new Bundle {
|
val io = new Bundle {
|
||||||
val cond0 = in Bool()
|
val cond0 = in Bool
|
||||||
val cond1 = in Bool()
|
val cond1 = in Bool
|
||||||
val flag = out Bool()
|
val flag = out Bool
|
||||||
val state = out UInt(8 bits)
|
val state = out UInt(8 bits)
|
||||||
}
|
}
|
||||||
val counter = Reg(UInt(8 bits)) init(0)
|
val counter = Reg(UInt(8 bits)) init(0)
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package mylib
|
|
||||||
|
|
||||||
import spinal.core._
|
|
||||||
import spinal.core.formal._
|
|
||||||
|
|
||||||
// You need SymbiYosys to be installed.
|
|
||||||
// See https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Formal%20verification/index.html#installing-requirements
|
|
||||||
object MyTopLevelFormal {
|
|
||||||
def main(args: Array[String]) {
|
|
||||||
FormalConfig.withBMC(10).doVerify(new Component {
|
|
||||||
val dut = FormalDut(new MyTopLevel)
|
|
||||||
|
|
||||||
// Ensure the formal test start with a reset
|
|
||||||
assumeInitial(clockDomain.isResetActive)
|
|
||||||
|
|
||||||
// Provide some stimulus
|
|
||||||
anyseq(dut.io.cond0)
|
|
||||||
anyseq(dut.io.cond1)
|
|
||||||
|
|
||||||
// Check the state initial value and increment
|
|
||||||
assert(dut.io.state === past(dut.io.state + U(dut.io.cond0)).init(0))
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user