@@ -39,3 +39,41 @@ Note that you need to replace these terms :
*- ICEBreakerPlatform -> ICEStickPlatform*
*- led = platform.request("led_r") -> led = platform.request("led")*
## Transition to Nmigen
### From variables to signals
Nmigen uses **Constants** and **Signals**.
**Constants** have a fixed value that cannot change.
Regarding the **Signals**, they can replace Python's **Variables**.
When using **Constants** and **Signals**, the number of bits used can be specified, aswell as whether it is signed or not. By default, it uses the least possible amount of bits to represent the value.
#### Constructors :
`a = Const(10, unsigned(16))`
`b = Signal(signed(4))`
#### Warning :
**Constants** and **Signals** are encoded on a limited number of bits, leading to issues when representing floats.
To face this issues, we chose to left shift all our values by 16 bits, effectively multplying them by 2<sup>16</sup>.
A float *x* is represented by the closest integer to _x*2<sup>16</sup>_, allowing us to keep track of the decimals.