Skip to content

pragma alignment #1520

@Giftkekschen

Description

@Giftkekschen

Environment
VSG version: 3.35.0
OS: Ubuntu 22.04.5 LTS

Describe the bug
Opening and closing pragmas should be aligned to the same level if pragma_300 is enabled. However, if the pragma is the last token in a block, it is aligned to the indentation level of the next statement (e.g. begin). Even for the example from the pragma_300 documentation the closing pragma is aligned to 0 indent with the default configuration.

To Reproduce
Steps to reproduce the behavior:

  1. get the example from the attached pragma.vhd.txt file (Note: file extension due to github permissions)
  2. vsg -f path/to/pragma.vhd -ap
================================================================================
File:  /path/to/pragma.vhd
================================================================================
Phase 7 of 7... Reporting
Total Rules Checked: 889
Total Violations:    7
  Error   :     7
  Warning :     0
-------------+------------+------------+--------------------------------------
  Rule       |  severity  |  line(s)   | Solution
-------------+------------+------------+--------------------------------------
  pragma_300 | Error      |         21 | Indent level 0
  pragma_300 | Error      |         36 | Use 8 spaces for indent
  pragma_300 | Error      |         42 | Use 6 spaces for indent
  if_006     | Error      |         46 | Remove blank lines below
  pragma_300 | Error      |         50 | Use 6 spaces for indent
  if_008     | Error      |         52 | Remove blank line(s) before the *end if* keyword.
  pragma_300 | Error      |         57 | Use 2 spaces for indent
-------------+------------+------------+--------------------------------------
NOTE: Refer to online documentation at https://vhdl-style-guide.readthedocs.io/en/latest/index.html for more information.

Expected behavior
The closing pragma should be correctly indented to the same level as the opening pragma. So all pragma_300 errors in the above example are unexpected.

Additional context
Additionally, the configuring-pragmas documentation gives an example, where \ are escaped in the xaml config file, but this breaks the pragma config. In the yaml config a single backslash is correct.

Edit:
relevant code snippets for readability without downloading the file:

...
architecture rtl of pragma is

  -- example from documentation:

  -- synthesis translate_off
  signal wr_en : std_logic;
  signal rd_en : std_logic;
  -- synthesis translate_on

begin
...
      case reset is

        when others =>

          -- synthesis translate_off
          null;
          -- synthesis translate_on

      end case;
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions