CodiodeCodiode
Home
Problem Solving
Skill Tracks
My Assignments
Contests
Leaderboard
Community
Settings
Codiode/Problems/Sequential Logic

DFF with Both PRE and CLR

HardLogic CircuitBuild

Standard discrete logic families like the 74HC74 provide flip-flops with both asynchronous preset and clear inputs. These inputs allow external events to force the state of the flip-flop regardless of the clock signal, serving as critical initialization and reset mechanisms in digital systems.

The circuit must function as a positive-edge triggered D flip-flop when both asynchronous controls are inactive. An active-low PRE_bar immediately forces Q to 1. An active-low CLR_bar immediately forces Q to 0. If both are asserted simultaneously, both Q and Q_bar are driven to 1. This is a forbidden state in normal operation but must be explicitly handled by the internal gate structure to match standard hardware behavior.

| PRE_bar | CLR_bar | CLK | D | Q | Q_bar | |-----------|-----------|-------|-----|-----|---------| | 0 | 0 | X | X | 1 | 1 | | 0 | 1 | X | X | 1 | 0 | | 1 | 0 | X | X | 0 | 1 | | 1 | 1 | ↑ | 0 | 0 | 1 | | 1 | 1 | ↑ | 1 | 1 | 0 |

Constraints

  • Construct the flip-flop using only basic logic gates.
  • Do not use pre-built flip-flop or latch macros.
  • Ensure the simultaneous active state drives both outputs high without oscillation.

Topics

AsynchronousClearLatches and Flip-FlopsPreset

Solve this problem

Place the gates, wire them up and watch the signals settle. Every submission runs on the same simulation engine that grades it.

This problem is part of Codiode Pro. The statement above is free to read.

Sign in to solveSee what Pro unlocks

The circuit builder and code editor need a desktop screen. On a phone, read the problem here and open it on a laptop to solve.

Related problems

  • 3-bit Ripple Counter from Toggle Flip-FlopsEasy
  • D Latch from a 2:1 MUXEasy
  • 2-bit Ring CounterEasy
  • T Flip-Flop from a D Flip-FlopEasy
  • Handshake Deadlock Due to Early ResetHard
  • Reconvergence of Individually Synchronized BitsHard
  • Debug: Asynchronous Clear GlitchHard
  • Clock Gate Enable Crossing DomainsHard

Browse all problems · Learning tracks