Incorrect jim duckworth wpi 26 the process statement

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: TECTURE incorrect OF comparator IS BEGIN PROCESS(a, b) BEGIN IF a = b THEN equal <= '1'; ELSIF a <= b THEN less <= '1'; ELSIF a >= b THEN great <= '1'; END IF; END PROCESS; END incorrect; Jim Duckworth, WPI 26 The Process Statement - Module 4 Correct Process for Combinational Logic ENTITY comparator IS -- 4-bit magnitude comparator PORT(a,b : IN std_logic_vector(3 DOWNTO 0); equal, less, great : OUT std_logic); END comparator; ARCHITECTURE correct OF comparator IS BEGIN PROCESS(a, b) BEGIN equal <= '0'; less <= '0'; great <= '0'; IF a = b THEN equal <= '1'; ELSIF a <= b THEN less <= '1'; ELSIF a >= b THEN great <= '1'; END IF; END PROCESS; END correct; Jim Duckworth, WPI 27 The Process Statement - Module 4 Alternative Combinational Process ARCHITECTURE correct2 OF comparator IS -- same as previous ? BEGIN PROCESS(a, b) BEGIN IF a = b THEN equal <= '1'; ELSE equal <= '0'; END IF; IF a <= b THEN less <= '1'; ELSE less <= '0'; END IF; IF a >= b THEN great <= '1'; ELSE great <= '0'; END IF; END PROCESS; END correct2; Jim Duckworth, WPI 28 The Process Statement - Module 4 Concurrent Statements (preferred) ARCHITECTURE preferred OF comparator IS BEGIN equal <= ‘1’ WHEN a = b ELSE ‘0’; less <= ‘1’ WHEN a <= b ELSE ‘0’; great <= ‘1’ WHEN a >= b ELSE ‘0’; END preferred; Jim Duckworth, WPI 29 The Process Statement - Module 4...
View Full Document

This document was uploaded on 03/06/2014.

Ask a homework question - tutors are online