Created
August 20, 2020 06:59
-
-
Save XMPPwocky/305fc65481f02f6f51c65a0523d5c23a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prev_input = Signal(signed(self.in_width)) | |
m.d.sync += prev_input.eq(self.input) | |
slope = self.input - prev_input | |
with m.If(self.output): | |
with m.If(slope <= -self.threshold): | |
m.d.sync += self.output.eq(False) | |
with m.Else(): | |
with m.If(slope >= self.threshold): | |
m.d.sync += self.output.eq(True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment