Answered step by step
Verified Expert Solution
Question
1 Approved Answer
library IEEE; use ieee.std _ logic _ 1 1 6 4 . all; use IEEE.numeric _ std . all; use work.subccts.all; entity bitbreaker is port
"library IEEE;
use ieee.stdlogicall;
use IEEE.numericstdall;
use work.subccts.all;
entity bitbreaker is
port SW : in stdlogicvector downto ;
KEY : in stdlogicvector to ;
HEX : out stdlogicvector to ;
HEX : out stdlogicvector to ;
HEX : out stdlogicvector to ;
HEX : out stdlogicvector to ;
LED : out stdlogicvector downto ;
end bitbreaker;
architecture mixed of bitbreaker is
signals associated with ports as illustrated in Figure
signal ledCntrl, reset, start, load, clk : stdlogic;
signal guess, guessChk : stdlogicvector downto ;
signal targetLo : stdlogicvector to ;
signal targetHi : stdlogicvector to ;
signal guessLeft : stdlogicvector to ;
signal bitsCorrect : stdlogicvector to ;
ADD YOUR SIGNALS AS NEEDED BELOW THIS LINE
TYPE statet is init display, saved, gameEnd;
signal currs nexts: statet;
begin
associate ports with player signals as illustrated in Figure
start not KEY;
load not KEY;
clk KEY;
guess SW downto ;
reset SW;
ledCntrl SW;
HEX targetLo;
HEX targetHi;
HEX guessLeft;
HEX bitsCorrect;
WITH ledCntrl SELECT
LED DOWNTO & guessChk WHEN
& reset & clk & load & start WHEN OTHERS;
ADD YOUR CONTROL PATH BELOW
targetLo SW downto ;
targetHi SW downto ;
Include your FSM transitions
TYPE statet IS init display, saved, gameEnd;
signal nexts: statet;
Include your FSM output signals
processcurrs nexts reset, start, load
begin
CASE currs IS
when init
if start then
nexts init;
else
guessLeft ;
bitsCorrect others ;
guessChk others ;
targetHi SW downto ;
targetLo SW downto ;
nexts display;
end if;
when display
correct bits
segport: seg PORT MAPbitsCorrect HEX;
guesses left
segport: seg port mapguessLeft HEX;
guess hi
segport: seg port maptargetHi HEX;
guess lo
segport: seg port maptargetLo HEX;
if loaded
if load then
nexts display;
else
nexts saved;
end if;
else stay here
when saved
change guess hi and lo
targetHi SW downto ;
targetLo SW downto ;
find correct bits
bitsCorrect match port mapSW downto guessChk, bitsCorrect;
guesses left ;
if guessLeft then
guessLeft guessLeft ;
else
guessLeft :;
end if;
game end or display
if guessLeft then
nexts gameEnd;
elsif bitsCorrect then
nexts gameEnd;
else
nexts display;
end if;
when gameEnd
correct bits
seg port mapbitsCorrect HEX;
guesses left
seg port mapguessLeft HEX;
guess hi
seg port maptargetHi HEX;
guess lo
seg port maptargetLo HEX;
END CASE;
end process;
processclk reset
begin
if reset then
currs init;
elsifclkevent and clk then
currs nexts;
end if;
end process;
end architecture;"
seg: drives a segment display with a bit binary value
LIBRARY ieee ;
USE ieee.stdlogicall ;
ENTITY seg IS
PORT bin : IN STDLOGICVECTOR DOWNTO ;
segments : OUT STDLOGICVECTOR TO ;
END seg ;
ARCHITECTURE Behavior OF seg IS
BEGIN
PROCESS bin
BEGIN
CASE bin IS
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN segments ;
WHEN OTHERS segments ;
END CASE ;
END PROCESS ;
END Behavior ; "Error : VHDL syntax error at bitbreaker.vhd near text "entity"; expecting or an identifier entity is a reserved keyword or a sequential statement
Error : VHDL syntax error at bitbreaker.vhd near text "PORT"; expecting or or
Error : VHDL syntax error at bitbreaker.vhd near text ;; expecting : or
Error : VHDL syntax error at bitbreaker.vhd near text "port"; expecting or or
Error :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started