5
\$\begingroup\$

Consider a state machine whose entire state is kept in a collection of edge-triggered D flip-flops. The outputs of these are fed into a combinatorial network which fully determines the next state, and is fed back into the flip-flops' inputs. On every pulse of the clock, the FSM transition states.

However, I am unsure about how to deal with races: on the positive edge of the clock, the flip-flops will propagate their inputs to their internal states (and outputs). Immediately, the outputs (through the combinatorial network) will change the flip-flops' inputs again. How is it guaranteed that the inputs are stable for long enough after the clock edge for the flip-flops to switch effectively?

I can think of two possible workarounds:

  • Cascade two sets of flip-flops; this keeps the inputs stable, but would take two clock cycles to transition states.

  • Use master-slave flip-flops. I am not sure whether this completely fixes the race, though: if the clock inverter (gating the "slave" flip flop) switches quickly (before the "master" flip flop" turns off), it could still result in unstable inputs.

How is this usually solved?

\$\endgroup\$
  • \$\begingroup\$ Welcome to EE.SE. \$\endgroup\$ – Sparky256 Nov 25 '19 at 0:45
  • \$\begingroup\$ "By design". Look at the data sheets. Decide if there is a potential issue. There usually isn't. If there is, design it out. \$\endgroup\$ – Russell McMahon Nov 25 '19 at 3:10
  • \$\begingroup\$ I have gone through some data sheets, but I am still a bit confused; e.g, SN74HCS72. To determine how long the inputs remain valid (assuming instantaneous combinatorial logic), I think I should be looking at propagation & transition delays. Both of these don’t have minimums; only typical and maximum delays. Follow-up question: if I build a master-slave FF out of discrete gates, how can I ensure that the “master” will turn off before the “slave” turns on, if there is no lower bound on the propagation delay for the clock inverter? \$\endgroup\$ – Manuel Menzella Nov 25 '19 at 3:35
6
\$\begingroup\$

Edge-triggered FFs generally will not "beat" their own input setup and hold time requirements. You can usually string them directly together to form shift registers of arbitrary lengths.

Therefore, your concern is nothing to worry about. The only real issue in this setup is the maximum clock frequency, which is mostly determined by the longest path through the combinatorial logic.

\$\endgroup\$
  • \$\begingroup\$ Yes. When all circuits are the same technology, I have never seen this be an issue. If you mixing old (slow) and new (fast) technologies, it can be an issue. \$\endgroup\$ – Mattman944 Nov 24 '19 at 23:30
  • \$\begingroup\$ Correct. Even if you have feedback there is a rigid order of progress. \$\endgroup\$ – Sparky256 Nov 25 '19 at 0:43
  • \$\begingroup\$ Thanks! Makes sense, I've seen plenty of designs that assume this, but I was wondering if there was something in the data-sheet I should be looking for to prove this. I come from the software world and analog matters scare me :) -- follow up question: if I build a master-slave FF out of discrete gates, how can I prove that the "master" will turn off before the "slave" turns on? What I'd want is a lower bound on the transition delay for the clock inverter, but that seems to be missing from all inverter data-sheets I've seen. \$\endgroup\$ – Manuel Menzella Nov 25 '19 at 3:41
2
\$\begingroup\$

What you're describing is called a hold violation (zero-cycle hold violation, to be precise). Static Timing Analysis (STA) tools are designed to both detect and often automatically fix these violations. Techniques for fixing are numerous, some of the commonly used ones are

  1. Resizing cells on the data path (see cell sizing)
  2. Inserting an additional buffer cells on the data path
  3. Adding dummy loads
  4. Tweaking clock skew (see useful skew)

Note that whenever you slow down data paths to fix hold violations you are in danger of creating setup violations, so it is not an easy problem. But EDA tools do it well most of the time.

\$\endgroup\$
0
\$\begingroup\$

I recall some interesting use of single-transistor behavior inside such as SN74S112, shown in the 1970 edition of TTL databook.

I think these behaviors depend on the sizes (and thus the parasitics) of certain transistors.

This lets the rate-of-change of charges be well controlled, ensuring valid setup and hold times. These are not "logic gates".

For these FFs to act dependably, the input edges MUST BE CLEANLY swinging, and fast.

Yes----------this is very much an "analog" issue, as Manuel Menzella suggests.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.