Skip to content

Commit

Permalink
Add assignDontCare doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Jan 22, 2024
1 parent 997b2ef commit ad30895
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions source/SpinalHDL/Data types/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ In addition to the base types, Spinal has support under development for:
* :ref:`Auto-range Fixed-point <afix>` numbers (add,sub,mul support)
* :ref:`Floating-point <Floating>` numbers (experimental support)


Additionaly, if you want to assign a don't care value to some hardware, for instance, to provide a default value, you can use the assignDontCare API to do so.


.. code-block:: scala
val myBits = Bits(8 bits)
myBits.assignDontCare() // Will assign all the bits to 'x'
Finally, a special type is available for checking equality between a BitVector and a bit constant pattern that contains
holes defined like a bitmask (bit positions not to be compared by the equality expression).

Expand All @@ -26,7 +36,9 @@ Here is an example to show how you can achieve this (note the use of 'M' prefix)
.. code-block:: scala
val myBits = Bits(8 bits)
val itMatch = myBits === M"00--10--" // - don't care value
val itMatch = myBits === M"00--10--" // - for don't care value
.. toctree::
:hidden:
Expand All @@ -39,4 +51,4 @@ Here is an example to show how you can achieve this (note the use of 'M' prefix)
Vec
Fix
Floating
AFix
AFix

0 comments on commit ad30895

Please sign in to comment.