Procedural Constructs

Initial Block

Keywords: initial

An initial block consists of a statement or a group of statements enclosed in begin... end which will be executed only once at simulation time 0. If there is more than one block they execute concurrently and independently. The initial block is normally used for initialisation, monitoring, generating wave forms (eg, clock pulses) and processes which are executed once in a simulation. An example of initialisation and wave generation is given below


        initial
        clock = 1'b0;  // variable initialization

        initial
           begin  // multiple statements have to be grouped
           alpha = 0;
           #10 alpha = 1;  // waveform generation
           #20 alpha = 0;
           #5  alpha = 1;
           #7  alpha = 0;
           #10 alpha = 1;
           #20 alpha = 0;
           end;


EXERCISE
a) Note that the first initial block in the example does not contain the keywords begin and end. Why is this ?

Answers


next contents