You are on page 1of 29

Sequential statement of

VHDL

VHDL process

Sequential signal assignment statement

Variable assignment statement

If statement

Case statement

For loop statement

VHDL process

Contains a set of sequential statements.

The whole process is a concurrent statement.

May or may not be able to be mapped to


physical hardware.

Process with sensitivity list

process(sensitivity_list)
declarations;
begin
sequential statement;
sequential statement;
...
end process;
3

Process

A process is activated when a signal in


the sensitivity list changes its value
then executes sequentially.

Process

signal a,b,c,y: std_logic;


process(a,b,c)
begin
y <= a and b and c;
end process;

This is interpreted as a 3 input AND gate


process(a)
begin
y <= a and b and c;
end process;

Interpreted as 3 input AND gate with memory elements (unwanted)


For a combinational circuit, all input should be included in the sensitivity list

Wait statements

Process continues the execution until a wait statement is reached and then suspended
Forms of wait statement:
wait on signals;
wait until boolean_expression;
wait for time_expression;

3-input and circuit


process
begin
y <= a and b and c;
wait on a, b, c;
end process;

A process can have multiple wait statements

Process with sensitivity list is preferred for synthesis

Sequential signal
assignment statement

signal_name <= value_expression;


Syntax is identical to the simple
concurrent signal assignment
Inside a process, a signal can be
assigned multiple times, but only the
last assignment takes effect
7

Sequential signal
assignment statement

process(a,b,c,d)

process(a,b,c,d)

begin

begin

y <= a or c;

y <= c and d;

y <= a and b;

end process;

y <= c and d;
end process;

They are the same !


8

Variable assignment
statement
Syntax

variable_name := value_expression;

Assignment takes effect immediately

No time dimension (i.e., no delay)

Behave like variables in C

Difficult to map to hardware (depending on context)

Variable assignment
statement

process(a,b)

process(a,b)

variable tmp: std_logic;

variable tmp0, tmp1, tmp2: std_logic;

begin

begin

tmp := '0';

tmp0 := '0';

tmp := tmp or a;

tmp1 := tmp0 or a;

tmp := tmp or b;

tmp2 := tmp1 or b;

y <= tmp;

y <= tmp2;

end process;

end process;

10

IF statement

Syntax
if boolean_expr_1 then
sequential_statements;

elsif boolean_expr_2 then


sequential_statements;

else
sequential_statements;

end if;
11

IF statement

Examples
- 4 to 1 Multiplexer Home work
- 2 to 4 Decoder Homework
- 4 to 2 Priority encoder

12

Comparison with conditional


signal assignment

13

Example: Find the max of


3 operands

14

Sharing boolean condition

15

Incomplete branch

16

Incomplete signal
assignment

17

Conceptual interpretation

18

Conceptual interpretation

19

Case statement

Syntax
case case_expression is
when choice_1 =>
sequential statements;

when choice_2 =>


sequential statements;

.
.
when choice_n =>
sequential statements;

end case;
20

Examples

4 to 1 multiplexer

2 to 4 decoder Homework

4 to 2 priority encoder

21

Comparison to selected
signal assignment

22

Incomplete signal
assignment

23

Conceptual
implementation

24

For loop statement

Syntax :
for index in loop_range loop
sequential statements;

end loop;

loop_range must be static


25

Example 1 : Wide Xor

26

Example 2 : Reduced Xor

27

Conceptual
implementation

Unrolling the loop


Wide xor :
y(3)<= a(3) xor b(3);

Used for repetitive code


reduced xor :
temp(0) <= a(0)
temp(1) <=a(1) xor temp(0);

y(2)<= a(2) xor b(2);

temp(2) <=a(2) xor temp(1);

y(1)<= a(1) xor b(1);

temp(3) <=a(3) xor temp(2);

y(0)<= a(0) xor b(0);

y<= temp(3);
28

Notes

Concurrent statements have clear,


direct mapping to physical structures
Sequential statements can be difficult
to be realized in hardware

29

You might also like