Commit bdecdf2e authored by Jules Gonzalez's avatar Jules Gonzalez
Browse files

Update tuto_nmigen.md

parent 968f07c4
......@@ -6,9 +6,9 @@
**Nmigen :**
Click on [this link][1] to access a Github containing all the information needed to install Nmigen on different operating systems and other tools to interact with the FPGA card.
Click on [this link][1] to access a Github containing all the information needed to install **Nmigen** on different operating systems and other tools to interact with the FPGA card.
[1]: https://github.com/RobertBaruch/nmigen-tutorial
[1]: https://github.com/RobertBaruch/nmigen-tutorial "Nmigen tutorial"
---
......@@ -77,3 +77,58 @@ The sum of 2 numbers left shifted by 16 bits gives us the correct result left sh
The product of 2 numbers left shifted by 16 bits gives us the correct result left shifted by 32 bits.
Since we dicided to store our values left shifted by 16 bits, we will need to right shift the result of our products before storig it.
## Transformation of Python modules to Nmigen modules
### Modules
In Python, a good habit to have is to divide your code into modules.
Those mmodules can by found in **Nmigen** but with a specific syntax.
In **Nmigen**, we need to create a class which implements *Elaboratble* and contains the two following methods :
>\_\_init\_\_() : Allows the initialisation of the attributes of the class (which should be represented by **Constants** and **Signals**)
>
>elaborate() : Method creating and returning the modules
In a module, there are two domains :
* **Combinatorial domain** : For operations between logic elements
* **Synchrone domain** : For operations using the cycles of a clock
*You can find examples on [Nmigen tutorial by Robert Baruch][1] or on [Nmigen][2]*
[1]: https://github.com/RobertBaruch/nmigen-tutorial "Nmigen tutorial"
[2]: https://github.com/m-labs/nmigen "Nmigen github"
### Simulation
**Nmigen** has its own simulation system.
Simulations can be launched using the commande *simulate*.
For more information, type the following command line in the console :
`python blinky.py simulate -h`
You have access to many options such as modifying the number of cycles of the simulation or adding options for **Gtkwave**.
**Gtkwave** allows you to visualize simulations on your computer.
This tool gives access to a graphic display of the simulation generated by **Nmigen**.
You just need to generate a *.vcd* file in your **Nmigen** code, which can then be openned using **Gtkwave**.
### Trasfering data to the FPGA card using Pyserial
The **UART** can be used to send data to the card.
More research needed.
### Using the LEDs of the card
Here is an example of the initialisation of the LEDs' array :
Markdown is supported
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