diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2022-12-05 21:39:51 +0100 |
---|---|---|
committer | tgingold <tgingold@users.noreply.github.com> | 2022-12-06 07:23:44 +0100 |
commit | 9824b3c9a8d2103a5ecd77ff957536fa16c24bbf (patch) | |
tree | 5e870dfeaed5db9899a20bb5e10b963333bcc487 | |
parent | 60c43acaf82696dabdbf8a88138a656a9bde982c (diff) | |
download | ghdl-9824b3c9a8d2103a5ecd77ff957536fa16c24bbf.tar.gz ghdl-9824b3c9a8d2103a5ecd77ff957536fa16c24bbf.tar.bz2 ghdl-9824b3c9a8d2103a5ecd77ff957536fa16c24bbf.zip |
Reorganized testcases.
-rw-r--r-- | testsuite/pyunit/libghdl/Comment2.vhdl | 132 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/Comments.py | 124 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/Complex.vhdl | 132 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/DesignComment.vhdl (renamed from testsuite/pyunit/libghdl/DesignComment.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/arch_bef.vhdl (renamed from testsuite/pyunit/libghdl/arch_bef.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/arch_inside.vhdl (renamed from testsuite/pyunit/libghdl/arch_inside.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/arch_inside_fail.vhdl (renamed from testsuite/pyunit/libghdl/arch_inside_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/array.vhdl (renamed from testsuite/pyunit/libghdl/array.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/conf_bef.vhdl (renamed from testsuite/pyunit/libghdl/conf_bef.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/conf_inside.vhdl (renamed from testsuite/pyunit/libghdl/conf_inside.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/conf_inside_fail.vhdl (renamed from testsuite/pyunit/libghdl/conf_inside_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/const.vhdl (renamed from testsuite/pyunit/libghdl/const.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/const_fail.vhdl (renamed from testsuite/pyunit/libghdl/const_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ctxt_bef.vhdl (renamed from testsuite/pyunit/libghdl/ctxt_bef.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ctxt_inside.vhdl (renamed from testsuite/pyunit/libghdl/ctxt_inside.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ctxt_inside_fail.vhdl (renamed from testsuite/pyunit/libghdl/ctxt_inside_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/element_1.vhdl (renamed from testsuite/pyunit/libghdl/element_1.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/element_2.vhdl (renamed from testsuite/pyunit/libghdl/element_2.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/element_3.vhdl (renamed from testsuite/pyunit/libghdl/element_3.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/element_4.vhdl (renamed from testsuite/pyunit/libghdl/element_4.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/elements_fail.vhdl (renamed from testsuite/pyunit/libghdl/elements_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ent_arch.vhdl (renamed from testsuite/pyunit/libghdl/ent_arch.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ent_bef.vhdl (renamed from testsuite/pyunit/libghdl/ent_bef.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/ent_inside.vhdl (renamed from testsuite/pyunit/libghdl/ent_inside.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enum.vhdl (renamed from testsuite/pyunit/libghdl/enum.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enum_fail.vhdl (renamed from testsuite/pyunit/libghdl/enum_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enumlit_1.vhdl (renamed from testsuite/pyunit/libghdl/enumlit_1.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enumlit_2.vhdl (renamed from testsuite/pyunit/libghdl/enumlit_2.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enumlit_3.vhdl (renamed from testsuite/pyunit/libghdl/enumlit_3.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/enumlit_fail.vhdl (renamed from testsuite/pyunit/libghdl/enumlit_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/func.vhdl (renamed from testsuite/pyunit/libghdl/func.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/func_fail.vhdl (renamed from testsuite/pyunit/libghdl/func_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/func_param.vhdl (renamed from testsuite/pyunit/libghdl/func_param.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/func_param_fail.vhdl (renamed from testsuite/pyunit/libghdl/func_param_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/line1.vhdl (renamed from testsuite/pyunit/libghdl/line1.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/multi1.vhdl (renamed from testsuite/pyunit/libghdl/multi1.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/pkg_bef.vhdl (renamed from testsuite/pyunit/libghdl/pkg_bef.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/pkg_inside.vhdl (renamed from testsuite/pyunit/libghdl/pkg_inside.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail.vhdl (renamed from testsuite/pyunit/libghdl/pkg_inside_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail2.vhdl (renamed from testsuite/pyunit/libghdl/pkg_inside_fail2.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/process.vhdl (renamed from testsuite/pyunit/libghdl/process.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/process_fail.vhdl (renamed from testsuite/pyunit/libghdl/process_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/record.vhdl (renamed from testsuite/pyunit/libghdl/record.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/record_fail.vhdl (renamed from testsuite/pyunit/libghdl/record_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/sig.vhdl (renamed from testsuite/pyunit/libghdl/sig.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/sig_2.vhdl (renamed from testsuite/pyunit/libghdl/sig_2.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/sig_fail.vhdl (renamed from testsuite/pyunit/libghdl/sig_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/type.vhdl (renamed from testsuite/pyunit/libghdl/type.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/type_fail.vhdl (renamed from testsuite/pyunit/libghdl/type_fail.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/var.vhdl (renamed from testsuite/pyunit/libghdl/var.vhdl) | 0 | ||||
-rw-r--r-- | testsuite/pyunit/libghdl/examples/comments/var_fail.vhdl (renamed from testsuite/pyunit/libghdl/var_fail.vhdl) | 0 |
51 files changed, 197 insertions, 191 deletions
diff --git a/testsuite/pyunit/libghdl/Comment2.vhdl b/testsuite/pyunit/libghdl/Comment2.vhdl deleted file mode 100644 index e56815a52..000000000 --- a/testsuite/pyunit/libghdl/Comment2.vhdl +++ /dev/null @@ -1,132 +0,0 @@ --- comments before design units (javadoc / .net documentation style) --- might be multiline -entity e1 is -end entity; - --- comments before design units --- might be multiline -architecture a1 of e1 is -begin -end architecture; - --- comments before design units --- might be multiline -package p1 is -end package; - --- package body should be supported too to keep parity, but I have currently no usecase for it. - --- comments before design units --- might be multiline -context ctx1 is -end context; - --- comments before design units --- might be multiline -configuration cfg1 of e1 is - for a1 - end for; -end configuration; - - -library ieee; -use ieee.std_logic_1164.all; - -entity e2 is - -- comments in design units (python doc-string style) - -- might be multi line - generic ( - -- comment before a generic - -- might be multiline - constant FREQUENCY : positive; - constant BITS : positive; -- comment after a generic are mostly single line, - -- but could be multi line too - -- in case comment is before and after - constant DEBUG : boolean -- the after has presidence - ); - port ( - signal Clock : in std_logic -- same as for generics - ); -end entity; - -architecture a2 of e2 is - -- comments in design units (python doc-string style) - -- might be multi line -begin - -end architecture; - --- As packages define public elements like constants, types and sub-programs, we are intrested in such documentation too. -package p2 is - -- comments in design units (python doc-string style) - -- might be multi line - - -- comment before - constant DEBUG : boolean := TRUE; - constant SYNC_STAGES : positive := 3; -- comment after - - -- comment before - type AType1 is array(natural range <>) of bit; - type AType2 is array(natural range <>) of bit; -- comment after - - -- same applies to subtype, alias, attributes, ... - - -- comment before - type RType is record - -- xor comment inside - - -- per element comment before (note the comment "block" is separated by newlines) - elem1 : integer; - elem2 : integer; -- per element comment behind - end record; - - -- as functions are longer in definitions, it might be written before - function log2(param : positive) return natural; - - function log2( - -- otoh, we also want to document parameters too (similar to a record with comments) - - -- comment before - param1 : integer; - param2 : boolean -- comment after - ) return natural; - - -- this applies to procedures as well. - - - -end package; - -context ctx2 is - -- comments in design units (python doc-string style) - -- might be multi line -end context; - -configuration cfg2 of e2 is - -- comments in design units (python doc-string style) - -- might be multi line - for a2 - end for; -end configuration; - - - - - - - --- This should allow for any kind of documentation style and embedded documentation language. --- A real implementation might use similar rules are Python+docutils+Sphinx. Here we would e.g. --- document a function either before (or inside) a function declaration and use the --- :arg name: description --- syntax. - - --- Package `math` provides math extensions not provided by the IEEE packages. -package math is - -- Computes the logarith to base 2. - -- - -- :arg param: Input value - -- :returns: Logarithm - function log2(param : positive) return natural; -end package; diff --git a/testsuite/pyunit/libghdl/Comments.py b/testsuite/pyunit/libghdl/Comments.py index ff45a8057..ea0bf81ed 100644 --- a/testsuite/pyunit/libghdl/Comments.py +++ b/testsuite/pyunit/libghdl/Comments.py @@ -1,5 +1,6 @@ from pathlib import Path -from unittest import TestCase, skip, expectedFailure +from unittest import TestCase, expectedFailure +from pytest import mark import pyGHDL.libghdl as libghdl from pyGHDL.libghdl import name_table, files_map, errorout_console, flags @@ -12,8 +13,8 @@ if __name__ == "__main__": exit(1) -class Instantiate(TestCase): - _root = Path(__file__).resolve().parent +class Base(TestCase): + _root = Path(__file__).resolve().parent / "examples" @staticmethod def getIdentifier(node) -> str: @@ -39,9 +40,10 @@ class Instantiate(TestCase): f = files_map.Location_To_File(nodes.Get_Location(node)) idx = file_comments.Find_First_Comment(f, node) while idx != file_comments.No_Comment_Index: - s = file_comments.Get_Comment(f, idx) - self.assertTrue(s.find(':'+name+':') >= 0, - f"no :{name}: in '{s}'") + commentText = file_comments.Get_Comment(f, idx) + commentStart = file_comments.Get_Comment_Start(f, idx) + commentEnd = file_comments.Get_Comment_Last(f, idx) + self.assertTrue(commentText.find(':'+name+':') >= 0, f"no :{name}: in [{commentStart}..{commentEnd}] '{commentText}'({len(commentText)})") idx = file_comments.Get_Next_Comment(f, idx) def checkFlist(self, flist) -> None: @@ -126,170 +128,174 @@ class Instantiate(TestCase): designUnit = nodes.Get_Chain(designUnit) + +class CommentAssociation(Base): def test_Comments(self) -> None: """Very first test""" - self.checkFile(self._root / "DesignComment.vhdl") - - @skip("not yet handled") - def test_Comment2(self) -> None: - """More exhaustive""" - self.checkFile(self._root / "Comment2.vhdl") + self.checkFile(self._root / "comments/DesignComment.vhdl") def test_entity_before(self) -> None: - self.checkFile(self._root / "ent_bef.vhdl") + self.checkFile(self._root / "comments/ent_bef.vhdl") def test_arch_before(self) -> None: - self.checkFile(self._root / "arch_bef.vhdl") + self.checkFile(self._root / "comments/arch_bef.vhdl") def test_pkg_before(self) -> None: - self.checkFile(self._root / "pkg_bef.vhdl") + self.checkFile(self._root / "comments/pkg_bef.vhdl") def test_ctxt_before(self) -> None: - self.checkFile(self._root / "ctxt_bef.vhdl") + self.checkFile(self._root / "comments/ctxt_bef.vhdl") def test_conf_before(self) -> None: - self.checkFile(self._root / "conf_bef.vhdl") + self.checkFile(self._root / "comments/conf_bef.vhdl") def test_entity_inside(self) -> None: - self.checkFile(self._root / "ent_inside.vhdl") + self.checkFile(self._root / "comments/ent_inside.vhdl") def test_entity_arch(self) -> None: - self.checkFile(self._root / "ent_arch.vhdl") + self.checkFile(self._root / "comments/ent_arch.vhdl") @expectedFailure def test_arch_inside_fail(self) -> None: - self.checkFile(self._root / "arch_inside_fail.vhdl") + self.checkFile(self._root / "comments/arch_inside_fail.vhdl") def test_arch_inside(self) -> None: - self.checkFile(self._root / "arch_inside.vhdl") + self.checkFile(self._root / "comments/arch_inside.vhdl") @expectedFailure def test_pkg_inside_fail(self) -> None: - self.checkFile(self._root / "pkg_inside_fail.vhdl") + self.checkFile(self._root / "comments/pkg_inside_fail.vhdl") @expectedFailure def test_pkg_inside_fail2(self) -> None: - self.checkFile(self._root / "pkg_inside_fail2.vhdl") + self.checkFile(self._root / "comments/pkg_inside_fail2.vhdl") def test_pkg_inside(self) -> None: - self.checkFile(self._root / "pkg_inside.vhdl") + self.checkFile(self._root / "comments/pkg_inside.vhdl") @expectedFailure def test_ctxt_inside_fail(self) -> None: - self.checkFile(self._root / "ctxt_inside_fail.vhdl") + self.checkFile(self._root / "comments/ctxt_inside_fail.vhdl") def test_ctxt_inside(self) -> None: - self.checkFile(self._root / "ctxt_inside.vhdl") + self.checkFile(self._root / "comments/ctxt_inside.vhdl") @expectedFailure def test_conf_inside_fail(self) -> None: - self.checkFile(self._root / "conf_inside_fail.vhdl") + self.checkFile(self._root / "comments/conf_inside_fail.vhdl") def test_conf_inside(self) -> None: - self.checkFile(self._root / "conf_inside.vhdl") + self.checkFile(self._root / "comments/conf_inside.vhdl") @expectedFailure def test_const_fail(self) -> None: - self.checkFile(self._root / "const_fail.vhdl") + self.checkFile(self._root / "comments/const_fail.vhdl") def test_const(self) -> None: - self.checkFile(self._root / "const.vhdl") + self.checkFile(self._root / "comments/const.vhdl") @expectedFailure def test_sig_fail(self) -> None: - self.checkFile(self._root / "sig_fail.vhdl") + self.checkFile(self._root / "comments/sig_fail.vhdl") def test_sig(self) -> None: - self.checkFile(self._root / "sig.vhdl") + self.checkFile(self._root / "comments/sig.vhdl") def test_sig_2(self) -> None: - self.checkFile(self._root / "sig_2.vhdl") + self.checkFile(self._root / "comments/sig_2.vhdl") @expectedFailure def test_var_fail(self) -> None: - self.checkFile(self._root / "var_fail.vhdl") + self.checkFile(self._root / "comments/var_fail.vhdl") def test_var(self) -> None: - self.checkFile(self._root / "var.vhdl") + self.checkFile(self._root / "comments/var.vhdl") @expectedFailure def test_type_fail(self) -> None: - self.checkFile(self._root / "type_fail.vhdl") + self.checkFile(self._root / "comments/type_fail.vhdl") def test_type(self) -> None: - self.checkFile(self._root / "type.vhdl") + self.checkFile(self._root / "comments/type.vhdl") def test_array(self) -> None: - self.checkFile(self._root / "array.vhdl") + self.checkFile(self._root / "comments/array.vhdl") @expectedFailure def test_record_fail(self) -> None: - self.checkFile(self._root / "record_fail.vhdl") + self.checkFile(self._root / "comments/record_fail.vhdl") def test_record(self) -> None: - self.checkFile(self._root / "record.vhdl") + self.checkFile(self._root / "comments/record.vhdl") @expectedFailure def test_elements_fail(self) -> None: - self.checkFile(self._root / "elements_fail.vhdl") + self.checkFile(self._root / "comments/elements_fail.vhdl") def test_element_1(self) -> None: - self.checkFile(self._root / "element_1.vhdl") + self.checkFile(self._root / "comments/element_1.vhdl") def test_element_2(self) -> None: - self.checkFile(self._root / "element_2.vhdl") + self.checkFile(self._root / "comments/element_2.vhdl") def test_element_3(self) -> None: - self.checkFile(self._root / "element_3.vhdl") + self.checkFile(self._root / "comments/element_3.vhdl") def test_element_4(self) -> None: - self.checkFile(self._root / "element_4.vhdl") + self.checkFile(self._root / "comments/element_4.vhdl") @expectedFailure def test_enum_fail(self) -> None: - self.checkFile(self._root / "enum_fail.vhdl") + self.checkFile(self._root / "comments/enum_fail.vhdl") def test_enum(self) -> None: - self.checkFile(self._root / "enum.vhdl") + self.checkFile(self._root / "comments/enum.vhdl") @expectedFailure def test_enumlit_fail(self) -> None: - self.checkFile(self._root / "enumlit_fail.vhdl") + self.checkFile(self._root / "comments/enumlit_fail.vhdl") def test_enumlit_1(self) -> None: - self.checkFile(self._root / "enumlit_1.vhdl") + self.checkFile(self._root / "comments/enumlit_1.vhdl") def test_enumlit_2(self) -> None: - self.checkFile(self._root / "enumlit_2.vhdl") + self.checkFile(self._root / "comments/enumlit_2.vhdl") def test_enumlit_3(self) -> None: - self.checkFile(self._root / "enumlit_3.vhdl") + self.checkFile(self._root / "comments/enumlit_3.vhdl") @expectedFailure def test_func_fail(self) -> None: - self.checkFile(self._root / "func_fail.vhdl") + self.checkFile(self._root / "comments/func_fail.vhdl") def test_func(self) -> None: - self.checkFile(self._root / "func.vhdl") + self.checkFile(self._root / "comments/func.vhdl") @expectedFailure def test_func_param_fail(self) -> None: - self.checkFile(self._root / "func_param_fail.vhdl") + self.checkFile(self._root / "comments/func_param_fail.vhdl") def test_func_param(self) -> None: - self.checkFile(self._root / "func_param.vhdl") + self.checkFile(self._root / "comments/func_param.vhdl") @expectedFailure def test_process_fail(self) -> None: - self.checkFile(self._root / "process_fail.vhdl") + self.checkFile(self._root / "comments/process_fail.vhdl") def test_process(self) -> None: - self.checkFile(self._root / "process.vhdl") + self.checkFile(self._root / "comments/process.vhdl") def test_multi1(self) -> None: - self.checkFile(self._root / "multi1.vhdl") + self.checkFile(self._root / "comments/multi1.vhdl") def test_line1(self) -> None: - self.checkFile(self._root / "line1.vhdl") + self.checkFile(self._root / "comments/line1.vhdl") + + +class Complex(Base): + @mark.xfail(reason="not yet handled") + def test_Comment2(self) -> None: + """More exhaustive""" + self.checkFile(self._root / "Complex.vhdl") # Empty line before to easy cut & put diff --git a/testsuite/pyunit/libghdl/examples/Complex.vhdl b/testsuite/pyunit/libghdl/examples/Complex.vhdl new file mode 100644 index 000000000..87276a2d5 --- /dev/null +++ b/testsuite/pyunit/libghdl/examples/Complex.vhdl @@ -0,0 +1,132 @@ +-- :e1: comments before desIgn units (javadoc / .net documentation style) +-- :e1: mIGht be multiline +entity e1 is +end entitY; + +-- :a1: comments before design units +-- :a1: might be multiline +architecture a1 of e1 is +begin +end architecture; + +-- :p1: comments before design units +-- :p1: might be multiline +package p1 is +end package; + +-- package body should be supported too to keep parity, but I have currently no usecase for it. + +-- :ctx1: comments before design units +-- :ctx1: might be multiline +context ctx1 is +end context; + +-- :cfg1: comments before design units +-- :cfg1: might be multiline +configuration cfg1 of e1 is + for a1 + end for; +end configuration; + + +library ieee; +use ieee.std_logic_1164.all; + +entity e2 is + -- :e2: comments in design units (python doc-string style) + -- :e2: might be multi line + generic ( + -- :FREQUENCY: comment before a generic + -- :FREQUENCY: might be multiline + constant FREQUENCY : positive; + constant BITS : positive; -- :BITS: comment after a generic are mostly single line, + -- :BITS: but could be multi line too + -- in case comment is before and after + constant DEBUG : boolean -- :DEBUG: the after has presidency + ); + port ( + signal Clock : in std_logic -- :Clock: same as for generics + ); +end entity; + +architecture a2 of e2 is + -- :a2: comments in design units (python doc-string style) + -- :a2: might be multi line +begin + +end architecture; + +-- As packages define public elements like constants, types and sub-programs, we are interested in such documentation too. +package p2 is + -- :p2: comments in design units (python doc-string style) + -- :p2: might be multi line + + -- :DEBUG: comment before + constant DEBUG : boolean := TRUE; + constant SYNC_STAGES : positive := 3; -- :SYNC_STAGES: comment after + + -- :AType1: comment before + type AType1 is array(natural range <>) of bit; + type AType2 is array(natural range <>) of bit; -- :AType2: comment after + + -- same applies to subtype, alias, attributes, ... + + -- :RType: comment before + type RType is record + -- :RType: xor comment inside + + -- :elem1: per element comment before (note the comment "block" is separated by newlines) + elem1 : integer; + elem2 : integer; -- :elem2: per element comment behind + end record; + + -- :log2: as functions are longer in definitions, it might be written before + function log2(param : positive) return natural; + + function log2( + -- :log2: otoh, we also want to document parameters too (similar to a record with comments) + + -- :param1: comment before + param1 : integer; + param2 : boolean -- :param2: comment after + ) return natural; + + -- this applies to procedures as well. + + + +end package; + +context ctx2 is + -- :ctx2: comments in design units (python doc-string style) + -- :ctx2: might be multi line +end context; + +configuration cfg2 of e2 is + -- :cfg2: comments in design units (python doc-string style) + -- :cfg2: might be multi line + for a2 + end for; +end configuration; + + + + + + + +-- This should allow for any kind of documentation style and embedded documentation language. +-- A real implementation might use similar rules are Python+docutils+Sphinx. Here we would e.g. +-- document a function either before (or inside) a function declaration and use the +-- :arg name: description +-- syntax. + + +-- :math: Package `math` provides math extensions not provided by the IEEE packages. +package math is + -- :log2: Computes the logarithm to base 2. + -- :log2: + -- :log2: :arg param: Input value + -- :log2: :returns: Logarithm + function log2(param : positive) return natural; +end package; diff --git a/testsuite/pyunit/libghdl/DesignComment.vhdl b/testsuite/pyunit/libghdl/examples/comments/DesignComment.vhdl index 5cd555d33..5cd555d33 100644 --- a/testsuite/pyunit/libghdl/DesignComment.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/DesignComment.vhdl diff --git a/testsuite/pyunit/libghdl/arch_bef.vhdl b/testsuite/pyunit/libghdl/examples/comments/arch_bef.vhdl index c089b1429..c089b1429 100644 --- a/testsuite/pyunit/libghdl/arch_bef.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/arch_bef.vhdl diff --git a/testsuite/pyunit/libghdl/arch_inside.vhdl b/testsuite/pyunit/libghdl/examples/comments/arch_inside.vhdl index 9e2184df3..9e2184df3 100644 --- a/testsuite/pyunit/libghdl/arch_inside.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/arch_inside.vhdl diff --git a/testsuite/pyunit/libghdl/arch_inside_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/arch_inside_fail.vhdl index 96002d336..96002d336 100644 --- a/testsuite/pyunit/libghdl/arch_inside_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/arch_inside_fail.vhdl diff --git a/testsuite/pyunit/libghdl/array.vhdl b/testsuite/pyunit/libghdl/examples/comments/array.vhdl index 69db03d15..69db03d15 100644 --- a/testsuite/pyunit/libghdl/array.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/array.vhdl diff --git a/testsuite/pyunit/libghdl/conf_bef.vhdl b/testsuite/pyunit/libghdl/examples/comments/conf_bef.vhdl index 0dc3af77e..0dc3af77e 100644 --- a/testsuite/pyunit/libghdl/conf_bef.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/conf_bef.vhdl diff --git a/testsuite/pyunit/libghdl/conf_inside.vhdl b/testsuite/pyunit/libghdl/examples/comments/conf_inside.vhdl index 6181d572a..6181d572a 100644 --- a/testsuite/pyunit/libghdl/conf_inside.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/conf_inside.vhdl diff --git a/testsuite/pyunit/libghdl/conf_inside_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/conf_inside_fail.vhdl index 6b9b4dce3..6b9b4dce3 100644 --- a/testsuite/pyunit/libghdl/conf_inside_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/conf_inside_fail.vhdl diff --git a/testsuite/pyunit/libghdl/const.vhdl b/testsuite/pyunit/libghdl/examples/comments/const.vhdl index 75e22ab51..75e22ab51 100644 --- a/testsuite/pyunit/libghdl/const.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/const.vhdl diff --git a/testsuite/pyunit/libghdl/const_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/const_fail.vhdl index 79b37fec5..79b37fec5 100644 --- a/testsuite/pyunit/libghdl/const_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/const_fail.vhdl diff --git a/testsuite/pyunit/libghdl/ctxt_bef.vhdl b/testsuite/pyunit/libghdl/examples/comments/ctxt_bef.vhdl index f7a8fd31c..f7a8fd31c 100644 --- a/testsuite/pyunit/libghdl/ctxt_bef.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ctxt_bef.vhdl diff --git a/testsuite/pyunit/libghdl/ctxt_inside.vhdl b/testsuite/pyunit/libghdl/examples/comments/ctxt_inside.vhdl index af7fdc37b..af7fdc37b 100644 --- a/testsuite/pyunit/libghdl/ctxt_inside.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ctxt_inside.vhdl diff --git a/testsuite/pyunit/libghdl/ctxt_inside_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/ctxt_inside_fail.vhdl index 71dce9e40..71dce9e40 100644 --- a/testsuite/pyunit/libghdl/ctxt_inside_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ctxt_inside_fail.vhdl diff --git a/testsuite/pyunit/libghdl/element_1.vhdl b/testsuite/pyunit/libghdl/examples/comments/element_1.vhdl index f88219bec..f88219bec 100644 --- a/testsuite/pyunit/libghdl/element_1.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/element_1.vhdl diff --git a/testsuite/pyunit/libghdl/element_2.vhdl b/testsuite/pyunit/libghdl/examples/comments/element_2.vhdl index 324dac9db..324dac9db 100644 --- a/testsuite/pyunit/libghdl/element_2.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/element_2.vhdl diff --git a/testsuite/pyunit/libghdl/element_3.vhdl b/testsuite/pyunit/libghdl/examples/comments/element_3.vhdl index 22f20349e..22f20349e 100644 --- a/testsuite/pyunit/libghdl/element_3.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/element_3.vhdl diff --git a/testsuite/pyunit/libghdl/element_4.vhdl b/testsuite/pyunit/libghdl/examples/comments/element_4.vhdl index 57f5ea16b..57f5ea16b 100644 --- a/testsuite/pyunit/libghdl/element_4.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/element_4.vhdl diff --git a/testsuite/pyunit/libghdl/elements_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/elements_fail.vhdl index 9173524f2..9173524f2 100644 --- a/testsuite/pyunit/libghdl/elements_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/elements_fail.vhdl diff --git a/testsuite/pyunit/libghdl/ent_arch.vhdl b/testsuite/pyunit/libghdl/examples/comments/ent_arch.vhdl index 2283de701..2283de701 100644 --- a/testsuite/pyunit/libghdl/ent_arch.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ent_arch.vhdl diff --git a/testsuite/pyunit/libghdl/ent_bef.vhdl b/testsuite/pyunit/libghdl/examples/comments/ent_bef.vhdl index 0fbf61d22..0fbf61d22 100644 --- a/testsuite/pyunit/libghdl/ent_bef.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ent_bef.vhdl diff --git a/testsuite/pyunit/libghdl/ent_inside.vhdl b/testsuite/pyunit/libghdl/examples/comments/ent_inside.vhdl index 834eaa999..834eaa999 100644 --- a/testsuite/pyunit/libghdl/ent_inside.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/ent_inside.vhdl diff --git a/testsuite/pyunit/libghdl/enum.vhdl b/testsuite/pyunit/libghdl/examples/comments/enum.vhdl index 320f0a7dc..320f0a7dc 100644 --- a/testsuite/pyunit/libghdl/enum.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enum.vhdl diff --git a/testsuite/pyunit/libghdl/enum_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/enum_fail.vhdl index 51ebfac86..51ebfac86 100644 --- a/testsuite/pyunit/libghdl/enum_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enum_fail.vhdl diff --git a/testsuite/pyunit/libghdl/enumlit_1.vhdl b/testsuite/pyunit/libghdl/examples/comments/enumlit_1.vhdl index c9b923051..c9b923051 100644 --- a/testsuite/pyunit/libghdl/enumlit_1.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enumlit_1.vhdl diff --git a/testsuite/pyunit/libghdl/enumlit_2.vhdl b/testsuite/pyunit/libghdl/examples/comments/enumlit_2.vhdl index 44aa71d7d..44aa71d7d 100644 --- a/testsuite/pyunit/libghdl/enumlit_2.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enumlit_2.vhdl diff --git a/testsuite/pyunit/libghdl/enumlit_3.vhdl b/testsuite/pyunit/libghdl/examples/comments/enumlit_3.vhdl index 7f325f549..7f325f549 100644 --- a/testsuite/pyunit/libghdl/enumlit_3.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enumlit_3.vhdl diff --git a/testsuite/pyunit/libghdl/enumlit_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/enumlit_fail.vhdl index 36a200402..36a200402 100644 --- a/testsuite/pyunit/libghdl/enumlit_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/enumlit_fail.vhdl diff --git a/testsuite/pyunit/libghdl/func.vhdl b/testsuite/pyunit/libghdl/examples/comments/func.vhdl index 1c6fc8741..1c6fc8741 100644 --- a/testsuite/pyunit/libghdl/func.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/func.vhdl diff --git a/testsuite/pyunit/libghdl/func_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/func_fail.vhdl index 68ff2b80e..68ff2b80e 100644 --- a/testsuite/pyunit/libghdl/func_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/func_fail.vhdl diff --git a/testsuite/pyunit/libghdl/func_param.vhdl b/testsuite/pyunit/libghdl/examples/comments/func_param.vhdl index fb47687e5..fb47687e5 100644 --- a/testsuite/pyunit/libghdl/func_param.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/func_param.vhdl diff --git a/testsuite/pyunit/libghdl/func_param_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/func_param_fail.vhdl index 53461fdd9..53461fdd9 100644 --- a/testsuite/pyunit/libghdl/func_param_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/func_param_fail.vhdl diff --git a/testsuite/pyunit/libghdl/line1.vhdl b/testsuite/pyunit/libghdl/examples/comments/line1.vhdl index 2a4ed11bc..2a4ed11bc 100644 --- a/testsuite/pyunit/libghdl/line1.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/line1.vhdl diff --git a/testsuite/pyunit/libghdl/multi1.vhdl b/testsuite/pyunit/libghdl/examples/comments/multi1.vhdl index 73eebd5b5..73eebd5b5 100644 --- a/testsuite/pyunit/libghdl/multi1.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/multi1.vhdl diff --git a/testsuite/pyunit/libghdl/pkg_bef.vhdl b/testsuite/pyunit/libghdl/examples/comments/pkg_bef.vhdl index 1ed150346..1ed150346 100644 --- a/testsuite/pyunit/libghdl/pkg_bef.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/pkg_bef.vhdl diff --git a/testsuite/pyunit/libghdl/pkg_inside.vhdl b/testsuite/pyunit/libghdl/examples/comments/pkg_inside.vhdl index c9f6129d4..c9f6129d4 100644 --- a/testsuite/pyunit/libghdl/pkg_inside.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/pkg_inside.vhdl diff --git a/testsuite/pyunit/libghdl/pkg_inside_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail.vhdl index 4b2b9e653..4b2b9e653 100644 --- a/testsuite/pyunit/libghdl/pkg_inside_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail.vhdl diff --git a/testsuite/pyunit/libghdl/pkg_inside_fail2.vhdl b/testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail2.vhdl index f5e347488..f5e347488 100644 --- a/testsuite/pyunit/libghdl/pkg_inside_fail2.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/pkg_inside_fail2.vhdl diff --git a/testsuite/pyunit/libghdl/process.vhdl b/testsuite/pyunit/libghdl/examples/comments/process.vhdl index c0b56fe6e..c0b56fe6e 100644 --- a/testsuite/pyunit/libghdl/process.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/process.vhdl diff --git a/testsuite/pyunit/libghdl/process_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/process_fail.vhdl index 819e5ea6e..819e5ea6e 100644 --- a/testsuite/pyunit/libghdl/process_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/process_fail.vhdl diff --git a/testsuite/pyunit/libghdl/record.vhdl b/testsuite/pyunit/libghdl/examples/comments/record.vhdl index 82d5c1faa..82d5c1faa 100644 --- a/testsuite/pyunit/libghdl/record.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/record.vhdl diff --git a/testsuite/pyunit/libghdl/record_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/record_fail.vhdl index 6288920f7..6288920f7 100644 --- a/testsuite/pyunit/libghdl/record_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/record_fail.vhdl diff --git a/testsuite/pyunit/libghdl/sig.vhdl b/testsuite/pyunit/libghdl/examples/comments/sig.vhdl index ee0865ae4..ee0865ae4 100644 --- a/testsuite/pyunit/libghdl/sig.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/sig.vhdl diff --git a/testsuite/pyunit/libghdl/sig_2.vhdl b/testsuite/pyunit/libghdl/examples/comments/sig_2.vhdl index c825a41e5..c825a41e5 100644 --- a/testsuite/pyunit/libghdl/sig_2.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/sig_2.vhdl diff --git a/testsuite/pyunit/libghdl/sig_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/sig_fail.vhdl index 4630d2877..4630d2877 100644 --- a/testsuite/pyunit/libghdl/sig_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/sig_fail.vhdl diff --git a/testsuite/pyunit/libghdl/type.vhdl b/testsuite/pyunit/libghdl/examples/comments/type.vhdl index 94818ee88..94818ee88 100644 --- a/testsuite/pyunit/libghdl/type.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/type.vhdl diff --git a/testsuite/pyunit/libghdl/type_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/type_fail.vhdl index bb4050103..bb4050103 100644 --- a/testsuite/pyunit/libghdl/type_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/type_fail.vhdl diff --git a/testsuite/pyunit/libghdl/var.vhdl b/testsuite/pyunit/libghdl/examples/comments/var.vhdl index 9be81044f..9be81044f 100644 --- a/testsuite/pyunit/libghdl/var.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/var.vhdl diff --git a/testsuite/pyunit/libghdl/var_fail.vhdl b/testsuite/pyunit/libghdl/examples/comments/var_fail.vhdl index 71689ff59..71689ff59 100644 --- a/testsuite/pyunit/libghdl/var_fail.vhdl +++ b/testsuite/pyunit/libghdl/examples/comments/var_fail.vhdl |