Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
114
Добавлен:
26.03.2016
Размер:
7.4 Mб
Скачать

10.14 Execution

Two successive statements may execute in either a concurrent or sequential fashion depending on where the statements appear.

statement_1; statement_2;

In sequential execution, statement_1 in this sequence is always evaluated before statement 2 . In concurrent execution, statement_1 and statement_2 are evaluated at the same time (as far as we are concerned--obviously on most computers exactly parallel execution is not possible). Concurrent execution is the most important difference between VHDL and a computer programming language. Suppose we have two signal assignment statements inside a process statement. In this case statement_1 and statement_2 are sequential assignment statements:

entity Sequential_1 is end; architecture Behave of Sequential_1 is signal s1, s2 : INTEGER := 0;

begin

 

 

 

 

 

process begin

 

 

 

 

 

s1 <= 1;

 

-- sequential signal assignment 1

s2 <= s1 + 1; -- sequential signal assignment 2

wait on

s1, s2 ;

 

 

end process;

 

 

 

 

 

end;

 

 

 

 

 

Time(fs) + Cycle

 

s1

 

s2

----------------------

------------

------------

0+

0:

 

0

 

0

0+

1:

*

1

*

1

0+

2:

*

1

*

2

0+

3:

*

1

*

2

If the two statements are outside a process statement they are concurrent assignment statements, as in the following example:

entity Concurrent_1 is end; architecture Behave of Concurrent_1 is

signal s1,

s2 : INTEGER

:= 0; begin

 

 

L1

: s1

<= 1;

 

 

-- concurrent signal assignment 1

L2

: s2

<= s1 + 1; -- concurrent signal assignment 2

end;

 

 

 

 

 

 

 

Time(fs) + Cycle

 

s1

 

s2

----------------------

------------

------------

 

 

0+

0:

 

0

 

0

 

 

0+

1:

*

1

*

1

 

 

0+

2:

 

1

*

2

The two concurrent signal assignment statements in the previous example are equivalent to the two processes, labeled as P1 and P2 , in the following model.

entity Concurrent_2 is end; architecture Behave of Concurrent_2 is signal s1, s2 : INTEGER := 0; begin

P1

: process

begin s1 <= 1;

 

 

wait on s2 ; end process;

P2

: process

begin s2 <= s1

+ 1; wait on s1 ; end process;

end;

 

 

 

 

 

 

 

Time(fs) + Cycle

 

s1

 

s2

----------------------

------------

------------

 

0+

0:

 

 

0

 

0

 

0+

1:

*

 

1

*

1

 

0+

2:

*

 

1

*

2

 

0+

3:

*

 

1

 

2

Notice that the results are the same (though the trace files are slightly different) for the architectures Sequential_1, Concurrent_1, and Concurrent_2. Updates to signals occur at the end of the simulation cycle, so the values used will always be the old values. So far things seem fairly simple: We have sequential execution or concurrent execution. However, variables are updated immediately, so the variable values that are used are always the new values. The examples in Table 10.17 illustrate this very important difference.

The various concurrent and sequential statements in VHDL are summarized in Table 10.18.

10.15 Configurations and Specifications

The difference between, the interaction, and the use of component/configuration declarations and specifications is probably the most confusing aspect of VHDL. Fortunately this aspect of VHDL is not normally important for ASIC design. The syntax of component/configuration declarations and specifications is shown in Table 10.19.

A configuration declaration defines a configuration--it is a library unit and is one of the basic units of VHDL code.

A block configuration defines the configuration of a block statement or a design entity. A block configuration appears inside a configuration declaration, a component configuration, or nested in another block configuration.

A configuration specification may appear in the declarative region of a generate statement, block statement, or architecture body.

A component declaration may appear in the declarative region of a generate statement, block statement, architecture body, or package.

A component configuration defines the configuration of a component and appears in a block configuration.

Table 10.20 shows a simple example (identical in structure to the example of Section 10.5) that illustrates the use of each of the preceding constructs.

1. Underline means "new to VHDL-93".

Соседние файлы в папке Для магистратуры