Sequential Statements Module F3.2
Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements While Loops For Loops
Sequential Statements (cont.) Exit Statement Next Statement Null Statement Variable Assignment Statement Signal Assignment Statement Procedure Call Statement Return Statement
Sequential Statements (cont.) Wait Statement Assertion Statement Report Statement
If Statement [[ if_label:]] if boolean_expression then {{ sequential_statement }} {{ elsif boolean_expression then {{ sequential_statement }} }} [[ else {{ sequential_statement }} ]] end if [[ if_label ]] ;
Synthesis of 2-to-1 Mux using IF-ELSE Statement
Case Statement [[ case_label:]] case expression is (( when choices => {{ sequential_statement }})) {{ o o o }} end case [[case_label]] ; choices <= (( simple_expression || discrete_range || others )) {{ | o o o }}
Synthesis of 4-to-1 Mux using CASE Statement
Null Statement [[label:]] null; No action is taken. Can be used when a sequential statement is required. For example, in a case statement. as a stub before we write the code for a process.
Loop Statement [[loop_label:]] loop {{ sequential_statement }} end loop [[loop_label:]] ; An infinite loop
Exit Statement [[label:]] exit [[loop_label]] [[when boolean_expression]] ; loop … exit when condition; ... end loop; … -- jump here when condition is true ;
Next Statement [[label:]] next [[loop_label]] Starts a new iteration of a loop. [[label:]] next [[loop_label]] [[when boolean_expression]] ; loop … next when condition; ... end loop;
Next Statement loop statement-1; next when condition; statement-2; end loop; loop statement-1; if not condition then statement-2; end if; end loop;
While Loop [[loop_label:]] while condition loop {{ sequential_statement }} end loop [[loop_label:]] ;
For Loop [[loop_label:]] for identifier in discrete_range loop {{ sequential_statement }} end loop [[loop_label:]] ; discrete_range <= type_mark [[ range simple_expression (( to || downto )) simple_expression ]] || simple_expression (( to || downto )) simple_expression
For Loop The identifier is a loop parameter that is implicitly declared. process is variable a,b: integer; begin a := 10; for a in 0 to 7 loop b := a; end loop; -- a = 10 and b = 7 ... end process;
For Loop A for loop body will not execute for a null range for i in 10 to 1 loop ... end loop; Loop will exit immediately for i in 10 downto 1 loop ... end loop; i takes on values 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
Example of FOR loop