Slide 16 of 65
Notes:
In this example, we show a model for a simple 2-bit counter which counts clock pulses. The component has clock as an input, and two outputs which represent the LSB and MSB of a two-bit unsigned number.
Several of the constructs used above have not been shown before in this series of educational modules. For example, bit'val(count_value mod 2) is a function which returns a value of type bit; count_value is a natural number (i.e. an integer greater than, or equal to, zero); count_value mod 2 returns the LSB value of the counter value; but the LSB value is of type natural. Since we want the LSB to be of type bit instead, we cast it by using the 'val (read as "tic val") attribute on the type bit.
Also note the use a a generic parameter used to facilitate the assignment of delays in the signal assignment statements.