1 Star 0 Fork 0

qinyalei / SpinalTemplateSbt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

SpinalHDL Base Project

This repository is a base project to help Spinal users set-up project without knowledge about Scala and SBT.

If it is your are learning SpinalHDL

You can follow the tutorial on the Getting Started page.

More specifically:

TL;DR Things have arleady 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.

// To generate the Verilog from the example
sbt "runMain projectname.MyTopLevelVerilog"

// To generate the VHDL from the example
sbt "runMain projectname.MyTopLevelVhdl"

// To run the testbench
sbt "runMain projectname.MyTopLevelSim"
  • The example hardware description is into hw/spinal/projectname/MyTopLevel.scala
  • The testbench is into hw/spinal/projectname/MyTopLevelSim.scala

When you really start working with SpinalHDL, it is recommended (both for comfort and efficiency) to use an IDE, see the Getting started.

If you want to create a new project from this template

Change project name

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):

  • 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

Change project structure

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):

  • you must have a myproject folder and files in it must start with package myproject
  • if you have a file in a subfolder myproject/somepackage/MyElement.scala it must start with package myproject.somepackage.
  • sbt and mill must be run right in the folder containing their configurations (recommended to not move these files)

Once the project structure is modified, update configurations:

  • In build.sbt and/or build.sc (see above) replace / "hw" / "spinal" by the new path to the folder containing the myproject folder.
  • 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.

Update this README

Of course you can replace/modify this file to help people with your own project!

Mill Support (Experimental)

The Mill build tool can be installed and used instead of sbt.

// To generate the Verilog from the example
mill projectname.runMain projectname.MyTopLevelVerilog

// To generate the VHDL from the example
mill projectname.runMain projectname.MyTopLevelVhdl

// To run the testbench
mill projectname.runMain projectname.MyTopLevelSim

空文件

简介

SpinalTemplateSbt 展开 收起
Scala
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/qinyalei/SpinalTemplateSbt.git
git@gitee.com:qinyalei/SpinalTemplateSbt.git
qinyalei
SpinalTemplateSbt
SpinalTemplateSbt
master

搜索帮助