Codiode

Tapped Delay Line

HardVerilog / SystemVerilogBuild

A tapped delay line exposes the signal at points along the chain, not only at the end. Tapping it also changes what synthesis can build: an untapped chain can map to a compact shift-register primitive, a tapped one has to be real flip-flops.

The solution module maintains a 16-stage, 8-bit wide delay line. Every clock cycle, a new 8-bit value enters the delay line. The module provides two continuous outputs: the value delayed by exactly 8 clock cycles, and the value delayed by exactly 16 clock cycles.

The circuit operates on the positive edge of clk. An asynchronous, active-low reset rst_n clears all 16 stages of the delay line to 0 when asserted.

Cycle 1: rst_n=0 → tap_mid=0, tap_out=0
Cycle 2: rst_n=1, d_in=8'hAA → tap_mid=0, tap_out=0
Cycle 9: rst_n=1, d_in=8'h07 → tap_mid=8'hAA, tap_out=0
Cycle 17: rst_n=1, d_in=8'h0F → tap_mid=8'h07, tap_out=8'hAA

Signal Direction Width Description
clk input 1 Positive-edge triggered clock
rst_n input 1 Asynchronous active-low reset; clears all delay stages to 0
d_in input 8 Data input entering the delay line
tap_mid output 8 Data delayed by exactly 8 clock cycles
tap_out output 8 Data delayed by exactly 16 clock cycles

Constraints

  • Circuit must trigger on the positive edge of clk.
  • Reset must be asynchronous and active-low.
  • On reset, all 16 stages of the delay line must be cleared to 0.
  • tap_mid must output the value of the 8th delay stage.
  • tap_out must output the value of the 16th delay stage.
  • Both outputs must be registered (driven directly by flip-flops).

Topics

Shift RegisterPipeliningDelay Line

Solve this problem

Write the module in Verilog, SystemVerilog or VHDL. Your submission is compiled and simulated against the problem's testbench. You get the waveform back, not a stored answer.

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

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.

Part of Synthesis Intuition

Problem 13 of 25 in the Synthesis Intuition track.

Related problems

Browse all problems · Verilog practice problems · Learning tracks

Solve this on a laptopSend yourself the link and continue there.