Of a sequential statement only used in process or

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: ss Statement - Module 4 IF statement • Example of a sequential statement - only used in process or subprogram • Selects a sequence of statements for execution based on the value of a condition • Each condition is checked sequentially until the first condition is true - priority is implied IF opcode = add_op THEN result := abus + b_bus; ELSIF opcode = inc_op THEN IF flag = false THEN result := 0; ELSE result := result + 1; END IF; END IF; Jim Duckworth, WPI -- nested IF statement 5 The Process Statement - Module 4 CASE statement • Selects one of a number of branches based on the value of an expression – Expression must be integer, enumerated type or one-dimensional character array (like bit_vector or std_logic_vector) • All possible values must be covered exactly once CASE state IS -- state is an enumerated type in this example WHEN s0 => -- branch 1 counter := 0; state <= s2; WHEN s1 => -- branch 2 state <= s4; WHEN s2 | s3 => -- can use set of choices (not logical OR) counter := counter + 1; state <= s0; WHEN OTHERS => -- can use OTHERS to cover remaining values state <= s3; END CASE; Jim Duckworth, WPI 6 The Process Statement - Module 4 LOOP STATEMENTS • Used to iterate through a set of sequential statements • Three types FOR identifier IN range LOOP END LOOP; WHILE boolean_expression LOOP END LOOP; LOOP EXIT WHEN condition_test...
View Full Document

This document was uploaded on 03/06/2014.

Ask a homework question - tutors are online