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

Structure suggestion #23

Merged
merged 1 commit into from
Nov 28, 2022
Merged
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
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ val spinalCore = "com.github.spinalhdl" %% "spinalhdl-core" % spinalVersion
val spinalLib = "com.github.spinalhdl" %% "spinalhdl-lib" % spinalVersion
val spinalIdslPlugin = compilerPlugin("com.github.spinalhdl" %% "spinalhdl-idsl-plugin" % spinalVersion)

lazy val mylib = (project in file("."))
lazy val projectname = (project in file("."))
.settings(
name := "SpinalTemplateSbt",
Compile / scalaSource := baseDirectory.value / "hw" / "spinal",
libraryDependencies ++= Seq(spinalCore, spinalLib, spinalIdslPlugin)
)

Expand Down
7 changes: 5 additions & 2 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import mill._, scalalib._

val spinalVersion = "1.7.3"

object mylib extends SbtModule {
def scalaVersion = "2.12.14"
object projectname extends SbtModule {
def scalaVersion = "2.12.16"
override def millSourcePath = os.pwd
def sources = T.sources(
millSourcePath / "hw" / "spinal"
)
def ivyDeps = Agg(
ivy"com.github.spinalhdl::spinalhdl-core:$spinalVersion",
ivy"com.github.spinalhdl::spinalhdl-lib:$spinalVersion"
Expand Down
1 change: 1 addition & 0 deletions hw/gen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*
16 changes: 16 additions & 0 deletions hw/spinal/projectname/Config.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package projectname

import spinal.core._
import spinal.core.sim._

object Config {
def spinal = SpinalConfig(
targetDirectory = "hw/gen",
defaultConfigForClockDomains = ClockDomainConfig(
resetActiveLevel = HIGH
),
onlyStdLogicVectorAtTopLevelIo = true
)

def sim = SimConfig.withConfig(spinal).withFstWave
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mylib
package projectname

import spinal.core._

Expand All @@ -20,3 +20,11 @@ case class MyTopLevel() extends Component {
io.state := counter
io.flag := (counter === 0) | io.cond1
}

object MyTopLevelVerilog extends App {
Config.spinal.generateVerilog(MyTopLevel())
}

object MyTopLevelVhdl extends App {
Config.spinal.generateVhdl(MyTopLevel())
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mylib
package projectname

import spinal.core._
import spinal.core.formal._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package mylib
package projectname

import spinal.core._
import spinal.core.sim._

object MyTopLevelSim extends App {
SimConfig.withWave.doSim(MyTopLevel()) { dut =>
Config.sim.compile(MyTopLevel()).doSim { dut =>
// Fork a process to generate the reset and the clock on the dut
dut.clockDomain.forkStimulus(period = 10)

Expand Down
Empty file added hw/verilog/.gitignore
Empty file.
Empty file added hw/vhdl/.gitignore
Empty file.
25 changes: 0 additions & 25 deletions src/main/scala/mylib/MyTopLevelGen.scala

This file was deleted.