HW 3 - begin case CS is when redState => newColor<=...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EEE 333, ASU Spring 2008, Yu (Kevin) Cao Homework #3 Due Tuesday, March 18th, 10am, submitted to me in class. The objective of homework 03 is to practice the VHDL coding of finite state machines. Please review related lectures and book chapters to start. You may use modelsim to check your answers. 1. VHDL Implementation Write the VHDL codes to implement the following Moore type FSM: 2. State Transition Diagram Draw the state diagram of the following VHDL Moore type FSM, explicitly showing all don’t care conditions.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
library IEEE; use IEEE_STD_LOGIC_1164.all; entity FSM is port( clk, reset: in std_logic; red, green, blue: in std_logic; newColor: out std_logic); end entity FSM; architecture RTL of FSM is type Color is (redState, greenState, blueState, whiteState); signal CS, NS: Color; -- CS and NS must be signals to imply flip-flops begin FSM_COMB: process (red, green, blue, CS)
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: begin case CS is when redState => newColor <= ‘1’; if (red = ‘1’) then NS <= redState; else NS <= whiteState; end if ; when greenState => newColor <= ‘1’; if (green = ‘1’) then NS <= greenState; else NS <= whiteState; end if ; when blueState => newColor <= ‘1’; if (blue = ‘1’) then NS <= blueState; else NS <= whiteState; end if ; when whiteState => newColor <= ‘0’; if (red = ‘1’) then NS <= redState; elsif (green = ‘1’) then NS <= greenState; elsif (blue = ‘1’) then NS <= blueState; else NS <= whiteState; end if ; when others => newColor <= ‘0’; NS <= whiteState; end case ; end process FSM_COMB; FSM_SEQ: process (clk, reset) begin if (reset = ‘0’) then CS <= whiteState; elsif (rising_edge(clk)) then CS <= NS; end if ; end process FSM_SEQ; end architecture RTL;...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern