Download presentation
Presentation is loading. Please wait.
1
Sequential Statements (Lecture 2)
Osman Hasan COEN 313
2
Outline If statement Case Statement For loop Statement
3
If Statement Sequential Conditional Statement in VHDL Syntax
if boolean_expr_1 then sequential_statements; elsif boolean_expr_2 then elsif boolean_expr_3 then . . . else end if; Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 3 3
4
If Statement – Conceptual implementation
Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 4 4
5
If Statement – Comparison to conditional signal assignment
If statement is more flexible Multiple Statements may share the same Boolean Condition Nesting Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 5 5
6
If Statement – “sharing” Boolean condition Example
Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 6 6
7
Quiz 1: Maximum of 3 numbers
c VHDL (Using If statemets) max Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 7 7
8
Common Mistakes! Incomplete Branch Equality Checker ‘0’
9
Common Mistakes! Incomplete Signal Assignment
Equality/Inequality Checker
10
Outline If statement Case Statement For loop Statement 10 10
11
Case Statement Sequential Conditional Statement in VHDL Syntax
case case_expression is when choice_1 => sequential statements; when choice_2 => . . . when choice_n => end case; Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 11 11
12
Case Statement – Conceptual implementation
Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 12 12
13
Example: 4x1 Mux Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 13 13
14
Example: 2x4 Binary Decoder
Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 14 14
15
Example: 4-to-4 Priority Encoder
Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 15 15
16
Common Mistakes! Incomplete Branch not possible
Incomplete Signal Assignment
17
Common Mistakes! Incomplete Signal Assignment Solution 1
18
Common Mistakes! Incomplete Signal Assignment Solution 2
19
Outline If statement Case Statement For loop Statement 19 19
20
For-Loop Statement Looping in VHDL Syntax for index in loop_range loop
sequential statements; end loop; Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 20 20
21
For-Loop Statement – Conceptual implementation
For loop should be treated as “shorthand” for repetitive statements E.g., bit-wise xor Safety critical system failure could cause human life. Commercial critical systems: great financial loss if the product is recalled or is found to contain bugs Examples of undetected errors – Ariane 5 rocket explosion, 1996 (exception occurred when converting 64-bit floating number to a 16-bit integer) – Pentium bug (multiplier table not fully verified) – many more …. Somehow make debugging happen earlier where it is cheaper 21 21
22
Summary Concurrent statements Sequential statements
Have clear, direct mapping to physical structures Difficult to represent complex behaviors Sequential statements Flexible and versatile Resulting hardware may not be very straight forward at times Can be easily abused 22
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.