Question

Look at the state diagram on the next slide. Note that the outputs are in red while the inputs are in black. There is one new input (goto_third) and two new 3-bit outputs (Out1 and Out2).

Question 2 (30%) 1. Look at the state diagram on the next slide. Note that the outputs are in red while the inputs are in black. There is one new input (goto_third) and two new 3-bit outputs (Out1 and Out2) 2. Write and hand in Verilog/VHDL code to implement the state machine in a way that does not have glitches. 4. Hand in a hand-drawn schematic of the logic that the Verilog/VHDL code is describing

erminal 0 Out1 3d3 Out2 3d2 even 0 odd 1 restart and pause and !goto_third terminal-1 restart or pause Out2 3d2 even 0 odd 1 restart and !goto_third FIRST Fifth restart I-0 restart and !pause restart and !pause restart restart Out2 3d4 even 1 erminal 0 Out1 3d6 Out2 3d3 even 1 goto_ thi SECOND restart and lpauseFourtheven THIRD restart and pause restart and !pause erminal- Out1 3d2 Out2 3d7 even 0 odd 1 restart and pause restart and pause

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
module state_machine(
input clk, restart, pause,
input goto_third,
output reg terminal,
output reg [2:0] out1, out2,
output reg even, odd
);
parameter    FIRST=3'b000,
               SECOND=3'b001,
               THIRD=3'b010,
               FOURTH=3'b011,
               FIFTH=3'b100;
              
reg [2:0] current_state, next_state;

always @(posedge clk)
begin
   if (restart)
       current_state <= FIRST;
   else
       current_state <= next_state;
end

always @(current_state, pause, goto_third)
begin
   case(current_state)
       FIRST       : if (pause) next_state <= FIRST; else next_state <= SECOND;
       SECOND   : if (pause) next_state <= SECOND; else next_state <= THIRD;
       THIRD       : if (pause) next_state <= THIRD; else next_state <= FOURTH;
       FOURTH   : if (pause) next_state <= FOURTH; else next_state <= FIFTH;
       FIFTH       : if (pause && !goto_third) next_state <= FIFTH; else if (goto_third) next_state <= THIRD; else if (!goto_third) next_state <= FIRST;
       default   : next_state <= FIRST;
   endcase
end

always @(current_state)
begin
   case(current_state)
       FIRST       : begin terminal <= 1'b0; out1 <= 3'd3; out2 <= 3'd2; even <= 1'b0; odd <= 1'b1; end
       SECOND   : begin terminal <= 1'b0; out1 <= 3'd5; out2 <= 3'd4; even <= 1'b1; odd <= 1'b0; end
       THIRD       : begin terminal <= 1'b0; out1 <= 3'd2; out2 <= 3'd7; even <= 1'b0; odd <= 1'b1; end
       FOURTH   : begin terminal <= 1'b0; out1 <= 3'd6; out2 <= 3'd3; even <= 1'b1; odd <= 1'b0; end
       FIFTH       : begin terminal <= 1'b1; out1 <= 3'd5; out2 <= 3'd2; even <= 1'b0; odd <= 1'b1; end
       default   : begin terminal <= 1'b0; out1 <= 3'd0; out2 <= 3'd0; even <= 1'b0; odd <= 1'b0; end
   endcase
end
endmodule
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

M ModelSim SE PLUS 6.4 File Edit View Compile Simulate Add Wave Tools Layout Window Help Contains Layout Simulate Workspace :::...-Hd X Objects :whe-H X alue | wave-default ck restert St0 pause St0 goto... Sto terminal 0 out! 101 St1 #vsm capacity state_machinefrest... St0 ◆ state machine/Pause Sto state machine/got...Sto + istate_machinefout1 101 +istate_machine(out2 010 out2 010 101 101 101 even0 odd 1 state machinefeven 0 state_macinefodd1 Now 1600 ps 800 Cursor 1 0 ps Dps sim h] state_machine.v Transcrpt 쐬 VSIM 24 run SIM 25> run SIM 26> run SIM 27> run VSIM 28 run VSIM 29 Transcript Now: 1,600 ps Delta: 2 sim:/state_machine -Limited Visibiity Regon 0 ps to 1680 ps ENG 11:13 PM US 1/28/2019 3 Type here to searchISE Schematic Viewer (P.68d) [state machine (Tech1)] File Edit View Window Layout Help Og 94 state machine (Tech1) View by Category Design Objects of Top Level Block Properties: (No Selection) O Type here to search A u ENG 11:14 PM US 1/28/2019 3

Add a comment
Know the answer?
Add Answer to:
Look at the state diagram on the next slide. Note that the outputs are in red...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can I get a circuit diagram of this and have the questions in it answered/explained? Thank...

    Can I get a circuit diagram of this and have the questions in it answered/explained? Thank you. TR. I. SINT400 quau AUC I. Parity. The parity of a string of bits is the least significant bit of their binary This sum is either 0 or 1, depending on whether the number of 1's is even or odd. This seems stupid, but adding a parity bit that makes the parity of every binary number being transmitted even allows one to determine...

  • The task is to design a two-bit controlled counter which has two counting bits (Q2, Q1), has one control input C1, and a...

    The task is to design a two-bit controlled counter which has two counting bits (Q2, Q1), has one control input C1, and also two extra outputs, one indicating overflow, the other underflow. When C1=0 the counter counts up by 2s; i.e. 0 becomes 2, 1 becomes 3. In this mode the values 2 and 3 go to the overflow state. When the control input C1=1, the counter counts down by 2s, i.e. 3 becomes 1, and 2 becomes 0, and...

  • QUESTION 1 1. Determine the output X, 2-bit register Creg and State at the dotted lines...

    QUESTION 1 1. Determine the output X, 2-bit register Creg and State at the dotted lines of the following HLSM (High Level State Machine). The initial state is Off (When you write the state for answers, write “on” and “off”). (Hint: Be careful as to the value of Creg; see Lecture 26 slide #9 or p. 254 in the textbook) At line 1: Output X = , Creg = (decimal), State = At line 2: Output X = , Creg...

  • (20 points) Using any state encodings you want, generate a state table for the following state diagram. Note that there...

    (20 points) Using any state encodings you want, generate a state table for the following state diagram. Note that there is one input, X, and there are two outputs, Y and Z. You can come up with whatever names you want for your state variables. And then generate the logic equations for the next state signals (assume D flip-flops for maintaining state) and the output signals, Y and Z 7. A0 A/Y 070 x=1 x=1 x =1 x =0 x...

  • Finite state machine (FSM) counter design: Gray codes have a useful property in that consecutive numbers differ in only a single bit position. Table 1 lists a 3-bit modulo 8 Gray code representing the...

    Finite state machine (FSM) counter design: Gray codes have a useful property in that consecutive numbers differ in only a single bit position. Table 1 lists a 3-bit modulo 8 Gray code representing the numbers 0 to 7. Design a 3-bit modulo 8 Gray code counter FSM. a) First design and sketch a 3-bit modulo 8 Gray code counter FSM with no inputs and three outputs, the 3-bit signal Q2:0. (A modulo N counter counts from 0 to N −...

  • Anyone want to be a class hero? Our entire class is stuck and the professor isn't...

    Anyone want to be a class hero? Our entire class is stuck and the professor isn't responsding (and its due soon). We can't figure out how to connect our four outputs of the multiplexers to a single four input decoder in a way that causes the two seven segment displays to alternate (see instructions). I understand the idea is that we set the clock to a very high frequency so it looks like they are both on when they are...

  • (15 points) Your colleague is trying to code a VHDL model for a 7419 register. Review...

    (15 points) Your colleague is trying to code a VHDL model for a 7419 register. Review the code on the next page and make any and all correction correct working model. Note the function model. Note the function table and additional information regarding need to solve this problem. DL model for a 74194 4-bit bidirectional universal shift tions that are necessary to produce a al information regarding the problem that you Control Signals Mode CirN SI SO Outputs 1 1...

  • In this lab, you will design a finite state machine to control the tail lights of...

    In this lab, you will design a finite state machine to control the tail lights of an unsual car. There are three lights on each side that operate in sequence to indicate thedirection of a turn. Figure ! shows the tail lights and Figure 2 shows the flashing sequence for (a) left turns and (b) right rums. ZOTTAS Figure 28:8: BCECECece BCECECECes BCECECECB BCECECBCB 8888 Figure 2 Part 1 - FSM Design Start with designing the state transition diagram for...

  • Design (and then verify your design by simulating it) a two-bit counter that counts up or...

    Design (and then verify your design by simulating it) a two-bit counter that counts up or down. Use an enable input E to determine whether the counter is on or off: if E = 0 the counter is disabled and remains at its present count even if clock pulses are applied. If E = 1, the counter is enabled and a second input, x, determines the direction of the count: if x = 1 the circuit counts upward 00, 01,...

  • please make a pretty JAVA GUI for this code this is RED BLACK TREE and i...

    please make a pretty JAVA GUI for this code this is RED BLACK TREE and i Finished code already jus need a JAVA GUI for this code ... if poosible make it pretty to look thanks and please make own GUI code base on my code thanks ex: (GUI only have to show RBTree) ---------------------------------------- RBTree.java import java.util.Stack; public class RBTree{    private Node current;    private Node parent;    private Node grandparent;    private Node header;    private Node...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT