From 9e544aa95cf8e124f8eb5feb67f9dc7680a4a7c5 Mon Sep 17 00:00:00 2001 From: AdvaySingh1 Date: Wed, 11 Feb 2026 11:01:49 -0800 Subject: [PATCH] Added pseudocode for create_ce_logic --- notes.txt | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/notes.txt b/notes.txt index 64a59ef57..135924ad6 100644 --- a/notes.txt +++ b/notes.txt @@ -78,7 +78,21 @@ determine_en_rec (input_set&, D, Q): // create the CE based on the input set // adds the CE into the clock create_ce_logic(input_set, D, Q, ffData): - // TODO: fill in this pseudocode please + // CE = OR(all signals in input_set) + // When any input is 1 → CE=1 (update register) + // When all inputs are 0 → CE=0 (hold, since SAT proved D==Q) + + if input_set.size() == 1: + ce_signal = input_set[0] + else: + ce_wire = module.addWire(NEW_ID) + module.addReduceOr(NEW_ID, input_set, ce_wire) + ce_signal = ce_wire + + ffData.has_ce = true + ffData.sig_ce = ce_signal + ffData.pol_ce = true // active high + ffData.emit() // rebuild the FF with CE set_ff_ces(design): for module in design: