From: Luke Kenneth Casson Leighton Date: Sat, 9 May 2020 17:33:20 +0000 (+0100) Subject: comment maskgen X-Git-Tag: div_pipeline~1304 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8c839e59991a8b0d56fa6a7c6b9fff6ba773d8f2;p=soc.git comment maskgen --- diff --git a/src/soc/alu/maskgen.py b/src/soc/alu/maskgen.py index dd6b9573..89246e0b 100644 --- a/src/soc/alu/maskgen.py +++ b/src/soc/alu/maskgen.py @@ -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))