Commit f3fbd2d9 authored by Mathieu Escouteloup's avatar Mathieu Escouteloup
Browse files

Project initiation

parent 5fc249aa
### 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*
# Generated files
output
vunit_out
.bsp
sim/
draft/
# Conseils pour le développement du projet
## Style de codage
1. Tous les noms de classes ne doivent être composés que de caractères alphanumériques explicites.
**Exemple**: Adder, ShiftRegister, Alu8Bit ...
2. Les noms des classes représentant des entrées/ sorties (I/Os) doivent avoir le suffixe *IO.
**Exemple**: PortIO, FpuIO ...
3. Les noms des classes représentant des bus doivent avoir le suffixe *Bus.
**Exemple**: ControlBus, StageBus ...
4. Les noms de registres doivent avoir le préfixe *reg_\**.
**Exemple**: reg_rs1, reg_source ...
5. Les noms des entrées doivent avoir le préfixe *i_\**.
**Exemple**: i_bus, i_value ...
6. Les noms des sorties doivent avoir le préfixe *o_\**.
**Exemple**: o_bus, o_value ...
7. Les noms des bus d'I/Os doivent avoir le préfixe *b_\**.
**Exemple**: b_cpu, b_mem ...
8. Les noms des instances de modules doivent avoir le préfixe *m_\**.
**Exemple**: m_alu, m_cpu ...
9. Séparer les fonctionnalités principales d'un module par des commentaires.
## Utilisation des branches
Afin de pouvoir travailler à plusieurs sur des versions différentes du projet, il peut être utile d'utiliser des branches.
Cette fonctionnalité de git permet de développer en parallèle des fonctionnalités et/ou blocs différents dans un même projet mais sans entrer en conflit.
Voici ci-dessous une liste des différentes commandes pour travailler simplement avec les branches.
Premièrement, il est nécessaire de créer une branche pour chaque version du projet.
Ceci ne doit être effectué qu'une seule fois au début:
```
git checkout -b <nom-de-la-branche>
```
La commande suivante est utile pour savoir à tout moment dans quelle branche on se trouve:
```
git branch -a
```
Ensuite le fonctionnement est similaire au fonctionnement basique avec la branche **master** par défaut:
```
git add * # Pour ajouter les nouveaux fichiers
git commit -m "Nouvelle version" # Pour effectuer le commit
```
En revanche, pour intéragir avec le serveur git (ici GitHub), il est nécessaire d'indiquer la branche à chaque fois:
```
git pull origin <nom-de-la-branche> # Permet de mettre à jour localement depuis la branche <nom-de-la-branche> du serveur
git push origin <nom-de-la-branche> # Permet de mettre à jour la version de la branche <nom-de-la-branche> sur le serveur
```
# vpu
# Conception et évaluation d'une unité de calcul de vecteurs
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
### Dépendances
Certains outils sont nécessaires afin de pouvoir réaliser et tester des designs en Chisel.
Les commandes ci-dessous sont valables pour Ubuntu, pour plus d'informations voir la [page d'installation de Chisel](https://github.com/freechipsproject/chisel3/blob/master/SETUP.md).
Tout d'abord **Java**:
```
cd existing_repo
git remote add origin https://gitlab.laas.fr/mescoutelo/vpu.git
git branch -M main
git push -uf origin main
sudo apt-get install default-jdk
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.laas.fr/mescoutelo/vpu/-/settings/integrations)
Ensuite l'outil **sbt**:
## Collaborate with your team
```
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 642AC823
sudo apt-get update
sudo apt-get install sbt
```
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
Enfin, GtkWave pour visualiser les chronogrammes:
## Test and Deploy
```
sudo apt-get install gtkwave
```
Use the built-in continuous integration in GitLab.
### Organisation d'un projet
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
- **src/main/scala**: contient les fichiers source Chisel des designs.
- **src/test/scala**: contient les fichiers source Chisel des tests.
- build.sbt: fichier de configuration de l'outil sbt.
***
### Conception
Un exemple de module nommé Adder est présent dans le fichier *src/main/scala/adder/adder.scala*.
Pour générer le Verilog correspondant, le format de la commande du terminal est le suivant:
# Editing this README
```
sbt "runMain <nom-librairie>.<nom-design> --target-dir <destination>"
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
*--target-dir* esy une option permettant de choisir le répertoire où sera généré le module Verilog correspondant.
Dans l'exemple Adder, il est possible de générer le module Verilog avec la commande suivante:
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
```
sbt "runMain vpu.example.Adder --target-dir output"
```
## Name
Choose a self-explaining name for your project.
Dans le répertoire *output/*, on trouve alors un fichier *Adder.v* correspondant au module décrit dans le fichier Chisel.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
### Simulation
De la même manière qu'en Verilog ou VHDL, le langage contient des commandes dédiées pour réaliser des testbenchs.
Deux exemples existent ici pour le module Adder dans *src/test/scala/adder/test0.scala* et *src/test/scala/adder/test1.scala*.
Il est possible d'exécuter individuellement un test avec la commande suivante:
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
```
sbt "test:runMain <nom-librairie>.<nom-test> --target-dir <destination>"
```
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
Dans l'exemple Adder, on a donc le choix entre deux tests différents:
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
```
sbt "test:runMain vpu.example.AdderTest0 --target-dir output"
sbt "test:runMain vpu.example.AdderTest1 --target-dir output"
```
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
On retrouve alors les résultats dans le répertoire *output/*.
Les chronogrammes correspondants à chaque test se trouvent dans des fichiers *.vcd*.
Pour les visualiser, il est alors nécessaire d'utiliser l'outil **GtkWave**:
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
```
gtkwave <chemin-vcd>/<fichier>.vcd
```
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
Le Chisel fournit également une infrastructure pour effectuer des tests unitaires.
Cela permet donc de lancer rapidement l'ensemble des tests et de s'assurer que tout fonctionne correctement après une modification.
Le format de la commande est le suivant:
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
```
testOnly <nom-librairie>.<nom-test-unitaire>"
```
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
Dans le cas de l'exemple Adder, la structure est décrite dans *src/test/scala/adder/unit.scala*.
Pour lancer l'exécution des tests, il faut alors utiliser la commande suivante:
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
```
testOnly vpu.example.UnitTester"
```
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
Ici, le répertoire de destination *output* est spécifié directement dans le fichier.
On retrouve ensuite dans le terminal le résultat des différents tests.
## License
For open source projects, say how it is licensed.
### Références
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
- Langage Chisel :
- [Informations](https://github.com/freechipsproject/chisel3)
- [Livre tutoriel](https://github.com/schoeberl/chisel-book)
- [Bootcamp](https://mybinder.org/v2/gh/freechipsproject/chisel-bootcamp/master)
- VPU et RISC-V:
- [Spécification RISC-V](docs/riscv-spec.pdf)
- Livre architecture: Computer Organization and Design RISC-V Edition
// See README.md for license details.
ThisBuild / scalaVersion := "2.12.13"
ThisBuild / version := "0.1.0"
ThisBuild / organization := "idromel"
lazy val root = (project in file("."))
.settings(
name := "vpu",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % "3.4.3",
"edu.berkeley.cs" %% "chiseltest" % "0.3.3" % "test",
"edu.berkeley.cs" %% "chisel-iotesters" % "1.5.3"
),
scalacOptions ++= Seq(
"-Xsource:2.11",
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit",
// Enables autoclonetype2 in 3.4.x (on by default in 3.5)
"-P:chiselplugin:useBundlePlugin"
),
addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % "3.4.3" cross CrossVersion.full),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)
File added
sbt.version = 1.5.5
logLevel := Level.Warn
package vpu.example
import chisel3._
import chisel3.util._
// Adder class
class Adder(nBit: Int) extends Module {
val io = IO(new Bundle {
// I/Os listing
val i_src1 = Input(UInt(nBit.W))
val i_src2 = Input(UInt(nBit.W))
val o_res = Output(UInt(nBit.W))
})
// New register
val reg_res = Reg(UInt(nBit.W))
// Register connection
reg_res := io.i_src1 + io.i_src2
// Output connection
io.o_res := reg_res
}
// Adder Verilog generator (object)
object Adder extends App {
(new chisel3.stage.ChiselStage).emitVerilog(new Adder(5), args)
}
object Adder8 extends App {
(new chisel3.stage.ChiselStage).emitVerilog(new Adder(8), args)
}
package vpu.example
import chisel3._
import chisel3.util._
import chisel3.iotesters
import chisel3.iotesters.{ChiselFlatSpec, Driver, PeekPokeTester}
class AdderTest0(dut : Adder) extends PeekPokeTester(dut) {
println("** ****************************************")
println("** BEGINNING TEST0 ADDER ")
println("** ****************************************")