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

Duty Cycle Comparator

HardLogic CircuitBuild

Decoding Pulse Width Modulation (PWM) signals requires distinguishing between logical symbols based on their duty cycle. A common technique in infrared and RF receivers compares the duration of the high phase to the low phase over a fixed period.

The circuit evaluates the pwm_in signal over a period marked by the period_end strobe. When period_end is high, the circuit must output high_dominant as 1 if pwm_in was high for a greater or equal number of clock cycles than it was low during the current period, and 0 otherwise. The high_dominant output must hold its evaluated state until the next period_end strobe. The evaluation period includes the cycle where period_end is high. Upon rst, high_dominant must be 0 and the internal count must reset.

Constraints

  • Use a single up/down counter.
  • Do not instantiate separate counters for high and low durations.
  • Extract the comparison result directly from the counter's sign bit.
  • Reset the counter synchronously when period_end is asserted to start fresh for the next period.

Topics

sequentialcounterlogic-designpwm

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