Peter D. Minns

Digital System Design using FSMs


Скачать книгу

will need to click onto either the .circ or .v files located in ‘Logisim Circuits for Web Folder’ or ‘Verilog Listings for Web Folder’ which they wish to access.

      In both folders there is additional material and ideas that do not appear in this book but maybe of interest to the reader.

      This chapter (like all other chapters) is written in the form of a linear frame, programmed learning text. This is to help you learn the basic skills required to design clocked finite state machines (FMSs) so that you can develop your own designs based on traditional T flip‐flops and D flip‐flops. Later, other techniques will be introduced, such as ‘one hot’ and ‘asynchronous finite state machines’, but these will be developed along the same lines as the work covered in this chapter.

      The text is organized into ‘frames’. Each frame follows on consecutively from the previous one, but at times you may be redirected to other frames, depending upon your response to the questions you are asked. Do not cheat, but follow the frames as indicated.

      Bold denotes questions for you to answer to check your understanding of the material, highlights important points, or indicates an aside when further ideas are presented.

      Please read this chapter first, and attempt all the questions before moving on to the later chapters. Note that the book can be read as a textbook. The programmed aspect of the book makes it more suitable for individuals to read and learn in their own time.

       Frame 1.1 What is a Finite State Machine?

      A finite state machine (FSM) is a digital sequential circuit that can follow a number of predefined states under the control of one or more inputs. Each state is a stable entity that the machine can occupy. It can move from this state to another state under the control of an outside world input.

      Synchronous FSM can move between states only if a clock pulse occurs.

       Task: Draw a block diagram for an FSM with five inputs (x, y, z, t, and a clock) and with two outputs (P and Q).

      If you did not get this answer, go back and re‐read Frame 1.1. Don’t worry about using a mixture of both upper‐ and lower‐case letters here; the only thing that matters is that the same letters are used.

      Each state of the FSM needs to be identifiable. This is achieved by using a number of internal flip‐flops within the FSM block. An FSM with four states would require two flip‐flops since two flip‐flops can store 22 = 4 state numbers.

      Each state has a unique state number, and states are usually assigned numbers, such as s0 (state 0), s1, s2, and s3 (for a four‐state example).

      As you can see, the rule here is 2number of flip‐flops.

      So an FSM with 13 states would require 24 flip‐flops (i.e. 15 states of which 13 are used in the FSM and states 14 and 15 remain unused.

       How many flip‐flops would be required for an FSM using 34 states?

       What would the state numbers be for this FSM?

      The answer to the previous question is:

      In general: 24 = 16 states, 25 = 32 states, 26 = 64 states, 27 = 128 states, and so on.

       What would the state number be for this FSM?

      Answer:

      The unused states would be s34 through to s63.

       Note that the states run through from s0 to sn−1, for n states.

      As well as containing flip‐flops to uniquely define the individual states of the FSM, there is also combinational logic, which defines the outside world outputs. In addition, the outside world inputs connect to combinational logic, which supplies the flip‐flops’ inputs.