Commit 8db0ad04 authored by Bruno FERRES's avatar Bruno FERRES
Browse files

Version 1.0.0

parents
### Project Specific stuff
test_run_dir/*
chisel_gen/*
### 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*
lib/*
csv/*
explore_gen
rules = [
RemoveUnused
]
version=2.6.3
align.preset = more
align.stripMargin = true
maxColumn = 120
assumeStandardLibraryStripMargin = true
continuationIndent.callSite = 4
continuationIndent.defnSite = 4
continuationIndent.ctorSite = 4
continuationIndent.extendSite = 4
continuationIndent.withSiteRelativeToExtends = 0
docstrings.wrap = yes
docstrings.oneline = fold
docstrings.style = AsteriskSpace
comments.wrap = standalone
comments.wrapStandaloneSlcAsSlc = true
This diff is collapsed.
# QECE
**QECE** (*Quick Exploration using Chisel Estimators*) is a **chisel based** project to provide circuit estimators and exploration functions for FPGA design processes.
## Structure
Sources can be found under `./src/main/scala/...` and associated unit-tests under `./src/test/scala/...`
Project is divided in different submodules:
* global project configuration file is `./src/main/scala/ProjectConfig.scala`
* resources for integration in other chisel projects are to be found in `./src/main/resources/...`
* estimation transforms can be found in `./src/main/scala/estimation/...`
* exploration relative functions - including exploration strategies - can be found in `./src/main/scala/exploration/...`
* backend bindings are available in `./src/main/scala/backend/...` - only Xilinx Virtex 7 boards are available currently
* characterization functions - *i.e.* functions to generate a characterized library of operators and macros for a given target board - can be found in `./src/main/scala/characterization/...`
## Running
To run the transformations on your own project, you need to take a few steps:
* publish your transformations on your environment, using `sbt quickPublish` (as `sbt publishLocal` generates *scaladoc*, which currently results in a bug)
* in your project, update the `build.sbt` with `libraryDependencies += "fr.tima" %% "chisel-transforms" % "1.0.0"`
* you can access to the different classes with `import qece.<package>.<Class>`
**N.B.:** You may have to reload/update your `sbt` project.
## Estimations
Three kinds of estimators are considered at the moment: **resource estimation**, **frequency estimation** and **quality of result estimation**.
* FIRRTL based **resource estimation** is based on prior **macro replacement** of some patterns in the circuits, and uses a library of characterized operators.</br>
Such library is to be found in `./src/main/resources/lib/<target>.json`, and can be generated using `qece.characterization.LibraryBuilder` class (`./src/main/scala/characterization/Library.scala`).</br>
Another resource estimator is based on **synthesis results** through backend calls.
* **Quality of result estimation** is based on an empirical approach, leveraging simulator bindings to provide insights of circuit behavior.
* FIRRTL based **frequency estimation** is currently deprecated, as chosen approach result in complex and non accurate estimations.</br>
However, frequency estimation through **synthesis results** are available using backend API.
Estimators can be call by using `qece.estimation.WithTransform` trait - and examples are to be found in `./src/test/scala/estimation/...`.
## Exploration
In order to be explorable, a **chisel** `Module` must implement `qece.exploration.utils.WithExplorable` trait - you can directly extend `qece.exploration.utils.Explorable` class to build a `MultiIOModule` implementing this trait.
Strategies can be defined using `qece.exploration.strategies.StrategyBuilder` - and examples are to be found in `./src/test/scala/exploration/strategies/...`.
## Linting
The code base is checked with a linter. We use three different linters:
* scalastyle is used to check the code base for formatting prior to merge.
* scalafmt is configure with the same parameters than scalastyle. It should be run before pushing, in order to limit
scalastyle errors. scalafmt is not able to check everything, especially it does not enforce names
* scalafix is used to check (and fix if run locally) semantic and syntactic rules (for now, only unused imports)
In order to automatically apply formatting rules, run:
```
lint
```
In order to check the rules locally, you can run the following commands in sbt:
```
lintCheck
```
## Contact
Feel free to contact me at [bruno.ferres@univ-grenoble-alpes.fr](mailto:bruno.ferres@univ-grenoble-alpes.fr).
The project was developed in **SLS team** at [TIMA lab](http://tima.univ-grenoble-alpes.fr/tima/fr/index.html), under the supervision of [Frédéric ROUSSEAU](mailto:frederic.rousseau@univ-grenoble-alpes.fr) and [Olivier MULLER](mailto:olivier.muller@univ-grenoble-alpes.fr).
// See README.md for license details.
ThisBuild / scalaVersion := "2.12.12"
ThisBuild / version := "1.0.0"
ThisBuild / organization := "fr.tima"
parallelExecution in Test := true
lazy val root = (project in file("."))
.settings(
name := "qece",
logLevel := Level.Warn,
libraryDependencies ++=
Seq(
"edu.berkeley.cs" %% "chisel3" % "3.4.3",
"edu.berkeley.cs" %% "chisel-iotesters" % "1.5.3",
"edu.berkeley.cs" %% "chiseltest" % "0.3.3" % "test"
) ++ Seq( // used for reflectivity
"org.scala-lang" % "scala-compiler" % scalaVersion.value
) ++ Seq(
"org.apache.commons" % "commons-math3" % "3.3"
) ++ Seq( // used for json ser/des
"io.circe" %% "circe-core",
"io.circe" %% "circe-generic",
"io.circe" %% "circe-parser"
).map(_ % "0.12.3"),
scalacOptions ++= Seq(
"-Xsource:2.11",
"-language:existentials",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-unchecked",
"-Ywarn-unused",
"-Xcheckinit"
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % "3.4.2" cross CrossVersion.full),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)
/* ---------- LINTING ------------- */
// Necessary for scalafix
inThisBuild(
List(
scalaVersion := scalaVersion.value,
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
)
addCommandAlias("lint", "scalafmt; test:scalafmt; scalafix; test:scalafix")
addCommandAlias("lintCheck", "; scalastyle; test:scalastyle" +
"; scalafmtCheck; test:scalafmtCheck" +
"; scalafix --check; test:scalafix --check")
/* ---- Stack overflow exception occurs when doc is generated ---- */
addCommandAlias("disableDocGeneration", "set publishArtifact in(Compile, packageDoc) := false")
addCommandAlias("enableDocGeneration", "set publishArtifact in(Compile, packageDoc) := true")
addCommandAlias("quickPublish", "disableDocGeneration; publishLocal; enableDocGeneration")
addCommandAlias("disableParallel", "set parallelExecution in Test := false;")
addCommandAlias("enableParallel", "set parallelExecution in Test := true;")
/* ------------ TEST --------------- */
// non regression tests,
addCommandAlias("unitTests", "testOnly -- -l Long -l Synthesis -l Deprecated")
// Disabling parallelExecution on heavy tests to avoid crashes
addCommandAlias("longTests", "disableParallel; testOnly -- -l Deprecated; enableParallel")
addCommandAlias("synthesisTests", "disableParallel; testOnly -- -n Synthesis -l Deprecated; enableParallel")
sbt.version = 1.3.4
logLevel := Level.Warn
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0") // "2.4.0" is just sbt plugin version
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")
<scalastyle>
<name>Scalastyle standard configuration</name>
<check level="warning" class="org.scalastyle.file.FileTabChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.file.FileLengthChecker" enabled="false">
</check>
<check level="warning" class="org.scalastyle.file.HeaderMatchesChecker" enabled="false">
<parameters>
<parameter name="header"><![CDATA[// Copyright (C) 2011-2012 the original author or authors.
// See the LICENCE.txt file distributed with this work for additional
// information regarding copyright ownership.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.SpacesAfterPlusChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.file.WhitespaceEndOfLineChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.scalariform.SpacesBeforePlusChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.file.FileLineLengthChecker" enabled="true">
<parameters>
<parameter name="maxLineLength"><![CDATA[120]]></parameter>
<parameter name="tabSize"><![CDATA[2]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.ClassNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[[A-Z][A-Za-z0-9]*]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.ObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[[A-Z][A-Za-z0-9]*]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.PackageObjectNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.EqualsHashCodeChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.scalariform.IllegalImportsChecker" enabled="true">
<parameters>
<parameter name="illegalImports"><![CDATA[sun._,java.awt._]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.ParameterNumberChecker" enabled="false">
<parameters>
<parameter name="maxParameters"><![CDATA[8]]></parameter>
</parameters>
</check>
<check level="info" class="org.scalastyle.scalariform.MagicNumberChecker" enabled="true">
<parameters>
<parameter name="ignore"><![CDATA[-1,0,1,2,3]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker" enabled="true"></check>
<check level="info" class="org.scalastyle.scalariform.ReturnChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.NullChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.NoCloneChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.NoFinalizeChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.CovariantEqualsChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.StructuralTypeChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.file.RegexChecker" enabled="false">
<parameters>
<parameter name="regex"><![CDATA[println]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.NumberOfTypesChecker" enabled="false">
<parameters>
<parameter name="maxTypes"><![CDATA[30]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.CyclomaticComplexityChecker" enabled="true">
<parameters>
<parameter name="maximum"><![CDATA[50]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.UppercaseLChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.scalariform.SimplifyBooleanExpressionChecker" enabled="true"></check>
<check level="error" class="org.scalastyle.scalariform.IfBraceChecker" enabled="true">
<parameters>
<parameter name="singleLineAllowed"><![CDATA[true]]></parameter>
<parameter name="doubleLineAllowed"><![CDATA[false]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.MethodLengthChecker" enabled="true">
<parameters>
<parameter name="maxLength"><![CDATA[30]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.FieldNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[^[a-z_][A-Za-z0-9]*$]]></parameter>
<parameter name="objectFieldRegex"><![CDATA[^[a-z_][A-Za-z0-9]*$]]></parameter>
</parameters>
</check>
<check level="error" class="org.scalastyle.scalariform.MethodNamesChecker" enabled="true">
<parameters>
<parameter name="regex"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>
<parameter name="ignoreRegex"><![CDATA[^[:=<>!?~+-[*]].*$]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.NumberOfMethodsInTypeChecker" enabled="false">
<parameters>
<parameter name="maxMethods"><![CDATA[30]]></parameter>
</parameters>
</check>
<check level="warning" class="org.scalastyle.scalariform.PublicMethodsHaveTypeChecker" enabled="false"></check>
<check level="warning" class="org.scalastyle.file.NewLineAtEofChecker" enabled="true"></check>
<check level="warning" class="org.scalastyle.file.NoNewLineAtEofChecker" enabled="false"></check>
</scalastyle>