comment maskgen
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 9 May 2020 17:33:20 +0000 (18:33 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 9 May 2020 17:33:30 +0000 (18:33 +0100)
src/soc/alu/maskgen.py

index dd6b95732c1c844d41f175816f5238d5cd7b5311..89246e0b17fb3db9fd9c476e3c61af95b8d7b7a5 100644 (file)
@@ -2,6 +2,15 @@ from nmigen import (Elaboratable, Signal, Module)
 import math
 
 class MaskGen(Elaboratable):
+    """MaskGen - create a diff mask
+
+    example: x=5 --> a=0b11111
+             y=3 --> b=0b00111
+             o:        0b11000
+             x=2 --> a=0b00011
+             y=4 --> b=0b01111
+             o:        0b10011
+    """
     def __init__(self, width):
         self.width = width
         self.shiftwidth = math.ceil(math.log2(width))