This commit is contained in:
Dolu
2015-04-21 12:28:03 +02:00
commit fa1ec62a04
5 changed files with 123 additions and 0 deletions

28
.gitignore vendored Normal file
View File

@@ -0,0 +1,28 @@
*.class
*.log
*.bak
# sbt specific
.cache/
.history/
.lib/
dist/*
target
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
.idea
out
#User
*.vhd
*.cf
*.json
!tester/src/test/resources/*.vhd

38
README.md Normal file
View File

@@ -0,0 +1,38 @@
Spinal Base Project
============
This repository is a base SBT project added to help non Scala/SBT native people in their first steps.
## Basics, without any IDE
You need to install :
- Java JDK
- Scala
- SBT
And do the following :
- Clone or download this repository.
- Open a terminal in the root of it and run "sbt run". At the first execution, the process could take some seconds
Normally, this command must generate output files MyTopLevel.vhd.
The top level spinal code is defined into src\main\scala\MyCode
## Basics, with Intellij IDEA and his scala plugin
You need to install :
- Java JDK
- Scala
- SBT
- Intellij IDEA (the free Community Edition is nice)
- Intellij IDEA Scala plugin
And do the following :
- Clone or download this repository.
- In Intellij IDEA, "import project" with the root of this repository, Import project from external model SBT, Check all box
- In addition maybe you need to specify some path like JDK to Intellij
- In the project (Intellij project GUI), right click on src/main/scala/MyCode/TopLeve.scala and select "Run MyTopLevel"
Normally, this must generate output files MyTopLevel.vhd.

11
build.sbt Normal file
View File

@@ -0,0 +1,11 @@
name := "SpinalBaseProject"
version := "1.0"
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
"com.github.spinalhdl" % "spinalhdl-core_2.11" % "latest.release",
"com.github.spinalhdl" % "spinalhdl-lib_2.11" % "latest.release"
)

0
project/plugin.sbt Normal file
View File

View File

@@ -0,0 +1,46 @@
/*
* SpinalHDL
* Copyright (c) Dolu, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package MyCode
import spinal.core._
import spinal.lib._
class MyTopLevel extends Component {
val io = new Bundle {
val cond0 = in Bool
val cond1 = in Bool
val flag = out Bool
val state = out UInt(8 bit)
}
val counter = Reg(UInt(8 bit)) init(0)
when(io.cond0){
counter := counter + 1
}
io.state := counter
io.flag := (counter === 0) | io.cond1
}
object MyTopLevel {
def main(args: Array[String]) {
SpinalVhdl(new MyTopLevel)
}
}