

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Northwestern University Nov 8, 2011 Electrical Engineering and Computer Science Handout # EECS303: Advanced Digital Design, Fall 11 Due: Nov 15 Prof. Hai Zhou
You may discuss the assignments with your classmates but need to write down your solutions independently. Be careful with your handwriting. Unclear solutions will be assumed wrong.
(a) a specified time has passed (b) a specified condition is met (c) an event occurs which affects one or more signals
-- D IN: in BIT; -- RESET: in BIT; -- CLK: in BIT; -- Q OUT: out BIT;
signal Q1, Q2, Q3 : BIT;
process(CLK, RESET) begin if (RESET = โ1โ) then Q1 <= โ0โ; Q2 <= โ0โ; Q3 <= โ0โ; elsif (CLKโevent and CLK = โ1โ) then Q1 <= D IN; Q2 <= Q1; Q3 <= Q2; end if; end process;
Q OUT <= Q1 and Q2 and (not Q3);
entity unknown is port(D: in bit vector(0 to 9); OUTPUT: out bit); constant WIDTH: integer := 10; end unknown;
architecture behavior of unknown is begin process(D) variable tmp: Boolean; begin tmp := false; for i in 0 to Dโlength - 1 loop if D(i) = โ1โ then tmp := not tmp; end if; end loop; if tmp then OUTPUT <= โ1โ; else OUTPUT <= โ0โ; end if; end process; end behavior;
function val (arg1, arg2: integer) return integer is variable result: integer; begin if arg1 > arg2 then result := arg1; else result := arg2; end if; return result; end val;