Commit c5f977bc authored by Jens Korinth's avatar Jens Korinth
Browse files

Squashed 'packaging/' changes from 99804e52..7854cfd1

7854cfd1 Update - fix dead link
b992dd73 edited online with Bitbucket
f15683a7 Update
fdfd1420 Update
2190c490 Write
4531adea Update to Chisel 3.0 (SNAPSHOT)

git-subtree-dir: packaging
git-subtree-split: 7854cfd1
parent 9db79f78
### Project Specific stuff
### XilinxISE template
# intermediate build files
# project-wide generated files
# generated folders
### Eclipse template
# Eclipse Core
# External tool builders
# Locally stored "Eclipse launch configurations"
# CDT-specific
# JDT-specific (Eclipse Java Development Tools)
# Java annotation processor (APT)
# PDT-specific
# sbteclipse plugin
# TeXlipse plugin
### C template
# Object files
# Precompiled Headers
# Libraries
# Shared objects (inc. Windows DLLs)
# Executables
# Debug files
### SBT template
# Simple Build Tool
### Emacs template
# -*- mode: gitignore; -*-
# Org-mode
# flymake-mode
# eshell files
# elpa packages
# reftex files
# AUCTeX auto folder
# cask packages
### Vim template
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
## Directory-based project format:
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
## Plugin-specific files:
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
### C++ template
# Compiled Object files
# Precompiled Headers
# Compiled Dynamic libraries
# Fortran module files
# Compiled Static libraries
# Executables
### OSX template
# Icon must end with two \r
# Thumbnails
# Files that might appear in the root of a volume
# Directories potentially created on remote AFP share
Network Trash Folder
Temporary Items
### Xcode template
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
## Various settings
## Other
### Scala template
# sbt specific
# Scala-IDE specific
### Java template
# Mobile Tools for Java (J2ME)
# Package Files #
# virtual machine crash logs, see
package chisel.packaging package chisel.packaging
import import
import play.api.libs.json._ import play.api.libs.json._
import play.api.libs.functional.syntax._ import play.api.libs.functional.syntax._
import Chisel.Module import chisel3.Module
/** /**
* Basic definition of a core for IP-XACT packaging. * Basic definition of a core for IP-XACT packaging.
package chisel.packaging package chisel.packaging
import Chisel._ import chisel3._
import scala.sys.process._ import scala.sys.process._
/** /**
* Abstract IP-XACT builder class: * Abstract IP-XACT builder class:
...@@ -11,7 +11,7 @@ import scala.sys.process._ ...@@ -11,7 +11,7 @@ import scala.sys.process._
* (default: ./packaging) * (default: ./packaging)
**/ **/
abstract class ModuleBuilder(packagingDir: String = "packaging") { abstract class ModuleBuilder(packagingDir: String = "packaging") {
val chiselArgs = Array("--backend", "v", "--compile") val chiselArgs = Array[String]()
val modules: List[(() => Module, CoreDefinition)] val modules: List[(() => Module, CoreDefinition)]
def main(args: Array[String]) { def main(args: Array[String]) {
...@@ -19,7 +19,7 @@ abstract class ModuleBuilder(packagingDir: String = "packaging") { ...@@ -19,7 +19,7 @@ abstract class ModuleBuilder(packagingDir: String = "packaging") {
val fm = modules filter (m => args.length == 0 || val fm = modules filter (m => args.length == 0 ||
assert (fm.length > 0, "no matching cores found for: " + args.mkString(", ")) assert (fm.length > 0, "no matching cores found for: " + args.mkString(", "))
fm foreach { m => fm foreach { m =>
chiselMain(chiselArgs ++ Array("--targetDir", m._2.root), m._1) Driver.execute(chiselArgs ++ Array("--target-dir", m._2.root), m._1)
m._2.postBuildActions map (fn => fn.apply(m._1())) m._2.postBuildActions map (fn => fn.apply(m._1()))
val json = "%s/%s.json".format(m._2.root, val json = "%s/%s.json".format(m._2.root,
m._2.write(json) m._2.write(json)
Chisel IP-XACT packaging for Xilinx Vivado Design Suite
Helper scripts and Scala classes to simplify the generation of IP-XACT IP cores from Chisel.
Uses [*Xilinx Vivado Design Suite*] [2] to infer most of the interfaces automatically.
The resulting `component.xml` files can be edited manually or with Vivado, if the automagic
did not fit your needs.
* Vivado 2016.x+
* Chisel 3.x *(currently using `3.0-SNAPSHOT`)*
* *optional*: sbt
Basic Usage
Class `ModuleBuilder` provides an abstract base class for an executable object with a `main`
method. You'll only need to provide a list of Chisel cores you'd like to wrap into IP-XACT.
A full example can be found in `example`; test it as follows:
1. Source the Vivado settings scripts, make sure `vivado` is in the `PATH`.
2. In the `chisel-packaging` base dir, do:
cp example/* .
3. Execute via:
sbt run
4. This should create a new directory `ip`, which contains subdirectories for each core.
The subdirectories contain the Verilog sources and the IP-XACT `component.xml`.
You can use the `ip` directory as a base directory for user IP in Vivado, the cores should
automatically appear in Vivado and IP-Integrator.
Usage in Chisel Projects (*sbt*)
The easiest way to setup `chisel-packaging` for your Chisel project with `sbt` is using
**git subtree** ([this article] [1] has an excellent intro to subtrees) as follows:
1. In your the base directory of your project, add a new remote *chisel-packaging*:
git remote add chisel-packaging
2. Setup a subtree in `packaging`:
git subtree add --prefix packaging chisel-packaging master --squash
This will clone the `chisel-packaging` into the `packaging` folder.
3. Add a project dependency in your `build.sbt`, add lines:
lazy val packaging ="packaging"))
lazy val root = (project in file(".")).dependsOn(packaging)
*Note that the empty lines are **not optional** - a quirk of sbt.*
4. Implement `chisel.packaging.ModuleBuilder` in your own code; if you've chosen
a different directory than `packaging` for the subtree, you can pass it to the
baseclass constructor -- see [example/ModuleBuilderTest.scala][3]
5. Build the IP-XACT cores via `sbt run`.
* The python script requires `vivado` to be in `PATH`, so you need to source the Vivado
settings scripts first.
* The repo is setup for Chisel 3.x; it can be used for Chisel 2.x, but that requires
manual changes - open an issue in the issue tracker if you need it.
* If you're using the `sbt` approach outlined above, make sure your `build.sbt` contains
the empty lines; they are required by `sbt`.
[3]: example/ModuleBuilderTest.scala
...@@ -8,8 +8,19 @@ scalaVersion := "2.11.0" ...@@ -8,8 +8,19 @@ scalaVersion := "2.11.0"
crossScalaVersions := Seq("2.10.3", "2.10.4", "2.11.0") crossScalaVersions := Seq("2.10.3", "2.10.4", "2.11.0")
resolvers ++= Seq(
// Provide a managed dependency on X if -DXVersion="" is supplied on the command line.
val defaultVersions = Map("chisel3" -> "3.0-SNAPSHOT",
"chisel-iotesters" -> "1.1-SNAPSHOT")
libraryDependencies ++= (Seq("chisel3","chisel-iotesters").map {
dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) })
libraryDependencies ++= Seq( libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel" % "latest.release",
"" %% "play-json" % "2.4.8" "" %% "play-json" % "2.4.8"
) )
package chisel.packaging
import chisel3._
import CoreDefinition._
object ModuleBuilderTest extends ModuleBuilder(".") {
private object TestModule extends Module { val io = IO(new Bundle) }
val modules: List[(() => Module, CoreDefinition)] = List(
( // test module
() => TestModule,
name = "TestModule",
vendor = "",
library = "chisel",
version = "1.0",
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment