Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tapasco
tapasco
Commits
46bd95d9
Commit
46bd95d9
authored
Jul 15, 2017
by
Jens Korinth
Browse files
Merge commit '69c3892a214fd740dd605d864fdd88f70a4c7dfd'
Pulled chisel-miscutils.
parents
a4d7be88
7854cfd1
Changes
6
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
46bd95d9
### Project Specific stuff
test_run_dir/*
### XilinxISE template
# intermediate build files
*.bgn
*.bit
*.bld
*.cmd_log
*.drc
*.ll
*.lso
*.msd
*.msk
*.ncd
*.ngc
*.ngd
*.ngr
*.pad
*.par
*.pcf
*.prj
*.ptwx
*.rbb
*.rbd
*.stx
*.syr
*.twr
*.twx
*.unroutes
*.ut
*.xpi
*.xst
*_bitgen.xwbt
*_envsettings.html
*_map.map
*_map.mrp
*_map.ngm
*_map.xrpt
*_ngdbuild.xrpt
*_pad.csv
*_pad.txt
*_par.xrpt
*_summary.html
*_summary.xml
*_usage.xml
*_xst.xrpt
# project-wide generated files
*.gise
par_usage_statistics.html
usage_statistics_webtalk.html
webtalk.log
webtalk_pn.xml
# generated folders
iseconfig/
xlnx_auto_0_xdb/
xst/
_ngo/
_xmsgs/
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### C template
# Object files
*.o
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
### SBT template
# Simple Build Tool
# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control
target/
lib_managed/
src_managed/
project/boot/
.history
.cache
### Emacs template
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
### Vim template
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
*.iml
## Directory-based project format:
.idea/
# 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:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### C++ template
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### OSX template
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Xcode template
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
### Scala template
*.class
*.log
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
# Scala-IDE specific
.scala_dependencies
.worksheet
### Java template
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
CoreDefinition.scala
View file @
46bd95d9
package
chisel.packaging
import
scala.io.Source
import
play.api.libs.json._
import
play.api.libs.functional.syntax._
import
C
hisel.Module
import
scala.io.Source
import
play.api.libs.json._
import
play.api.libs.functional.syntax._
import
c
hisel
3
.Module
/**
* Basic definition of a core for IP-XACT packaging.
...
...
ModuleBuilder.scala
View file @
46bd95d9
package
chisel.packaging
import
C
hisel._
import
scala.sys.process._
import
c
hisel
3
._
import
scala.sys.process._
/**
* Abstract IP-XACT builder class:
...
...
@@ -11,7 +11,7 @@ import scala.sys.process._
* (default: ./packaging)
**/
abstract
class
ModuleBuilder
(
packagingDir
:
String
=
"packaging"
)
{
val
chiselArgs
=
Array
(
"--backend"
,
"v"
,
"--compile"
)
val
chiselArgs
=
Array
[
String
](
)
val
modules
:
List
[(()
=>
Module
,
CoreDefinition
)]
def
main
(
args
:
Array
[
String
])
{
...
...
@@ -19,7 +19,7 @@ abstract class ModuleBuilder(packagingDir: String = "packaging") {
val
fm
=
modules
filter
(
m
=>
args
.
length
==
0
||
args
.
map
(
_
.
toLowerCase
).
contains
(
m
.
_2
.
name
.
toLowerCase
))
assert
(
fm
.
length
>
0
,
"no matching cores found for: "
+
args
.
mkString
(
", "
))
fm
foreach
{
m
=>
chiselMain
(
chiselArgs
++
Array
(
"--target
D
ir"
,
m
.
_2
.
root
),
m
.
_1
)
Driver
.
execute
(
chiselArgs
++
Array
(
"--target
-d
ir"
,
m
.
_2
.
root
),
m
.
_1
)
m
.
_2
.
postBuildActions
map
(
fn
=>
fn
.
apply
(
m
.
_1
()))
val
json
=
"%s/%s.json"
.
format
(
m
.
_2
.
root
,
m
.
_2
.
name
)
m
.
_2
.
write
(
json
)
...
...
README.md
0 → 100644
View file @
46bd95d9
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.
Requirements
----------------------
*
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 https://bitbucket.org/jkorinth/chisel-packaging.git
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 = project.in(file("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`
.
Gotchas
-------
*
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`
.
[
1
]:
https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
[
2
]:
https://www.xilinx.com/products/design-tools/vivado.html
[
3
]:
example/ModuleBuilderTest.scala
build.sbt
View file @
46bd95d9
...
...
@@ -8,8 +8,19 @@ scalaVersion := "2.11.0"
crossScalaVersions
:=
Seq
(
"2.10.3"
,
"2.10.4"
,
"2.11.0"
)
resolvers
++=
Seq
(
Resolver
.
sonatypeRepo
(
"snapshots"
),
Resolver
.
sonatypeRepo
(
"releases"
)
)
// 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
(
"edu.berkeley.cs"
%%
"chisel"
%
"latest.release"
,
"com.typesafe.play"
%%
"play-json"
%
"2.4.8"
)
example/ModuleBuilderTest.scala
0 → 100644
View file @
46bd95d9
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
,
CoreDefinition
(
name
=
"TestModule"
,
vendor
=
"esa.cs.tu-darmstadt.de"
,
library
=
"chisel"
,
version
=
"1.0"
,
root
(
"TestModule"
)
)
)
)
}
Jens Korinth
@jk
mentioned in commit
17f0d672
·
Mar 05, 2018
mentioned in commit
17f0d672
mentioned in commit 17f0d67240ebf5d7e1d0be9162d272b04256c47d
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment