CODE DETECTOR
--VHDL CODE
library ieee;
use ieee.std_logic_1164.all;
entity code_detector is
port ( clock : in
std_logic;
reset : in
std_logic;
r : in std_logic;
g : in std_logic;
b : in std_logic;
door_lock : out
std_logic
);
end code_detector;
architecture arch of code_detector is
type state is (S0, S1, S2, S3, S4, S5);
signal current_state, next_state : state;
begin
process (clock)
begin
if rising_edge (clock) then
current_state <= next_state;
end if;
end process;
process (current_state, reset, r, g, b)
begin
case (current_state) is
when S0=> if
(reset = '1') then
next_state <= S1;
elsif (r = '1' or g = '1' or b = '1') then
next_state <= S0;
end if;
door_lock <= '0';
when S1=> if (r
= '1') then
next_state <= S2;
elsif (reset = '1' or g = '1' or b = '1')
then
next_state <= S0;
end if;
door_lock <= '0';
when S2=> if (g
= '1') then
next_state <= S3;
elsif (reset = '1' or r = '1' or b = '1')
then
next_state <= S0;
end if;
door_lock <= '0';
when S3=> if (r
= '1') then
next_state <= S4;
elsif (reset = '1' or g = '1' or b = '1')
then
next_state <= S0;
end if;
door_lock <= '0';
when S4=> if (b
= '1') then
next_state <= S5;
elsif (reset = '1' or r = '1' or g = '1')
then
next_state <= S0;
end if;
door_lock <= '0';
when S5=>
next_state <= S0;
door_lock <= '1';
when others=> next_state <= S0;
end case;
end process;
end arch;
-------------------------------------------------------------------------------------------------------------------------------------------------------------
--Simulation on ModelSim
-------------------------------------------------------------------------------------------------------------------------------------------------------------
BLINKING CONTROLLER
STATE DIAGRAM & STATE TABLE is shown below:
Here LO, L1, L2 and L3
represents four states and S1, S0 are the outputs of the Moore
State Machine
We will implement FSM using D Flip Flop and derive expressions for states and outputs using Karnaugh Maps as shown below
CONTROLLER CIRCUIT

Write the following program to be executed on the FPGA board. 1. Write a VHDL model...
I need the VHDL code for this pls.
Figure 1 Design a soda machine controller that can dispense two kinds of soda. If S1 Sel is selected, soda1 2. is dispensed, if S2Sel is selected then soda2 is dispensed. Each soda costs 75 cents and your machine accepts quarters only. The coin sensor has three outputs to detect first coin, second coin and the third coin. Once the soda is dispensed, the controller must be reset to be able to...
WRITE IN PSEUDOCODE USING THE FOLLOWING GUIDELINES Classes Program 1: WAKA, WAKA. Pac-Man was a big hit back in the 80s. One of the things he could do was “teleport” from one side of the screen to the other, and that’s what we’re going to implement here. For this program, you’re going to write a class (called “PacMan”) that only has two attributes: an X and Y location. Imagine the player is on a 10x10 grid and starts at location...