Spexygen Reference Manual 3.0.0
Loading...
Searching...
No Matches
Spexygen

Working with Spexygen

Remarks

About Spexygen

Spexygen is a Doxygen↑ extension for creating traceable technical specifications, such as:

Watch Spexygen video on YouTube
Note
By extending Doxygen with a uniform traceability management not just for source code, but also for all other specifications, Spexygen supports regulatory compliance with functional safety standards such as IEC 61508, IEC 62304, ISO 26262 and others.

Spexygen Features

The main objectives and features of Spexygen are:

  • uniform management of traceability within all documents in the system, including source code
  • provision of commands for creating well-structured, uniformly formatted, fully traceable "work artifacts"
  • automating the generation of forward traceability links in the documentation (Spexygen generates recursive forward traceability enabling impact analysis to identify the potential consequences of a change of a given artifact)
  • automating the generation of brief descriptions for the backward traceability links
  • enabling DRY documentation (designed according to the "Don't Repeat Yourself" principle) by eliminating repetitions in specifying dependencies among "work artifacts"
  • generating cross-linked, searchable, nicely formatted documentation in HTML (the new style introduced in Doxygen 1.14.0)
  • generating cross-linked, nicely formatted documentation in PDF (modern LaTeX template)
  • representing documentation in human-readable text files, which can be stored in any version control system (VCS).

Traceability Types and Relations

Traceability is the cornerstone of any formal documentation system, especially those intended for managing functional safety. It enables product teams to associate every work artifact (e.g., a specific requirement) with all the related project artifacts (e.g., design, code, or tests), both backward and forward. Traceability enables everyone to see how every work artifact relates to the requirement — and vice versa — at any point during development. This ability fosters team collaboration and enables early detection of possible production risks.

The diagram below illustrates the kinds of traceability and the relationships between them. The downstream work artifacts establish backward-traceability to the related upstream artifact by means of the explicitly provided Unique Identifiers (UIDs).

Schematic View of Backward Traceability in the Spexygen documentation.
Note
The Spexygen documentation traceability system includes the source code. This is achieved by placing special backward traceability links, such as @tr{SRS_PRJ_Foo_03} or @tr{free_fun()}, inside the Spexygen documentation for the source code.

Backward Traceability

Backward traceability begins at a specific work artifact and links it to the original artifact. For example, architecture element can be linked with an upstream requirement, or code artifact with the upstream design. Backward traceability gives visibility into why specific artifacts were created and how different pieces of a system fit together. Tracing in this way also allows testers to find gaps or missing work artifacts.

Remarks
Backward traceability is the most natural and efficient way of specifying hierarchical relationships, such as superclass-subclass in object-oriented programming (OOP). Class inheritance is universally represented in the subclasses, which store their superclass (backward traceability). In contrast, superclasses don't show their subclasses (forward traceability). The Spexygen documentation applies this approach to all work artifacts, starting with the requirements at the top, through architecture, design, source code, tests, deviations, etc.

Forward Traceability

Forward traceability begins at the original artifact and links it with all the resulting forward work items. For example, a requirement can be linked with source code elements that implement that requirement. This type of trace ensures that each original artifact (e.g., requirement) is not only satisfied but verified and validated. In the Spexygen documentation the forward traceability is generated automatically by the spexygen.py Python script.

Note
Forward traceability is typically recursive meaning that if artifact A traces to B and B traces to C, then artifact A also traces to C. Spexygen generates recursive forward trace, which enables the teams to perform impact analysis to identify the potential consequences of a change of a given artifact.

Bidirectional Traceability

Bidirectional traceability is the ability to perform both forward and backward traceability. Bidirectional traceability is the optimal type of traceability because it gives teams full visibility from requirements through architecture, design, source code, tests, and back again. The system implemented in the Spexygen documentation provides such bidirectional traceability.

Remarks
The whole system of traceability offered in Spexygen is extensible and can be used in any technical documentation system.

Unique Identifiers (UIDs)

Traceability is enabled by the consistent use of Unique Identifiers (UIDs), which are short text labels associated with all work artifacts, such as requirements, architecture elements, design elements, source code elements, coding standard deviations, tests, functional safety documents, etc.

Note
The structure of UIDs is flexible to accommodate various existing naming conventions. But for compatibility with the widest possible range of cross-referencing systems and tools, the UIDs are restricted to generally follow the rules for identifiers in programming languages, such as identifiers in C, C++, or Python. Specifically, valid UIDs can contain only letters (A..Z, a..z), numbers (0..9), and underscores ('_'). Additionally, UIDs not associated with code can contain dashes ('-'). However, all UIDs should not contain spaces (' '), punctuation ('.', ',', ';'), parentheses ('()', '[]', '{}'), or any special characters like !, ?, @, #, $, etc.
Remarks
The UIDs for source code must follow the Doxygen↑ standard for referencing code elements, such as classes, functions, macros, namespaces, types, etc. This enables extending the bi-directional traceability to code. Additionally, such UIDs become searchable with the Doxygen built-in search (the "Search Box").

Work Artifact UIDs

The most important feature of UIDs is their uniqueness within the whole system under consideration. To avoid name conflicts, it is advantageous to establish general rules for constructing the UIDs. Throughout Spexygen documentation, the UIDs have the hierarchical structure consisting of fields separated by underscores and/or dashes:

 +------------------ [1] Work artifact type (e.g., 'SRS' for Software
 |                       Requirement Specification)
 |  +--------------- [2] Component unique identifier (e.g, 'QP' for QP Framework)
 |  |   +----------- [3] Work artifact ID (abbreviation or number)
 |  |   |  +-------- [4] Work artifact number
 |  |   |  |   +---- [5] Optional variant letter ('A', 'B', 'C'...)
 |  |   |  |   |+--- [6] Optional version number (1, 2, 3...)
 |  |   |  |   ||
SRS_xx_yyy_zz[-A2]

Examples:

The various fields in the UID are as follows:

[1] the UID starts with a field corresponding to the document type. This helps to immediately identify the document where the UID is defined. Here are some suggestions for the document types:

  • CTR Concepts, Terminology, & References
  • FSM Functional Safety Management Plan
  • HARA Hazard Analysis and Risk Assessment
  • MISRA MISRA Compliance Report
  • SAS Software Architecture Specification
  • SCM Software Configuration Management
  • SDS Software Design Specification
  • SMR Software Metrics Report
  • SRS Software Requirements Specification
  • SSC Software Safety Case
  • SSM Software Safety Manual
  • SSRS Software Safety Requirements Specification
  • STP Software Test Plan
  • TQR Tool Qualification Report
  • ... Other UID types...
Attention
The type filed of the UID should be carefully chosen to allow filtering and cross-referencing artifacts of various types. For example, requirements traceability matrix (often needed for compliance with functional safety standards) is a relationship between the requirements (type SRS) and various other work items (e.g., tests, TUN, TIN, or TAC).

[2] the Component Unique Identifier (CUI) denotes the component addressed by this UID, which should be unique enough to avoid name conflicts with other software components in a larger system (e.g., whole application). Here are some examples of component IDs, but the intent is to extend this list to other components as well:

  • QP QP Framework — the safety-related software component
  • ... Other software component

[3] the "Work artifact kind" field identifies the kind of the artifact. Its meaning is local to the document type in field [1]: each document that defines item-level UIDs specifies its own set of artifact-kind tokens in its own "UID structure"/"Document Conventions" subsection. Here are some suggestions for UID kinds:

  • REQ Requirement
  • SREQ Safety Requirement
  • ARCH Architecture element
  • DES Design element
  • ASR, AOU Assumed Safety Requirement / Assumption of Use
  • SHR, CHR, CFM, SUS System/Component Hazard Item, Component Failure Mode, System Unsafe Use Scenario
  • DVP, DVR Deviation Permit / Deviation Record
  • TUN, TIN Test (Unit) / Test (Integration)
  • ... see each document's own UID-structure subsection for its complete, authoritative list.
Note
The kind field of the UID should be carefully chosen to allow filtering and cross-referencing artifacts of various types. For example, requirements traceability matrix (often needed for compliance with functional safety standards) is a relationship between the requirements (type REQ) and various other work items (e.g., tests, TUN, TIN, or TAC).

[4] "Work artifact group" field identifies the aspect of the work artifact. This is the most flexible part in the UID to accommodate other existing conventions, such as MISRA deviations, the work artifact group field should be easily identifiable with the MISRA Rule/Directive ID, such as D04_01 for "Directive 4.1", or R10_04 for "Rule 10.4". Still, please note that the more structured UID convention of using two-digits for feature groups (e.g., D04_10 instead of D4_10) provide additional benefits, such as correct order under a simple alphabetical sort. This property is missing in the original MISRA IDs (e.g., a simple alphabetical sort will place Rule 10.8 before Rule 8.10).

[5] "Work artifact number" field distinguishes the artifact within the group, or when no group is used, within the artifact kind.

[6] optionally, the UID might contain a variant letter ('A', 'B', 'C',...)

Code Artifact UIDs

Alternatively, UIDs of code elements follow the rules established by Doxygen, with the following general form:

     +-------------- [1] Namespace (e.g., class or module)
     |          +--- [2] element (e.g., attribute or operation)
     |          |
[namespace]_[element]

Examples: