Docsity

VHDL Exam 2 - Sequential Logic Design for ECE 4110, Exams of Electrical and Electronics Engineering

Toggle sidebar
bg1
ECE 4110 - Sequential Logic Design
Exam 2 - Fall 2004
NOTE: Closed book, except a calculator and one sheet of handwritten notes are allowed.
Show ALL your work for full credit. Please draw and write NEATLY (If I cannot read it,
I must mark it WRONG). Do all work in pencil and put all answers on YOUR paper, not
these sheets (except problem 1), following the specified class format. Clearly label all
answers with the problem number. Use only one side of your paper.
1. [20 pts] When do you need to include the line "USE ieee.std_logic_arith.ALL;" in a
VHDL file? What new features and abilities then become available? Be very precise and
complete.
2. [40 pts] Analyze the following VHDL code and derive the corresponding truth table.
Label the columns as: w3 w2 w1 w0 y1 y0 z. It is ok to use don't cares (x) in the table
if it simplifies understanding. ALSO, write a Boolean equation for output z.
LIBRARY ieee ;
USE ieee.std_logic_1164.all ;
ENTITY problem IS
PORT ( w : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ;
y : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) ;
z : OUT STD_LOGIC ) ;
END problem ;
ARCHITECTURE dataflow OF problem IS
BEGIN
y <= "11" WHEN w(3) /= '0' ELSE
"10" WHEN w(3 DOWNTO 2) = "01" ELSE
"01" WHEN w = "0001" ELSE
"00" ;
z <= '1' WHEN w(2) = '0' ELSE w(0) AND W(1) ;
END dataflow ;
pf2

Partial preview of the text

Download VHDL Exam 2 - Sequential Logic Design for ECE 4110 and more Exams Electrical and Electronics Engineering in PDF only on Docsity!

ECE 4110 - Sequential Logic Design

Exam 2 - Fall 2004

NOTE: Closed book, except a calculator and one sheet of handwritten notes are allowed.

Show ALL your work for full credit. Please draw and write NEATLY (If I cannot read it,

I must mark it WRONG). Do all work in pencil and put all answers on YOUR paper, not

these sheets (except problem 1), following the specified class format. Clearly label all

answers with the problem number. Use only one side of your paper.

1. [20 pts] When do you need to include the line "USE ieee.std_logic_arith.ALL;" in a

VHDL file? What new features and abilities then become available? Be very precise and

complete.

2. [40 pts] Analyze the following VHDL code and derive the corresponding truth table.

Label the columns as: w3 w2 w1 w0 y1 y0 z. It is ok to use don't cares (x) in the table

if it simplifies understanding. ALSO, write a Boolean equation for output z.

LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY problem IS PORT ( w : IN STD_LOGIC_VECTOR(3 DOWNTO 0) ; y : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) ; z : OUT STD_LOGIC ) ; END problem ; ARCHITECTURE dataflow OF problem IS BEGIN y <= "11" WHEN w(3) /= '0' ELSE "10" WHEN w(3 DOWNTO 2) = "01" ELSE "01" WHEN w = "0001" ELSE "00" ; z <= '1' WHEN w(2) = '0' ELSE w(0) AND W(1) ; END dataflow ;

3. [40 pts] Concisely write the ARCHITECTURE portion of a VHDL file that has the

following ENTITY portion. Use the behavioral CASE style, with NO temporary, internal

signals. Follow the standard VHDL style regarding upper/lower case and indentation. It

must implement the following truth table, where don’t cares are indicated as “x”.

Entity: LIBRARY ieee ; USE ieee.std_logic_1164.all ; ENTITY thang IS PORT ( a,b,c : IN STD_LOGIC; f : OUT STD_LOGIC_VECTOR(1 DOWNTO 0) ; g : OUT STD_LOGIC ) ; END thang ; Truth Table:

a b cf1 f0 g
0 0 x1 1 0
0 1 01 0 0
0 1 10 1 x
1 0 00 1 1
1 0 11 1 1
1 1 x0 0 0