Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sequential Statements Module F3.2. Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements.

Similar presentations


Presentation on theme: "Sequential Statements Module F3.2. Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements."— Presentation transcript:

1 Sequential Statements Module F3.2

2 Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements While Loops For Loops

3 Sequential Statements (cont.) Exit Statement Next Statement Null Statement Variable Assignment Statement Signal Assignment Statement Procedure Call Statement Return Statement

4 Sequential Statements (cont.) Wait Statement Assertion Statement Report Statement

5 If Statement [[ if_label:]] if boolean_expression then {{ sequential_statement }} {{ elsif boolean_expression then {{ sequential_statement }} }} [[ else {{ sequential_statement }} ]] end if [[ if_label ]] ;

6 Synthesis of 2-to-1 Mux using IF-ELSE Statement

7 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 }}

8 Synthesis of 4-to-1 Mux using CASE Statement

9 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.

10 Loop Statement [[loop_label:]] loop {{ sequential_statement }} end loop [[loop_label:]] ; An infinite loop

11 Exit Statement [[label:]] exit [[loop_label]] [[when boolean_expression]] ; loop … exit when condition;... end loop; … -- jump here when condition is true ;

12 Next Statement [[label:]] next [[loop_label]] [[when boolean_expression]] ; loop … next when condition;... end loop; Starts a new iteration of a loop.

13 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;

14 While Loop [[loop_label:]] while condition loop {{ sequential_statement }} end loop [[loop_label:]] ;

15 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

16 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;

17 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

18 Example of FOR loop


Download ppt "Sequential Statements Module F3.2. Sequential Statements Statements executed sequentially within a process If Statements Case Statements Loop Statements."

Similar presentations


Ads by Google