Global

AHDL Indentation Guidelines



Consider the following guidelines when working with Text Design Files (.tdf):

Parameters Statement, Subdesign Section, and Logic Section Indentation

PARAMETERS
(
    % parameter %
    % parameter %
);

SUBDESIGN
(
    % inputs  %
    % outputs %
    % bidirs  %
)
BEGIN
    % statement %
    % statement %
END;

If Then Statement Indentation

IF expression1 THEN
    % statement %
    % statement %
ELSIF expression2 THEN
    % statement %
    % statement %
ELSE
    % statement %
    % statement %
END IF;
NOTE Use a similar style for If Generate and For Generate statements.

Case Statement Indentation

CASE expression IS
   WHEN constant1 =>
     % statement %
     % statement %

   WHEN constant2 =>
     % statement %
     % statement %

   WHEN constant3 =>
     % statement %
     % statement %

   WHEN OTHERS =>
     % statement %
     % statement %
END CASE;

or

CASE expression IS
   WHEN constant1   =>   % statement %
   WHEN constant2   =>   % statement %
   WHEN constant3   =>   % statement %
   WHEN OTHERS      =>   % statement %
END CASE;

Truth Table Statement Indentation

TABLE
   ss,  inputs[]    =>  outputs[],  ss;

   s0,  B"xxxxx0"   =>  B"000001",  s1;
   s1,  B"xxxx01"   =>  B"000011",  s2;
   s2,  B"xxx011"   =>  B"000111",  s3;
   s3,  B"xx0111"   =>  B"001111",  s4;
   s4,  B"x01111"   =>  B"011111",  s5;
   s5,  B"011111"   =>  B"111111",  s0;
END TABLE;

Variable Section & State Machine Declaration Indentation

VARIABLE
   ss: MACHINE WITH STATES (s0, s1, s2, s3);

   tt: MACHINE
       OF BITS (q[3..0])
       WITH STATES (
          t0 = B"0001",
          t1 = B"0010",
          t2 = B"0100",
          t3 = B"1000");

Assert Statement Indentation

NOTE You can use The Text Editor's auto-indent feature and the Increase Indent and Decrease Indent commands (Edit menu) to help you indent text.
ASSERT condition
   REPORT "message"
      % message variables %
   SEVERITY ERROR;


Back to Top

- Altera -

 

Created by chm2web html help conversion utility.