vhdl-style-guide/docs/library_rules.rst

247 lines
4.3 KiB
ReStructuredText

Library Rules
-------------
library_001
###########
This rule checks the indent of the **library** keyword.
Indenting helps in comprehending the code.
**Violation**
.. code-block:: vhdl
library ieee;
library fifo_dsn;
**Fix**
.. code-block:: vhdl
library ieee;
library fifo_dsn;
library_002
###########
This rule checks for excessive spaces after the **library** keyword.
**Violation**
.. code-block:: vhdl
library ieee;
**Fix**
.. code-block:: vhdl
library ieee;
library_003
###########
This rule checks for blank lines or comments above the entity keyword.
Refer to the section `Configuring Previous Line Rules <configuring.html#configuring-previous-line-rules>`_ for options.
There is an additional **allow_library_clause** option which can be set.
Refer to section `Reporting Single Rule Configuration <configuring.html#reporting-single-rule-configuration>`_ for details on finding configuration options for individual rules.
allow_library_clause
^^^^^^^^^^^^^^^^^^^^
When set to **True**, it allows consecutive library clauses.
**Violation**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
library top_dsn;
library fifo_dsn;
**Fix**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
library top_dsn;
library fifo_dsn;
library_004
###########
This rule checks the **library** keyword has proper case.
Refer to the section `Configuring Uppercase and Lowercase Rules <configuring.html#configuring-uppercase-and-lowercase-rules>`_ for information on changing the default case.
**Violation**
.. code-block:: vhdl
Library ieee;
LIBRARY fifo_dsn;
**Fix**
.. code-block:: vhdl
library ieee;
library fifo_dsn;
library_005
###########
This rule checks the **use** keyword has proper case.
Refer to the section `Configuring Uppercase and Lowercase Rules <configuring.html#configuring-uppercase-and-lowercase-rules>`_ for information on changing the default case.
**Violation**
.. code-block:: vhdl
library ieee;
USE ieee.std_logic_1164.all;
Use ieee.std_logic_unsigned.all;
**Fix**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library_006
###########
This rule checks for excessive spaces after the **use** keyword.
**Violation**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
**Fix**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library_007
###########
This rule checks for blank lines or comments above the **process** declaration.
Refer to the section `Configuring Blank Lines <configuring.html#configuring-blank-lines>`_ for options regarding comments.
The default style is :code:`no_blank`.
**Violation**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
**Fix**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library_008
###########
This rule checks the indent of the **use** keyword.
**Violation**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
**Fix**
.. code-block:: vhdl
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
library_009
###########
This rule checks alignment of comments above library use statements.
**Violation**
.. code-block:: vhdl
library ieee;
-- Use standard logic library
use ieee.std_logic_1164.all;
**Fix**
.. code-block:: vhdl
library ieee;
-- Use standard logic library
use ieee.std_logic_1164.all;
library_010
###########
This rule checks the **library** keyword is on it's own line.
**Violation**
.. code-block:: vhdl
context c1 is library ieee; use ieee.std_logic_1164.all; end context c1;
**Fix**
.. code-block:: vhdl
context c1 is
library ieee; use ieee.std_logic_1164.all; end context c1;
library_011
###########
This rule checks the **use** keyword is on it's own line.
**Violation**
.. code-block:: vhdl
context c1 is library ieee; use ieee.std_logic_1164.all; end context c1;
**Fix**
.. code-block:: vhdl
context c1 is library ieee;
use ieee.std_logic_1164.all; end context c1;