# Problems deriving state diagrams

If I understand correctly, the state diagram of a sequential circuit simply shows the different states the circuit goes through. However, if I'm trying to build a 2's complementer using a shift register and a flip-flop, how does the state diagram look? Seeing as what goes through the flip-flop depends on the digit put in the register, I'm not sure how to draw it.

Thanks

## 1 Answer

You should only consider drawing the state machine for the actual 2-complementer with serial input, and forget about the shift register (drawing a state diagram for a shift register of a given length is perfectly possible, but makes hardly any sense).

Said that, the task boils down to a single-input/single-output state machine with 2 states. Look here: http://k5rec.blogspot.com/2006/12/digital-electronics-serial-twos.html

• thanks that's a really helpful link. however, what are the bits displayed on the state paths? (ie. 1/0, 0/0). What do they represent? Thanks! – n0pe Mar 27 '11 at 18:10
• The notation is <input value>/<output value>. Note, that this is a Mealy state machine formally - that is, the output value depends on both current state and input, hence the notation. – Code Painters Mar 27 '11 at 18:16
• You may find this link useful as well: en.wikipedia.org/wiki/Mealy_machine – Code Painters Mar 27 '11 at 18:17