AHDL

For Generate Statement



The For Generate Statement lists a series of behavioral statements to be repeated.

The following example shows an iterative For Generate Statement:

CONSTANT NUM_OF_ADDERS = 8;

SUBDESIGN 4gentst
(
   a[NUM_OF_ADDERS..1], b[NUM_OF_ADDERS..1], cin   : INPUT;
   c[NUM_OF_ADDERS..1], cout                       :OUTPUT;
)

VARIABLE
   carry_out[(NUM_OF_ADDERS+1)..1]   : NODE;

BEGIN
   carry_out[1] = cin;
   FOR i IN 1 TO NUM_OF_ADDERS GENERATE
      c[i] = a[i] $ b[i] $ carry_out[i];		% Full Adder %
      carry_out[i+1] = a[i] & b[i] # carry_out[i] & (a[i] $ b[i]);
    END GENERATE;
    cout = carry_out[NUM_OF_ADDERS+1];
END;

The For Generate Statement has the following characteristics:


Back to Top

- Altera -

 

Created by chm2web html help conversion utility.