Before reporting a reading, the collector adds three to its eight-bit input. If the sum is at least hexadecimal 050, it shifts the sum right by the amount supplied with that reading. The F12 testbench can compare the results one by one. There is a second question. Can the result settle at the receiver’s D input early enough to meet setup time before the next rising edge?
Follow the path from one register to the next
The input register saves the reading, shift amount, tag and valid bit. After it captures those fields on a rising edge, the sample enters the adder. The sum takes nine bits because FF + 3 can reach 102. The sum feeds both a comparator and a variable shifter. The comparator controls a mux that chooses the sum or the shifted value. On the next rising edge, the output register saves the result, tag and valid bit.
After launch, the input register takes a clock-to-Q delay before Q settles. The result then takes time to travel through the combinational path to the receiver’s D input. The receiver also needs data to be stable for a minimum time before its edge. That interval is the setup time. Even a correct calculation can leave too little setup time if the result arrives late.
How much time is left before the next edge?
Use a teaching example with zero skew and no clock uncertainty. The period is 5 ns. Assume a maximum clock-to-Q delay of 0.8 ns and a setup time of 0.7 ns. That leaves 5.0 − 0.8 − 0.7 = 3.5 ns for the combinational path.
Assume that addition takes 2.5 ns. The longest path through the remaining compare, shift and mux logic takes 3.0 ns. The path needs 0.8 + 2.5 + 3.0 + 0.7 = 7.0 ns. It exceeds the 5 ns budget by 2 ns. Now put a register after the adder. Each segment has its own launch delay and capture setup time. The first segment needs 4.0 ns and the second 4.5 ns. Both fit the assumed period, with setup slack of 1.0 ns and 0.5 ns.
How long must the old value stay after the same edge?
The setup check follows the slowest new data toward the next edge. The hold check starts with what the receiving register sampled on this edge. The old value must stay at D for a short time after capture. The earliest change matters here, so use minimum clock-to-Q and the shortest data path.
Now let the capture clock arrive 0.15 ns after the launch clock. This is positive capture skew. Use the launch edge as time zero. The receiving register samples at 0.15 ns and has an assumed hold time of 0.25 ns, so the old value must stay through 0.40 ns. A minimum clock-to-Q of 0.20 ns and a minimum logic delay of 0.10 ns let new data reach it at 0.30 ns. Hold slack is 0.30 − 0.40 = −0.10 ns.
In this single-clock, same-edge example, a longer period changes none of the terms above. To address the failure, check the minimum data path and the clock arrival times at both registers. Then recheck setup after any change. Static timing analysis uses the target library, timing constraints, clock and path data, clock uncertainty, and the analysis conditions.
Which valid bit belongs to which result?
Use A=31 and B=52 from F12 and add C=A0. They enter the input register at E1, E2 and E4. Valid is zero at E3. That leaves a bubble, with no new sample to count.
| Sample | Input rising edge | Nine-bit sum | Shift | Result | Baseline output update | Extra-stage output update |
|---|---|---|---|---|---|---|
| A | E1 | 034 | 0 | 034 | E2 | E3 |
| B | E2 | 055 | 1 | 02A | E3 | E4 |
| Bubble | E3 | valid=0 | E4 | E5 | ||
| C | E4 | 0A3 | 2 | 028 | E5 | E6 |
The baseline writes A to the output at E2. With an extra stage, E2 saves A’s sum, shift, tag and valid. E3 writes it to the output. A receiver on the same clock samples the already settled output at the following edge. For A, delivery is at E3 in the baseline and E4 with the extra stage. The table shows the output register’s update times.
The faulty version routes the sum, shift and tag through the added register. Its valid bit still moves directly from input to output. At E2 the output says it has a result even though A has yet to arrive. Check the fields that travel with every sample. A comparison that only checks data can miss a result announced at the wrong time.
When is an extra stage worth adding?
At the same clock period, the baseline takes one cycle from input capture to output availability. The extra stage takes two. That wait is the latency. Both can accept one sample and deliver one result per cycle when filled. A second sample can enter before the first reaches the end. That overlap supports the throughput.
Suppose setup were the only limit in our teaching example. At a 7 ns period the baseline takes about 7 ns to make one result available. With two cycles at 5 ns, the extra-stage design takes 10 ns for that same result. Once filled, it can deliver a result every 5 ns. Compare these tradeoffs using the timing, rate and storage needs of the real design.
This lab keeps the receiver always ready. If it stalls, the final stage must hold the unaccepted result and valid bit. Earlier stages with samples in flight must either hold their entire sample when the next stage has no room or have enough buffering to absorb those samples. Check capacity before accepting more input to preserve the F11 delivery contract.
Replay the data and inspect the structure
Download the lab package, extract it on Linux or WSL and run bash run.sh. Icarus 12.0 checks four deliveries per design, including the nine-bit boundary FF + 3 = 102. The same test catches early valid at E2.
In the Yosys 0.33 generic structure both versions have one adder, comparator, variable shift and mux. Compare counts using the recorded flow and units.
| Tool evidence | Baseline | Extra stage |
|---|---|---|
| Register bits | 25 | 39 |
Generic cells from synth -noabc | 97 | 112 |
| Physical timing or maximum frequency | Not analyzed | Not analyzed |
See the run summary, raw waveform and evidence with hashes.
Transfer question: B is waiting at the output and C is one stage back
Suppose the receiver stalls with valid B in the output stage, valid C in the middle stage, and D already accepted into the input stage. What must stay in the pipeline? If all stages stall together, can the input take another sample?
Answer
B, C and D are already in flight. Preserve their data and valid bits, along with their tags and related fields. A global stall must also stop the input from accepting a new sample. With independent stage control, unused space can still accept a sample if each stage follows a valid and ready contract.
The next lesson delivers the same report to a manager on a different clock. Once the two sides have separate rising edges, whether a short valid pulse is visible depends on when the receiver samples.