From 5e2b46f7279f5e0564f6f6b75c71c2de34291269 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 19 Jan 2019 08:56:44 +0000 Subject: [PATCH] hdl.ast: add Value.implies. --- nmigen/hdl/ast.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nmigen/hdl/ast.py b/nmigen/hdl/ast.py index bd66d45..b330cb3 100644 --- a/nmigen/hdl/ast.py +++ b/nmigen/hdl/ast.py @@ -134,6 +134,16 @@ class Value(metaclass=ABCMeta): """ return Operator("b", [self]) + def implies(premise, conclusion): + """Implication. + + Returns + ------- + Value, out + ``0`` if ``premise`` is true and ``conclusion`` is not, ``1`` otherwise. + """ + return ~premise | conclusion + def part(self, offset, width): """Indexed part-select. -- 2.30.2