24 Commits

Author SHA1 Message Date
Dolu1990
324e3dce52 SpinalHDL 1.12.3 2025-08-15 12:31:10 +02:00
Dolu1990
976ceca3a3 Update Config.scala
onlyStdLogicVectorAtTopLevelIo = false as it prevent VHDL / GHDL sim
2025-04-06 14:58:20 +02:00
Dolu1990
2aefabbbad SpinalHDL 1.12.0 2025-03-19 07:53:23 +01:00
Dolu1990
52417f9d8c SpinalHDL 1.11.0 2024-12-17 11:00:48 +01:00
Dolu1990
1629b51311 Merge pull request #42 from samuelgruetter/update_build_tools
update mill and sbt version
2024-10-14 10:16:44 +02:00
Samuel Gruetter
fc9ca1ffd9 update mill and sbt version 2024-10-10 14:26:47 +02:00
Dolu1990
d7575b9a5d Merge pull request #41 from cheungxi/master
upgrade scala version to 2.13.14
2024-09-03 17:53:48 +02:00
Zhang Xi
c2950be884 upgrade scala version to 2.13.14 2024-09-02 17:50:22 +08:00
Dolu1990
8456715b1c SpinalHDL 1.10.2a 2024-07-04 10:10:06 +02:00
Dolu1990
4b7dfe2d2b SpinalHDL 1.10.2 2024-06-13 11:12:43 +02:00
Dolu1990
3b84555158 SpinalHDL 1.10.1 2024-02-01 10:35:36 +01:00
Dolu1990
51249d4c6e SpinalHDL 1.10.0 2024-01-04 10:10:33 +01:00
Dolu1990
17607424ab Merge pull request #36 from IanBoyanZhang/patch-1
Fix typo in README
2023-11-06 11:46:07 +01:00
Ian Zhang
f3256ed4e1 Fix typo in README 2023-11-04 16:35:54 -07:00
Dolu1990
766b80b3f1 SpinalHDL 1.9.4 2023-11-01 09:41:06 +01:00
Dolu1990
f47ac2f65f SpinalHDL 1.9.3 2023-08-16 10:01:33 +02:00
Dolu1990
9fe5ded40a SpinalHDL 1.9.0 for build.sc too <3 2023-07-21 17:46:38 +02:00
Dolu1990
2bf3acd857 SpinalHDL 1.9.0 2023-07-21 17:42:13 +02:00
Dolu1990
a4eb1e65ef SpinalHDL 1.8.1 2023-03-27 09:57:17 +02:00
Dolu1990
88fb4a7f49 SpinalHDL 1.8.0 2022-12-05 20:26:59 +01:00
Dolu1990
950e9c2c72 Merge pull request #27 from SpinalHDL/25-readme-pointing-to-getting-started-from-rtd
Readme pointing to Getting started from RTD
2022-11-30 18:39:16 +01:00
Côme
dd76ac14f7 Update README.md 2022-11-30 14:45:35 +01:00
Côme
3929e815a5 Add instructions to modify the template 2022-11-30 14:42:49 +01:00
Côme
cb8b3565b9 Readme pointing to Getting started from RTD 2022-11-30 14:17:32 +01:00
6 changed files with 56 additions and 112 deletions

View File

@@ -1 +1 @@
0.9.8 0.11.11

153
README.md
View File

@@ -1,140 +1,83 @@
Spinal Base Project # SpinalHDL Base Project
============
This repository is a base SBT project added to help non Scala/SBT native people in their first steps.
Just one important note, you need a java JDK >= 8 This repository is a base project to help Spinal users set-up project without knowledge about Scala and SBT.
On debian :
## If it is your are learning SpinalHDL
You can follow the tutorial on the [Getting Started](https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Getting%20Started/index.html) page.
More specifically:
* instructions to install tools can be found on the [Install and setup](https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Getting%20Started/Install%20and%20setup.html#install-and-setup) page
* instructions to get this repository locally are available in the [Create a SpinalHDL project](https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Getting%20Started/Install%20and%20setup.html#create-a-spinalhdl-project) section.
### TL;DR Things have already been set up in my environment, how do I run things to try SpinalHDL?
Once in the `SpinalTemplateSbt` directory, when tools are installed, the commands below can be run to use `sbt`.
```sh ```sh
sudo add-apt-repository -y ppa:openjdk-r/ppa // To generate the Verilog from the example
sudo apt-get update
sudo apt-get install openjdk-8-jdk -y
#To set the default java
sudo update-alternatives --config java
sudo update-alternatives --config javac
```
## Basics, without any IDE
You need to install SBT
```sh
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /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
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt
```
If you want to run the scala written testbench, you have to be on linux and have Verilator installed (a recent version) :
```sh
sudo apt-get install git make autoconf g++ flex bison -y # First time prerequisites
git clone http://git.veripool.org/git/verilator # Only first time
unsetenv VERILATOR_ROOT # For csh; ignore error if on bash
unset VERILATOR_ROOT # For bash
cd verilator
git pull # Make sure we're up-to-date
git checkout v4.216
autoconf # Create ./configure script
./configure
make -j$(nproc)
sudo make install
cd ..
echo "DONE"
```
Clone or download this repository.
```sh
git clone https://github.com/SpinalHDL/SpinalTemplateSbt.git
```
Open a terminal in the root of it and run "sbt run". At the first execution, the process could take some seconds
```sh
cd SpinalTemplateSbt
//If you want to generate the Verilog of your design
sbt "runMain projectname.MyTopLevelVerilog" sbt "runMain projectname.MyTopLevelVerilog"
//If you want to generate the VHDL of your design // To generate the VHDL from the example
sbt "runMain projectname.MyTopLevelVhdl" sbt "runMain projectname.MyTopLevelVhdl"
//If you want to run the scala written testbench // To run the testbench
sbt "runMain projectname.MyTopLevelSim" sbt "runMain projectname.MyTopLevelSim"
``` ```
The top level spinal code is defined into src\main\scala\mylib * The example hardware description is into `hw/spinal/projectname/MyTopLevel.scala`
* The testbench is into `hw/spinal/projectname/MyTopLevelSim.scala`
## Basics, with Intellij IDEA and its scala plugin When you really start working with SpinalHDL, it is recommended (both for comfort and efficiency) to use an IDE, see the [Getting started](https://spinalhdl.github.io/SpinalDoc-RTD/master/SpinalHDL/Getting%20Started/index.html).
You need to install :
- Java JDK 8 ## If you want to create a new project from this template
- SBT
- Intellij IDEA (the free Community Edition is good enough)
- Intellij IDEA Scala plugin (when you run Intellij IDEA the first time, he will ask you about it)
And do the following : ### Change project name
- Clone or download this repository. You might want to change the project name, which is currently `projectname`. To do so (let's say your actual project name is `myproject`; it must be all lowercase with no separators):
- In Intellij IDEA, "import project" with the root of this repository, Import project from external model SBT
- In addition maybe you need to specify some path like JDK to Intellij
- In the project (Intellij project GUI), go in src/main/scala/mylib/MyTopLevel.scala, right click on MyTopLevelVerilog, "Run MyTopLevelVerilog"
Normally, this must generate an MyTopLevel.v output files. * Update `build.sbt` and/or `build.sc` by replacing `projectname` by the name of your project `myproject` (1 occurrence in each file). The better is to replace in both (it will always work), but in some contexts you can keep only one of these two files:
* If you are sure all people only use `sbt`, you can replace only in `build.sbt` and remove `build.sc`
* If you are sure all people only use `mill`, you can replace only in `build.sc` and remove `build.sbt`
* Replace in both files for open-source project.
* Put all your scala files into `hw/spinal/myproject/` (remove the unused `hw/spinal/projectname/` folder)
* Start all your scala files with `package myproject`
## Basics, with Eclipse and its scala plugin
First, i "strongly" suggest to use intellij idea instead. ### Change project structure
You need to install : You can change the project structure as you want. The only restrictions (from Scala environment) are (let's say your actual project name is `myproject`):
- Java JDK * you must have a `myproject` folder and files in it must start with `package myproject`
- Scala * if you have a file in a subfolder `myproject/somepackage/MyElement.scala` it must start with `package myproject.somepackage`.
- SBT * `sbt` and `mill` must be run right in the folder containing their configurations (recommended to not move these files)
- Eclipse (tested with Mars.2 - 4.5.2)
- [scala plugin](http://scala-ide.org/) (tested with 4.4.1)
And do the following : Once the project structure is modified, update configurations:
- Clone or download this repository. * In `build.sbt` and/or `build.sc` (see above) replace `/ "hw" / "spinal"` by the new path to the folder containing the `myproject` folder.
- Revert changes from https://github.com/SpinalHDL/SpinalTemplateSbt/commit/173bbb9bb8cbf70087339104f6ebced9321908dd * In the spinal configuration file (if you kept it, by default it is in `projectname/Config.scala`) change the path in `targetDirectory = "hw/gen"` to the directory where you want generated files to be written. If you don't use a config or if it doesn't contain this element, generated files will be written in the root directory.
- Run ```sbt eclipse``` in the ```SpinalTemplateSbt``` directory.
- 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 ### Update this README
Of course you can replace/modify this file to help people with your own project!
Normally, this must generate output file ```MyTopLevel.v```.
## Mill Support (Experimental) ## Mill Support (Experimental)
This Spinal Base Project contains support for the [Mill build tool](https://com-lihaoyi.github.io/mill). The [Mill build tool](https://com-lihaoyi.github.io/mill) can be installed and used instead of `sbt`.
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 ```sh
git clone https://github.com/SpinalHDL/SpinalTemplateSbt.git // To generate the Verilog from the example
```
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 projectname.runMain projectname.MyTopLevelVerilog mill projectname.runMain projectname.MyTopLevelVerilog
//If you want to generate the VHDL of your design // To generate the VHDL from the example
mill projectname.runMain projectname.MyTopLevelVhdl mill projectname.runMain projectname.MyTopLevelVhdl
//If you want to run the scala written testbench // To run the testbench
mill projectname.runMain projectname.MyTopLevelSim mill projectname.runMain projectname.MyTopLevelSim
``` ```
The top level spinal code is defined into src\main\scala\mylib

View File

@@ -1,14 +1,15 @@
ThisBuild / version := "1.0" ThisBuild / version := "1.0"
ThisBuild / scalaVersion := "2.12.16" ThisBuild / scalaVersion := "2.13.14"
ThisBuild / organization := "org.example" ThisBuild / organization := "org.example"
val spinalVersion = "1.7.3" val spinalVersion = "1.12.3"
val spinalCore = "com.github.spinalhdl" %% "spinalhdl-core" % spinalVersion val spinalCore = "com.github.spinalhdl" %% "spinalhdl-core" % spinalVersion
val spinalLib = "com.github.spinalhdl" %% "spinalhdl-lib" % spinalVersion val spinalLib = "com.github.spinalhdl" %% "spinalhdl-lib" % spinalVersion
val spinalIdslPlugin = compilerPlugin("com.github.spinalhdl" %% "spinalhdl-idsl-plugin" % spinalVersion) val spinalIdslPlugin = compilerPlugin("com.github.spinalhdl" %% "spinalhdl-idsl-plugin" % spinalVersion)
lazy val projectname = (project in file(".")) lazy val projectname = (project in file("."))
.settings( .settings(
name := "myproject",
Compile / scalaSource := baseDirectory.value / "hw" / "spinal", Compile / scalaSource := baseDirectory.value / "hw" / "spinal",
libraryDependencies ++= Seq(spinalCore, spinalLib, spinalIdslPlugin) libraryDependencies ++= Seq(spinalCore, spinalLib, spinalIdslPlugin)
) )

View File

@@ -1,9 +1,9 @@
import mill._, scalalib._ import mill._, scalalib._
val spinalVersion = "1.7.3" val spinalVersion = "1.12.3"
object projectname extends SbtModule { object projectname extends SbtModule {
def scalaVersion = "2.12.16" def scalaVersion = "2.13.14"
override def millSourcePath = os.pwd override def millSourcePath = os.pwd
def sources = T.sources( def sources = T.sources(
millSourcePath / "hw" / "spinal" millSourcePath / "hw" / "spinal"

View File

@@ -9,7 +9,7 @@ object Config {
defaultConfigForClockDomains = ClockDomainConfig( defaultConfigForClockDomains = ClockDomainConfig(
resetActiveLevel = HIGH resetActiveLevel = HIGH
), ),
onlyStdLogicVectorAtTopLevelIo = true onlyStdLogicVectorAtTopLevelIo = false
) )
def sim = SimConfig.withConfig(spinal).withFstWave def sim = SimConfig.withConfig(spinal).withFstWave

View File

@@ -1 +1 @@
sbt.version=1.6.0 sbt.version=1.10.2