aboutsummaryrefslogtreecommitdiffstats
path: root/doc/development
diff options
context:
space:
mode:
author1138-4EB <1138-4EB@users.noreply.github.com>2019-11-11 18:46:36 +0000
committertgingold <tgingold@users.noreply.github.com>2019-11-11 19:46:36 +0100
commit8599d9ddd15b15afdeced6059b1e1b7a972f4db1 (patch)
tree499b9c6fe0f85ce7ed221f72ac31036eefde0194 /doc/development
parent22775978be88c5ea8e5b740734e42eeb2fef0968 (diff)
downloadghdl-8599d9ddd15b15afdeced6059b1e1b7a972f4db1.tar.gz
ghdl-8599d9ddd15b15afdeced6059b1e1b7a972f4db1.tar.bz2
ghdl-8599d9ddd15b15afdeced6059b1e1b7a972f4db1.zip
Update doc (#1003)
* doc: update makefile and build scripts * actions: add workflow 'doc' * doc: reorganize sections * doc: fix 'unknown option' warnings, headings, spaces, etc. * doc: add subdir 'examples', move 'quick_start' sources * doc: add section 'Development/Debugging' * doc: add section'Development/Synthesis' * doc: update roadmap * doc: add section examples * doc: use standard domain * doc: add comment about 'vhd' vs 'vhdl'
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/CodingStyle.rst238
-rw-r--r--doc/development/Debugging.rst75
-rw-r--r--doc/development/Roadmap.rst26
-rw-r--r--doc/development/Synthesis.rst8
4 files changed, 347 insertions, 0 deletions
diff --git a/doc/development/CodingStyle.rst b/doc/development/CodingStyle.rst
new file mode 100644
index 000000000..cef9eb993
--- /dev/null
+++ b/doc/development/CodingStyle.rst
@@ -0,0 +1,238 @@
+.. _DEV:Style:
+
+Coding Style
+############
+
+Ada
+===
+
+Ada subset: use only a simple (VHDL like) subset of Ada: no tasking, no
+controlled types... VHDL users should easily understand that subset.
+Allowed Ada95 features: the standard library, child packages.
+Use assertions.
+
+We try to follow the 'GNU Coding Standards' when possible: comments before
+declarations, one space at the end of sentences, finish sentences with a dot.
+But: 2 spaces for indentation in code blocks.
+
+No trailing spaces, no TAB (HT).
+
+Subprograms must have a comment before to describe them, like:
+
+.. code-block:: Ada
+
+ -- Analyze the concurrent statements of PARENT.
+ procedure Sem_Concurrent_Statement_Chain (Parent : Iir);
+
+The line before the comment must be a blank line (unless this is the first
+declaration). Don't repeat the comment before the subprogram body.
+
+* For subprograms:
+
+ 1. Declare on one line when possible:
+
+ .. code-block:: Ada
+
+ function Translate_Static_Aggregate (Aggr : Iir) return O_Cnode
+
+ 2. If not possible, put the return on the next line:
+
+ .. code-block:: Ada
+
+ function Translate_Static_String (Str_Type : Iir; Str_Ident : Name_Id)
+ return O_Cnode
+
+ 3. If not possible, put parameters and return on the next line:
+
+ .. code-block:: Ada
+
+ function Create_String_Literal_Var_Inner
+ (Str : Iir; Element_Type : Iir; Str_Type : O_Tnode) return Var_Type
+
+ 4. If not possible, return on the next line:
+
+ .. code-block:: Ada
+
+ function Translate_Shortcut_Operator
+ (Imp : Iir_Implicit_Function_Declaration; Left, Right : Iir)
+ return O_Enode
+
+ 5. If not possible, one parameter per line, just after subprogram name:
+
+ .. code-block:: Ada
+
+ procedure Translate_Static_Aggregate_1 (List : in out O_Array_Aggr_List;
+ Aggr : Iir;
+ Info : Iir;
+ El_Type : Iir)
+
+ 6. If not possible, add a return after subprogram name:
+
+ .. code-block:: Ada
+
+ function Translate_Predefined_TF_Array_Element
+ (Op : Predefined_Boolean_Logical;
+ Left, Right : Iir;
+ Res_Type : Iir;
+ Loc : Iir)
+ return O_Enode
+
+ 7. If not possible, ask yourself what is wrong! Shorten a name.
+
+* Rule for the 'is': on a new line only if the declarative part is not empty:
+
+ .. code-block:: Ada
+
+ procedure Translate_Assign (Target : Mnode; Expr : Iir; Target_Type : Iir)
+ is
+ Val : O_Enode;
+ begin
+
+ vs.
+
+ .. code-block:: Ada
+
+ function Translate_Static_Range_Dir (Expr : Iir) return O_Cnode is
+ begin
+
+ If the parameter line is too long with the 'is', put in on a separate line:
+
+ .. code-block:: Ada
+
+ procedure Predeclare_Scope_Type
+ (Scope : in out Var_Scope_Type; Name : O_Ident) is
+
+* Generic instantiation: put the generic actual part on a new line:
+
+ .. code-block:: Ada
+
+ procedure Free is new Ada.Unchecked_Deallocation
+ (Action_List, Action_List_Acc);
+
+* For if/then statement:
+
+ 1. 'then' on the same line:
+
+ .. code-block:: Ada
+
+ if Get_Expr_Staticness (Decl) = Locally then
+
+ 2. If not possible, 'then' is alone on its line aligned with the 'if':
+
+ .. code-block:: Ada
+
+ if Expr = Null_Iir
+ or else Get_Kind (Expr) = Iir_Kind_Overflow_Literal
+ then
+
+ 3. For a multiline condition, 'or else' and 'and then' should start lines.
+
+* 'Local' variable declaration:
+ Do not initialize variables, constants must be declared before variables:
+
+ .. code-block:: Ada
+
+ is
+ N_Info : constant Iir := Get_Sub_Aggregate_Info (Info);
+ Assoc : Iir;
+ Sub : Iir;
+ begin
+
+ If the initialization expression has a side effect (such as allocation), do
+ not use a constant.
+
+Shell
+=====
+
+Ubuntu uses `dash` instead of `bash` when a shell script is run. As a result, some functionalities, such as arrays like
+``array[1]``, are not supported. Therefore, build scripts in `dist/linux` should not use those functionalities unless
+they are sourced in a `bash` shell. The same applies to the scripts in `testsuite`.
+
+Guidelines to edit the documentation
+====================================
+
+ 1) It’s better for version control systems and diff tools to break lines at a sensible number of characters. Long lines appear as one diff. Also merging is more complex because merges are line based. Long unbreakable items may be longer (links, refs, etc.). We chose to use 160 chars.
+ 2) Please indent all directive content by 3 spaces (not 2, and no tabs).
+ 3) Please use ``*`` as an itemize character, since ``-`` and ``+`` are supported by docutils, but not officially supported by Sphinx.
+ 4) Please underline all headlines with at least as many characters as the headline is long. Following the Python pattern for headlines the levels are:
+
+ .. code::
+
+ ############
+ ************ (sometimes skipped in small documents)
+ ============
+ -------------------
+ ‘’’’’’’’’’’’’’’’’’’’’’’’
+
+ 5) It’s not required to write
+
+ .. code::
+
+ :samp:`code`
+
+ The default role for
+
+ .. code::
+
+ ``code``
+
+ is samp. ``:samp:`` is only required when you want to write italic text in code text.
+
+ .. code::
+
+ :samp:`print 1+{variable}`
+
+ Now, variable becomes italic.
+
+ Please simplify all usages of ``:samp:`code``` to ````code```` for readability. Here are the regular expressions for an editor like Notepad++:
+
+ - Search pattern:: :samp:`(.+?)`
+ - Replace pattern:: ``\1``
+
+ 6) Each backend has one folder and each platform/compiler has one file. Please note that page headlines are different from ToC headline:
+
+ .. code::
+
+ .. toctree::
+ :hidden:
+
+ ToC entry <file1>
+ file2
+
+ 7) Documentation should not use “you”, “we”, …, because it’s not an interactive conversation or informal letter. It’s like a thesis, everything is structured and formal. However, to make it more friendly to newcomers, we agree to allow informal language in the section :ref:`USING:QuickStart`.
+
+ 8) Please keep errors to a minimum.
+
+Guidelines to edit section 'Building'
+-------------------------------------
+
+We prefer a text block, which explains how a compilation works, what we can configure for that backend, etc. After that, we prefer a code block with e.g. bash instructions on how to compile a backend. A list of instructions with embedded bash lines is not helpful. An experienced, as well as novice user, would like to copy a set of instructions into the shell. But it should be stated what these instructions will do. Complex flows like for GCC, can be split into multiple shell code blocks. Moreover, we find it essential to demonstrate when and where to change directories.
+
+We would like to see a list like:
+
+* gcc (Gnu Compiler Collection)
+* gcc-gnat (Ada compiler for GCC)
+* llvm-del (LLVM development package)
+* ...
+
+The goal is also to explain what a user is installing and what the few lines in the build description do. Now they know the name, can search for similar names if they have another package manager or distro or can ask Google/Wikipedia. We often find many build receipts with cryptic shell code and to execute this unknown stuff with sudo is not comfortable. We would like to know what it does before hitting enter.
+
+Documentation configuration
+===========================
+
+* Python snippet for Sphinx's `conf.py` to extract the current version number from Git (latest tag name). [:ghdlsharp:`200`, :ghdlsharp:`221`]
+
+* Reference ``genindex.html`` from the navigation bar. [:ghdlsharp:`200`]
+
+* Create "parts" (LaTeX terminology / chapter headlines) in navigation bar. [:ghdlsharp:`200`]
+
+* Intersphinx files [:ghdlsharp:`200`]
+ * To decompress the inventory file: `curl -s http://ghdl.readthedocs.io/en/latest/objects.inv | tail -n+5 | openssl zlib -d`. From `how-to-uncompress-zlib-data-in-unix <http://unix.stackexchange.com/questions/22834/how-to-uncompress-zlib-data-in-unix>`_.
+ * External ref and link to section::
+
+ :ref:`GHDL Roadmap <ghdl:CHANGE:Roadmap>`
+
+ * External ref to option (no link)::
+
+ :ghdl:option:`--ieee`
+ :option:`ghdl:--ieee`
diff --git a/doc/development/Debugging.rst b/doc/development/Debugging.rst
new file mode 100644
index 000000000..9957b1694
--- /dev/null
+++ b/doc/development/Debugging.rst
@@ -0,0 +1,75 @@
+.. _DEV:Debugging:
+
+Debugging
+#########
+
+Simulation and runtime debugging options
+========================================
+
+Besides the options described in :ref:`GHDL:options`, `GHDL` passes any debugging options (those that begin with
+``-g``) and optimizations options (those that begin with ``-O`` or ``-f``) to `GCC`. Refer to the `GCC` manual for
+details. Moreover, some debugging options are also available, but not described here. The :option:`--help` option lists
+all options available, including the debugging ones.
+
+.. option:: --trace-signals
+
+ Display signals after each cycle.
+
+.. option:: --trace-processes
+
+ Display process name before each cycle.
+
+.. option:: --stats
+
+ Display run-time statistics.
+
+.. option:: --disp-order
+
+ Display signals order.
+
+.. option:: --disp-sources
+
+ Display sources while displaying signals.
+
+.. option:: --disp-sig-types
+
+ Display signal types.
+
+.. option:: --disp-signals-map
+
+ Display map bw declared signals and internal signals.
+
+.. option:: --disp-signals-table
+
+ Display internal signals.
+
+.. option:: --checks
+
+ Do internal checks after each process run.
+
+.. option:: --activity=<LEVEL>
+
+ Watch activity of LEVEL signals: LEVEL is ``all``, ``min`` (default) or ``none`` (unsafe).
+
+.. option:: --dump-rti
+
+ Dump Run Time Information (RTI).
+
+.. option:: --bootstrap
+
+ Allow ``--work=std``
+
+GNU Debugger (GDB)
+------------------
+
+.. index:: `__ghdl_fatal`
+
+.. WARNING:: Debugging VHDL programs using `GDB` is possible only with GCC/LLVM.
+
+GDB is a general purpose debugger for programs compiled by GCC. Currently, there is no VHDL support for GDB. It may be difficult to inspect variables or signals in GDB. However, it is still able to display the stack frame in case of error or to set a breakpoint at a specified line.
+
+GDB can be useful to catch a runtime error, such as indexing an array beyond its bounds. All error check subprograms call the ``__ghdl_fatal`` procedure. Therefore, to a catch runtime error, set a breakpoint like this::
+
+ (gdb) break __ghdl_fatal
+
+When the breakpoint is hit, use the ``where`` or ``bt`` command to display the stack frames.
diff --git a/doc/development/Roadmap.rst b/doc/development/Roadmap.rst
new file mode 100644
index 000000000..799ec7cbc
--- /dev/null
+++ b/doc/development/Roadmap.rst
@@ -0,0 +1,26 @@
+.. _DEV:Roadmap:
+
+Roadmap | Future Improvements
+#############################
+
+We have several axes for `GHDL` improvements:
+
+* Synthesis
+* Full support of VHDL-2008
+* Optimization (simulation speed)
+* Better diagnostics messages (warning and error)
+* Graphical tools (to see waves and to debug)
+* Style checks
+* VITAL acceleration
+
+* Documentation
+
+ * Development/Synthesis. Synthesis, ghdlsynth-beta, formal verification, etc. Copy the 'Usage' section from ghdlsynth's README (https://github.com/1138-4EB/ghdlsynth-beta#usage).
+ * Development/libghdl. How to interact with GHDL through ``libghdl`` and/or ``libghdl-py``.
+ * Development/Related Projects. Brief discussion about similarities/differences with other open source projects such as rust_hdl or pyVHDLParser.
+ * Usage/Docker. Probably copy/convert :file:`README.md` and :file:`USE_CASES.md` in ghdl/docker :ghdlsharp:`166`.
+ * Usage/Language Server.
+ * Usage/Examples/Coverage. Code coverage in GHDL is a side effect of using GCC as a backend. In the future, GCC backend support might be dropped in favour of mcode and LLVM. To do so, code coverage with LLVM should be supported first. Anyway, comments/bits of info should be gathered somewhere in the docs, along with references to gcov, lcov, etc.
+ * Usage/Examples/UART. Dossmatik's UART and unisim guides. We have ``*.doc`` sources to be converted to Sphinx.
+ * Usage/Examples/Free Range VHDL. https://github.com/fabriziotappero/Free-Range-VHDL-book
+ * It is possible to add waveforms with wavedrom, since there is a sphinx extension available.
diff --git a/doc/development/Synthesis.rst b/doc/development/Synthesis.rst
new file mode 100644
index 000000000..bcd23ff70
--- /dev/null
+++ b/doc/development/Synthesis.rst
@@ -0,0 +1,8 @@
+.. _DEV:Synthesis:
+
+Synthesis
+#########
+
+There is an experimental command (``--synth``) to generate RTL netlists (the format, VHDL or EDIF, is yet to be defined) from synthesisable code. For command ``--synth`` to be available, GHDL must be configured/built with option ``--enable-synth`` (GCC 8.1>= required, due to some new GNAT features which are only available in recent releases). Since this is a proof-of-concept, the output is mostly a dump of an internal structure for now. Therefore, it is not very useful, except for debugging.
+
+Moreover, `ghdlsynth <https://github.com/tgingold/ghdlsynth-beta>`_ is a complementary repository that lets GHDL to be loaded by `yosys <http://www.clifford.at/yosys/>`_ as a frontend plugin module, in order to generate bitstreams for some FPGA devices.