Program in Quartus The WHEN/ELSE statement checks the conditions in the order li
ID: 2079163 • Letter: P
Question
Program in Quartus
The WHEN/ELSE statement checks the conditions in the order listed. So, the easiest way to handle the truth table may be to: first check if D7 is high (i.e., make that the first condition checked in the statement), then check if D6 is high (i.e., make that the second condition checked in the statement), then check if D5 is high, and so forth. For instance, the first condition checked would be y "111" when d(7) = '1'. Note that this line assumes the input d and the output d are both of type std_logic_vector. Write the program in Quartus, executing only the "Analysis and Synthesis" step. Obtain a synthesis. To view the synthesis result: Tools > Netlist Viewer > RTL Viewer. Copy and paste your resulting VHDL program and the resulting hardware (the synthesis result) into an MS Word or comparable word-processing file.Explanation / Answer
LIBRARY ieee;
USE ieee.std_logic_1164.all;
ENTITY check IS
PORT (d: IN STD_LOGIC_VECTOR(7 DOWNTO 0);
y: OUT STD_LOGIC_VECTOR(2 DOWNTO 0));
end check;
ARCHITECTURE prog OF check IS
BEGIN
y <= '111' WHEN d(7)='1' ELSE
y <= '110' WHEN d(6)='1' ELSE
y <= '101' WHEN d(5)='1' ELSE
y <= '100' WHEN d(4)='1' ELSE
y <= '011' WHEN d(3)='1' ELSE
y <= '010' WHEN d(2)='1' ELSE
y <= '001' WHEN d(1)='1' ELSE
y <= '000' WHEN d(0)='1';
end prog;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.