0
\$\begingroup\$

I am trying to create a Finite State Machine that is able to check if a number string is valid. For example, it would accept 3, 4.65 or 8.93e-10. So far I have created a transition table for the machine as follows: TT

This is the state diagram of the machine: FSM

I am having trouble understanding on how to create the state table that I can then use to create the Karnaugh-map for this machine. I understand that I would have to convert the state and transition values into their binary equivalent and then list the inputs and outputs for each state.

I would appreciate if someone could guide me in the process of creating a state table that can then be used to create a Karnaugh-map.

\$\endgroup\$
  • \$\begingroup\$ your state diagram does not show what happens, in any of the states, if a non-digit is encountered \$\endgroup\$ – jsotola Feb 26 at 22:12
  • \$\begingroup\$ @jsotola Yes, I haven't considered what would occur if a non-digit is encountered yet. Although it kind of negates the point of the FSM, I am just trying to figure out how to create a state table assuming the number is always valid. I can then go from there! \$\endgroup\$ – D. 777KLM Feb 26 at 22:28
  • \$\begingroup\$ @D.777KLM Do you know the difference between a left-recursive production and a right-recursive production? (If you know any parsing theory, you should have been exposed to the ideas.) \$\endgroup\$ – jonk Feb 27 at 2:58
1
\$\begingroup\$

A state-transition table is very similar to a truth table for combinational logic. On the input side you have a column for each bit in the state encoding and for all of the inputs. So you need to pick a state encoding and understand what the other inputs will be. Your table must then have a row for every possible combination of the current state value and the input signals, although you can use "don't care" entries for the inputs in some cases.

On the output side of the state-transition table you show the required value of the state bits for the desired next state. At that point you can use the usual techniques for optimizing the logic implementation.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ That's a general description. Unfortunately, parsing floating point notation numbers is a little more nuanced. The states should follow what are called productions in parsing theory and, in this case, it matters a great deal how these productions are structured. The guidance that the OP will need is probably less about what a state table is and does, than it will be about how to structure the productions. At least, that's what I suspect in this case without having tried to provide an answer. (This is coming out of my earlier days writing compilers and my long experience with state tables.) \$\endgroup\$ – jonk Feb 27 at 3:04
  • \$\begingroup\$ @jonk I think you are giving the OP more credit than I did. My assumption is that this is a problem handed out in a lower-level digital design class, and that the OP doesn't really know or care about actually parsing floating-point notation. I intended to give a general description since the OP's question was very close to "please give me the solution". \$\endgroup\$ – Elliot Alderson Feb 27 at 3:11
  • \$\begingroup\$ Okay. Maybe I am. \$\endgroup\$ – jonk Feb 27 at 3:44

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.