From 171a9d286a1b4d5df44af79d67b6785620d41d5e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Mon, 2 Feb 2009 17:21:31 +0100 Subject: [PATCH] Add a D-Flip flop hardware model. --- Adders.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Adders.hs b/Adders.hs index b09b98f..10590fa 100644 --- a/Adders.hs +++ b/Adders.hs @@ -31,6 +31,13 @@ invinv a = hwnot (hwnot a) dup :: Bit -> (Bit, Bit) dup a = (a, a) +-- Not really an adder either, but a simple stateful example (D-flipflop) +dff :: Bit -> Bit -> (Bit, Bit) +dff d s = (s', q) + where + q = s + s' = d + -- Combinatoric stateless no-carry adder -- A -> B -> S no_carry_adder :: (Bit, Bit) -> Bit -- 2.30.2