Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
VHDL Coding Style
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
VHDL Coding Style
Commits
b4dc77d0
Commit
b4dc77d0
authored
Feb 16, 2018
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc: rewording.
parent
b45975e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
21 deletions
+45
-21
vhdl-coding-style.adoc
doc/vhdl-coding-style.adoc
+45
-21
No files found.
doc/vhdl-coding-style.adoc
View file @
b4dc77d0
...
...
@@ -255,6 +255,45 @@ The indentation is two spaces. Identation is used:
* for nested concurrent or sequential statements
* for the second and later lines of a multi-line declaration or statement.
The only exception to this rule is for case statements: statements in
alternative must also be indented except when there is only one simple
statement. In the latter case the simple statement can directly
follow the `=>`.
Example:
[source]
----
case addr(2 downto 0) is
when "000" => s <= "010";
when "001" => s <= "001";
when others => s <= "000";
end case;
----
The `end` of complex constructions must be on the same column as the first
token of the construction.
Example:
[source]
----
entity my_ent is
end my_ent;
---
Complex constructions must have elements on the same column:
* for if statements: `if`, `elsif` and `else`
The `begin` and the `end` must always be on the same column. This rules
concerns the following constructs:
* architecture body
* block statement
* entity declaration
* generate statement body
* process statement
* subprogram body
Reason: Indentation makes code structure clearer; 2 spaces is an
historical choice.
...
...
@@ -375,7 +414,6 @@ Reason: Alignment makes code easier to read.
For the `if` statement, the `then` must be on the same line as the `if` or
the `elsif`, unless the condition is too long. In the latter case,
the `then` must be on the same column as the related `if` or `elsif`.
The `if`, `elif` and `end if` must be on the same column.
Example:
[source]
...
...
@@ -405,12 +443,9 @@ Example:
----
For `case` statement, the `is` must be on the same line or the same
column as the `case`. Alternative must be indented. Statements in
alternative must also be indented except when there is only one simple
statement. In the latter case the simple statement can directly
follow the `=>`.
column as the `case`.
Example
Example
:
[source]
----
case state is
...
...
@@ -421,26 +456,15 @@ Example
end case;
----
[source]
----
case addr(2 downto 0) is
when "000" => s <= "010";
when "001" => s <= "001";
when others => s <= "000";
end case;
----
Reason: Makes easier to identify nested statements.
==== [
BeginEndLayout] [M] Layout of begin/end keywords
==== [
SubprgIsLayout] [M] Layout of is keyword in subprogram
In many VHDL constructs, `is` introduces declarations, `begin` statements and
`end` terminates the statements.
The `begin` and the `end` must always be on the same column. If there are
declarations, the `is` must be on a new line otherwise it must be on the same
line.
For subprogram bodies, if there are declarations the `is` must be on a
new line otherwise it must be on the same line.
Examples:
[source]
...
...
@@ -648,7 +672,7 @@ User declared types and subtypes must have the 't_' prefix.
Reason: Makes purpose of the type more obvious.
==== [PackageName] [M] Packages name
==== [Package
s
Name] [M] Packages name
The name of packages must have the '_pkg' suffix.
No entity can have that suffix.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment