Skip to content

Commit 9d06766

Browse files
committed
fix hdl_coding_guidelines doc
1 parent 6584c6b commit 9d06766

File tree

1 file changed

+121
-127
lines changed

1 file changed

+121
-127
lines changed

docs/user_guide/hdl_coding_guidelines.rst

Lines changed: 121 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -470,15 +470,14 @@ multiple of 2, with a minimum of 2 spaces.
470470
Items in a list (when present) must be indented by +2 spaces relative to the
471471
``localparam`` line.
472472

473-
**A21.2**
473+
**A21.2**
474474

475475
**Multi-line list form**
476476

477477
When declaring multiple local parameters as a list:
478-
- the list must start on a new line after the ``localparam`` keyword;
479-
- each intermediate item must end with a comma ``,``; the last item must not end
480-
with a comma;
481-
- the ``=`` operator must be column-aligned across all items in the list.
478+
* the list must start on a new line after the ``localparam`` keyword;
479+
* each intermediate item must end with a comma ``,``; the last item must not end with a comma;
480+
* the ``=`` operator must be column-aligned across all items in the list.
482481

483482
Correct:
484483

@@ -494,17 +493,12 @@ Correct:
494493
**Concatenation form ({ … })**
495494

496495
When declaring a local parameter using concatenation:
497-
- the first element may appear on the same line as ``{``; all subsequent elements
498-
must start on new lines, indented by +2 spaces;
499-
- items must be aligned to a common anchor (apostrophes in literals or, otherwise,
500-
the first token) for visual alignment;
501-
- inline comments for items should align to a common column, at least 4 spaces
502-
after the longest code element;
503-
- the closing ``};`` must be attached to the last element on the same line;
504-
- comments written after a comma belong to the preceding element and must
505-
be attached to that element’s line;
506-
- any trailing comment after the final semicolon of the whole statement must be
507-
attached to the last element’s line.
496+
* the first element may appear on the same line as ``{``; all subsequent elements must start on new lines, indented by +2 spaces;
497+
* items must be aligned to a common anchor (apostrophes in literals or, otherwise, the first token) for visual alignment;
498+
* inline comments for items should align to a common column, at least 4 spaces after the longest code element;
499+
* the closing ``};`` must be attached to the last element on the same line;
500+
* comments written after a comma belong to the preceding element and must be attached to that element’s line;
501+
* any trailing comment after the final semicolon of the whole statement must be attached to the last element’s line.
508502

509503
Correct:
510504

@@ -532,7 +526,7 @@ relative to the typedef line.
532526
**A22.3**
533527

534528
The closing ``}`` must be aligned with the ``typedef`` line indentation.
535-
The type name and semicolon must be on the same line as ``}`` (see :ref: _example-a22).
529+
The type name and semicolon must be on the same line as ``}``.
536530

537531
**A22.4**
538532

@@ -725,7 +719,7 @@ D. General
725719

726720
**D1**
727721

728-
A file **must** contain a single module.
722+
A file **must** contain a single module or package.
729723

730724
**D2**
731725

@@ -1002,117 +996,117 @@ Annex 2 VHDL file format
1002996
Annex 3 SystemVerilog package file format
1003997
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1004998

1005-
.. code-block:: systemverilog
999+
.. code-block:: verilog
10061000
:linenos:
10071001
1008-
// ***************************************************************************
1009-
// ***************************************************************************
1010-
// Copyright (C) year-year Analog Devices, Inc. All rights reserved.
1011-
//
1012-
// In this HDL repository, there are many different and unique modules, consisting
1013-
// of various HDL (Verilog or VHDL) components. The individual modules are
1014-
// developed independently, and may be accompanied by separate and unique license
1015-
// terms.
1016-
//
1017-
// The user should read each of these license terms, and understand the
1018-
// freedoms and responsibilities that he or she has by using this source/core.
1019-
//
1020-
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
1021-
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1022-
// A PARTICULAR PURPOSE.
1023-
//
1024-
// Redistribution and use of source or resulting binaries, with or without modification
1025-
// of this file, are permitted under one of the following two license terms:
1026-
//
1027-
// 1. The GNU General Public License version 2 as published by the
1028-
// Free Software Foundation, which can be found in the top level directory
1029-
// of this repository (LICENSE_GPL2), and also online at:
1030-
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
1031-
//
1032-
// OR
1033-
//
1034-
// 2. An ADI specific BSD license, which can be found in the top level directory
1035-
// of this repository (LICENSE_ADIBSD), and also on-line at:
1036-
// https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
1037-
// This will allow to generate bit files and not release the source code,
1038-
// as long as it attaches to an ADI device.
1039-
//
1040-
// ***************************************************************************
1041-
// ***************************************************************************
1042-
1043-
package axi_tdd_pkg;
1044-
1045-
typedef enum logic [1:0] {
1046-
IDLE = 2'b00,
1047-
ARMED = 2'b01,
1048-
WAITING = 2'b10,
1049-
RUNNING = 2'b11
1050-
} state_t;
1051-
// comment describing the type
1052-
1053-
localparam
1054-
PCORE_VERSION = 32'h00020062,
1055-
PCORE_MAGIC = 32'h5444444E; // "TDDN", big endian
1056-
1057-
// register address offset
1058-
localparam
1059-
ADDR_TDD_VERSION = 8'h00,
1060-
ADDR_TDD_ID = 8'h01,
1061-
ADDR_TDD_SCRATCH = 8'h02,
1062-
ADDR_TDD_IDENTIFICATION = 8'h03,
1063-
ADDR_TDD_INTERFACE = 8'h04,
1064-
ADDR_TDD_DEF_POLARITY = 8'h05,
1065-
ADDR_TDD_CONTROL = 8'h10,
1066-
ADDR_TDD_CH_ENABLE = 8'h11,
1067-
ADDR_TDD_CH_POLARITY = 8'h12,
1068-
ADDR_TDD_BURST_COUNT = 8'h13,
1069-
ADDR_TDD_STARTUP_DELAY = 8'h14,
1070-
ADDR_TDD_FRAME_LENGTH = 8'h15,
1071-
ADDR_TDD_SYNC_CNT_LOW = 8'h16,
1072-
ADDR_TDD_SYNC_CNT_HIGH = 8'h17,
1073-
ADDR_TDD_STATUS = 8'h18,
1074-
ADDR_TDD_CH_ON = 8'h20,
1075-
ADDR_TDD_CH_OFF = 8'h21;
1076-
1077-
// channel offset values
1078-
localparam
1079-
CH0 = 0,
1080-
CH1 = 1,
1081-
CH2 = 2,
1082-
CH3 = 3,
1083-
CH4 = 4,
1084-
CH5 = 5,
1085-
CH6 = 6,
1086-
CH7 = 7,
1087-
CH8 = 8,
1088-
CH9 = 9,
1089-
CH10 = 10,
1090-
CH11 = 11,
1091-
CH12 = 12,
1092-
CH13 = 13,
1093-
CH14 = 14,
1094-
CH15 = 15,
1095-
CH16 = 16,
1096-
CH17 = 17,
1097-
CH18 = 18,
1098-
CH19 = 19,
1099-
CH20 = 20,
1100-
CH21 = 21,
1101-
CH22 = 22,
1102-
CH23 = 23,
1103-
CH24 = 24,
1104-
CH25 = 25,
1105-
CH26 = 26,
1106-
CH27 = 27,
1107-
CH28 = 28,
1108-
CH29 = 29,
1109-
CH30 = 30,
1110-
CH31 = 31;
1111-
1112-
endpackage
1113-
1114-
4. References
1115-
-------------------------------------------------------------------------------
1002+
// ***************************************************************************
1003+
// ***************************************************************************
1004+
// Copyright (C) year-year Analog Devices, Inc. All rights reserved.
1005+
//
1006+
// In this HDL repository, there are many different and unique modules, consisting
1007+
// of various HDL (Verilog or VHDL) components. The individual modules are
1008+
// developed independently, and may be accompanied by separate and unique license
1009+
// terms.
1010+
//
1011+
// The user should read each of these license terms, and understand the
1012+
// freedoms and responsibilities that he or she has by using this source/core.
1013+
//
1014+
// This core is distributed in the hope that it will be useful, but WITHOUT ANY
1015+
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1016+
// A PARTICULAR PURPOSE.
1017+
//
1018+
// Redistribution and use of source or resulting binaries, with or without modification
1019+
// of this file, are permitted under one of the following two license terms:
1020+
//
1021+
// 1. The GNU General Public License version 2 as published by the
1022+
// Free Software Foundation, which can be found in the top level directory
1023+
// of this repository (LICENSE_GPL2), and also online at:
1024+
// <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
1025+
//
1026+
// OR
1027+
//
1028+
// 2. An ADI specific BSD license, which can be found in the top level directory
1029+
// of this repository (LICENSE_ADIBSD), and also on-line at:
1030+
// https://github.com/analogdevicesinc/hdl/blob/main/LICENSE_ADIBSD
1031+
// This will allow to generate bit files and not release the source code,
1032+
// as long as it attaches to an ADI device.
1033+
//
1034+
// ***************************************************************************
1035+
// ***************************************************************************
1036+
1037+
package axi_tdd_pkg;
1038+
1039+
typedef enum logic [1:0] {
1040+
IDLE = 2'b00,
1041+
ARMED = 2'b01,
1042+
WAITING = 2'b10,
1043+
RUNNING = 2'b11
1044+
} state_t;
1045+
// comment describing the type
1046+
1047+
localparam
1048+
PCORE_VERSION = 32'h00020062,
1049+
PCORE_MAGIC = 32'h5444444E; // "TDDN", big endian
1050+
1051+
// register address offset
1052+
localparam
1053+
ADDR_TDD_VERSION = 8'h00,
1054+
ADDR_TDD_ID = 8'h01,
1055+
ADDR_TDD_SCRATCH = 8'h02,
1056+
ADDR_TDD_IDENTIFICATION = 8'h03,
1057+
ADDR_TDD_INTERFACE = 8'h04,
1058+
ADDR_TDD_DEF_POLARITY = 8'h05,
1059+
ADDR_TDD_CONTROL = 8'h10,
1060+
ADDR_TDD_CH_ENABLE = 8'h11,
1061+
ADDR_TDD_CH_POLARITY = 8'h12,
1062+
ADDR_TDD_BURST_COUNT = 8'h13,
1063+
ADDR_TDD_STARTUP_DELAY = 8'h14,
1064+
ADDR_TDD_FRAME_LENGTH = 8'h15,
1065+
ADDR_TDD_SYNC_CNT_LOW = 8'h16,
1066+
ADDR_TDD_SYNC_CNT_HIGH = 8'h17,
1067+
ADDR_TDD_STATUS = 8'h18,
1068+
ADDR_TDD_CH_ON = 8'h20,
1069+
ADDR_TDD_CH_OFF = 8'h21;
1070+
1071+
// channel offset values
1072+
localparam
1073+
CH0 = 0,
1074+
CH1 = 1,
1075+
CH2 = 2,
1076+
CH3 = 3,
1077+
CH4 = 4,
1078+
CH5 = 5,
1079+
CH6 = 6,
1080+
CH7 = 7,
1081+
CH8 = 8,
1082+
CH9 = 9,
1083+
CH10 = 10,
1084+
CH11 = 11,
1085+
CH12 = 12,
1086+
CH13 = 13,
1087+
CH14 = 14,
1088+
CH15 = 15,
1089+
CH16 = 16,
1090+
CH17 = 17,
1091+
CH18 = 18,
1092+
CH19 = 19,
1093+
CH20 = 20,
1094+
CH21 = 21,
1095+
CH22 = 22,
1096+
CH23 = 23,
1097+
CH24 = 24,
1098+
CH25 = 25,
1099+
CH26 = 26,
1100+
CH27 = 27,
1101+
CH28 = 28,
1102+
CH29 = 29,
1103+
CH30 = 30,
1104+
CH31 = 31;
1105+
1106+
endpackage
1107+
1108+
4. References
1109+
-------------------------------------------------------------------------------
11161110
11171111
`[1] Philippe Garrault, Brian Philofsky, "HDL Coding Practices to Accelerate
11181112
Design Performance", Xilinx, 2006

0 commit comments

Comments
 (0)