next up previous contents
Next: Unit delay assignments - Up: Signals and assignments Previous: Operations on signals   Contents

Assignments

An assignment is of the form

        <signal> := <expr>;
where <expr> is an expression that combines other signals using operators like ~ and &. Unlike an assignment in a typical ``procedural'' language, this assignment means exactly what it says: that <signal> is equal to <expr>. So for example, suppose we make the assignment

        zip := foo & bar;

If foo and bar are as above, then

                 zip = 0;0;0;1;...

The assignments in an SMV program are interpreted as equations holding simultaneously. That is, the fact that two assignments occur in sequence in a program is not interpreted to mean that they are to hold sequentially. Thus, for example, if these assignments appear in a program:

  y := x + 1;
  z := y + 1;
then we have (at all times) z = x + 2.

A variable that is not assigned is free to take any value at any time. Note that this is very different from imperative programming languages in which an unassigned variable maintains its value over time. You should think of an assignment in an SMV program as a constraint on a variable, and an unassigned variable as an unconstrained variable.


next up previous contents
Next: Unit delay assignments - Up: Signals and assignments Previous: Operations on signals   Contents
2006-05-24