Contents Up << >>

Behavioral

Now we create a final architecture body for the half adder using a behavioral method to describe its behavior. The main construct used for behavioral descriptions is the process statement. The process statement is a sequential program that is executed every time its inputs change. A behavioral description for the half adder that uses a process statement is Let's first examine the structure of the process statement. The first line defines a name for the process and indicates the sensitivity list. The sensitivity list specifies which signals should cause the process to be re-executed, computing the new values of s and c. In this case, it is whenever a or b changes. Immediately after the sensitivity list, the process may contain declarations, but there are none for the half adder. Following the declaration region, a list of sequential statements appears between the BEGIN and END. These statements are executed one after the other until the end is reached. This is different from the concurrent signal assignments used in the last section that are executed at arbitrary times independently. However, some caution has to be taken when using signal assignments in a process. Unlike variable assignments (which are also allowed and discussed later) in typical programming languages, the values assigned to a signal will not change the value of the signal until after the completion of the process. For example, if the following two statements appeared in a process and a was 1, b was 2, and c was 3 before the execution of the process then some time after the process is complete b would take the value 1 and c would take the value 2, not 1 as it might appear.

The execution of a process is as follows. When a GM VHDL program is started, each process of this form is executed once from top to bottom. When execution reaches the bottom, execution stops and is said to be suspended. If a signal in the sensitivity list changes, the process starts again (is resumed), executes from the top and suspends again at the bottom. If the process does not have a sensitivity list then the execution of the process is a little different and is discussed later.

Returning to the behavioral description of the half adder, look at the if statement contained in the statement body of the process. This description behaves exactly the same as the functional description described in the last section. However, the way its written looks more like a software algorithm than a description of a digital circuit. This particular description is not a good way to describe the half adder, but was written to demonstrate the distinction of a behavioral description. In fact, if a process was used to describe the half adder, it could be written which is almost identical to the data flow description.