Appendix B: Work Product Templates

This appendix contains ASPICE-compliant templates for all major work products referenced in this book. Each template is designed for direct use in your projects — simply copy, customize, and apply to your specific context.


1. Software Requirements Specification (SRS)

Process: SWE.1 Template File: SRS_Template.md

# Software Requirements Specification
## [PROJECT_NAME] - [COMPONENT_NAME]

**Document ID**: SRS-[COMPONENT]-001
**Version**: 1.0
**Date**: YYYY-MM-DD
**Author**: [Name]
**Approver**: [Name]
**Status**: Draft | Review | Approved | Baseline

*Status Workflow*: Draft -> Review -> Approved -> Baseline (changes require CCB)

---

## 1. Introduction

### 1.1 Purpose
[Describe the purpose of this SRS document]

### 1.2 Scope
[Define the scope of the software component]

### 1.3 Definitions and Acronyms
| Term | Definition |
|------|------------|
| ACC  | Adaptive Cruise Control |
| ASIL | Automotive Safety Integrity Level |

### 1.4 References
| ID | Document | Version | Link |
|----|----------|---------|------|
| [SYS-REQ-001] | System Requirements Specification | 2.0 | [DOORS: SYS-REQ-001](doors://module/SYS-REQ-001) |
| [ISO-26262] | ISO 26262 Road Vehicles Functional Safety | 2018 | External standard |

*Link Format*: Use `doors://module/ID` for DOORS, `polarion://project/ID` for Polarion, or relative paths for local files.

---

## 2. Overall Description

### 2.1 Product Perspective
[Describe how this software fits into the larger system]

### 2.2 Product Functions
[High-level summary of major functions]

### 2.3 User Characteristics
[Describe the intended users/systems]

### 2.4 Constraints
- **Hardware**: [e.g., Infineon AURIX TC397, 4MB Flash, 768KB RAM]
- **Standards**: [e.g., MISRA C:2012, AUTOSAR 4.4.0]
- **Safety**: [e.g., ASIL-B per ISO 26262]

---

## 3. Functional Requirements

### 3.1 [Feature 1]

#### [SWE-001] Requirement Title
**Description**: The software shall [specific, measurable requirement]

**Rationale**: [Why this requirement exists]

**Acceptance Criteria**:
- [ ] Criterion 1
- [ ] Criterion 2

**Traceability**:
- **Derives from**: [SYS-045]
- **Verified by**: [TC-SWE-001-1], [TC-SWE-001-2]

**Priority**: High | Medium | Low
**Safety Class**: ASIL-B
**Status**: Approved

---

#### [SWE-002] Next Requirement
[Continue pattern...]

---

## 4. Non-Functional Requirements

### 4.1 Performance

#### [SWE-100] Real-Time Performance
**Description**: The control loop shall execute at 50ms cycle time (20 Hz)

**Acceptance Criteria**:
- [ ] Maximum jitter < 5ms
- [ ] Worst-case execution time (WCET) < 40ms

**Traceability**:
- **Derives from**: [SYS-200]
- **Verified by**: [TC-PERF-001]

### 4.2 Reliability

#### [SWE-101] Fault Detection Time
[Continue pattern...]

### 4.3 Safety

#### [SWE-102] Fail-Safe Behavior
[Continue pattern...]

---

## 5. Interface Requirements

### 5.1 Hardware Interfaces

#### [SWE-200] CAN Interface
**Description**: Software shall communicate via CAN 2.0B at 500 kbps

**Messages**:
| ID | Name | Period | Signals |
|----|------|--------|---------|
| 0x200 | Radar_Distance | 50ms | distance, velocity |
| 0x201 | ACC_Status | 100ms | enabled, set_speed |

### 5.2 Software Interfaces

#### [SWE-201] AUTOSAR BSW Interface
[Define interfaces to Basic Software]

---

## 6. Traceability Matrix

| Software Req | System Req | Test Cases |
|--------------|------------|------------|
| [SWE-001] | [SYS-045] | [TC-001], [TC-002] |
| [SWE-002] | [SYS-046] | [TC-003] |

---

## 7. Approval

| Role | Name | Signature | Date |
|------|------|-----------|------|
| Author | [Name] | | |
| Reviewer | [Name] | | |
| Approver | [Name] | | |


2. Architecture Decision Record (ADR)

Process: SWE.2 Template File: ADR-XXX-Template.md

# ADR-XXX: [Decision Title]

**Date**: YYYY-MM-DD
**Status**: Proposed | Accepted | Superseded
**Author**: [Name]
**Reviewers**: [Names]

---

## Context

[Describe the technical context and the problem that needs a decision]

**Background**:
- [Relevant background information]
- [Constraints or requirements driving this decision]

**Problem Statement**:
[Clear statement of the problem to be solved]

---

## Decision

We will [state the decision clearly and concisely].

---

## Options Considered

### Option 1: [Name] (SELECTED / REJECTED)

**Description**: [Detailed description]

**Pros**:
- [PASS] [Advantage 1]
- [PASS] [Advantage 2]

**Cons**:
- [FAIL] [Disadvantage 1]
- [FAIL] [Disadvantage 2]

**Metrics**:
| Criterion | Value | Threshold | Pass? |
|-----------|-------|-----------|-------|
| Performance | 20ms | ≤50ms | [PASS] |
| Memory | 150KB | ≤200KB | [PASS] |
| Cost | €0 | ≤€10k | [PASS] |

---

### Option 2: [Name] (SELECTED / REJECTED)

[Same structure as Option 1]

---

### Option 3: [Name] (SELECTED / REJECTED)

[Same structure as Option 1]

---

## Rationale

We selected **Option [X]** because:
1. [Primary reason]
2. [Secondary reason]
3. [Supporting reason]

**Trade-offs Accepted**:
- [What we're giving up]
- [What we're gaining]

---

## Consequences

### Positive
- [Benefit 1]
- [Benefit 2]

### Negative
- [Risk 1 and mitigation]
- [Limitation 1 and workaround]

### Risks
| Risk | Probability | Impact | Mitigation |
|------|-------------|--------|------------|
| [Risk 1] | Medium | High | [Mitigation plan] |

---

## Implementation Notes

**Affected Components**:
- [Component 1]: [What changes]
- [Component 2]: [What changes]

**Dependencies**:
- [Dependency 1]
- [Dependency 2]

**Timeline**:
- **Implementation**: 2 weeks
- **Testing**: 1 week
- **Review**: 3 days

---

## References

- [SYS-045] System Requirements Specification
- [ISO 26262-6] Software Development
- [Related ADR-005] Sensor Fusion Architecture

---

## Approval

| Role | Name | Signature | Date |
|------|------|-----------|------|
| Architect | [Name] | | |
| Safety Engineer | [Name] | | |
| Manager | [Name] | | |

3. Test Specification

Process: SWE.4 Template File: Test_Spec_Template.md

# Test Specification
## [COMPONENT_NAME] Unit Tests

**Document ID**: TS-[COMPONENT]-001
**Version**: 1.0
**Date**: YYYY-MM-DD
**Test Level**: Unit | Integration | System
**Safety Class**: ASIL-B

---

## 1. Test Overview

### 1.1 Scope
[What is being tested]

### 1.2 Test Environment
- **Hardware**: [e.g., dSPACE SCALEXIO HIL]
- **Software**: [e.g., Google Test 1.14.0]
- **Compiler**: [e.g., GCC ARM 11.3.1]

### 1.3 Coverage Goals
- **Statement Coverage**: 100% (ASIL-B requirement)
- **Branch Coverage**: 100%
- **MC/DC Coverage**: 100% for safety functions

---

## 2. Test Cases

### TC-SWE-001-1: [Test Name]

**Objective**: Verify [what is being verified]

**Traceability**:
- **Verifies**: [SWE-001] Requirement Title
- **Implements**: BP4 of SWE.4

**Preconditions**:
- [Precondition 1]
- [Precondition 2]

**Test Steps**:
1. [Step 1]
2. [Step 2]
3. [Step 3]

**Input Data**:
| Parameter | Value | Unit |
|-----------|-------|------|
| distance_input | 50.0 | meters |
| velocity_input | 80.0 | km/h |

**Expected Result**:
- [Expected behavior 1]
- [Expected output 1]

**Actual Result**: [To be filled during execution]

**Pass/Fail**: [ ] Pass [ ] Fail

**Automated**: [PASS] Yes (Google Test)

**Code Reference**:
```cpp
TEST_F(ACC_ControllerTest, TC_SWE_001_1_TypicalDistance) {
    // @verifies [SWE-001]
    float distance = 50.0f;
    float result = ACC_CalculateSafeDistance(distance, 80.0f);
    EXPECT_NEAR(result, 44.4f, 0.1f);  // 2-second gap at 80 km/h
}

TC-SWE-001-2: [Boundary Test]

[Same structure as TC-SWE-001-1]


TC-SWE-001-3: [Error Case]

[Same structure as TC-SWE-001-1]


3. Test Coverage Matrix

Requirement Test Cases Coverage %
[SWE-001] TC-001-1, TC-001-2, TC-001-3 100%
[SWE-002] TC-002-1, TC-002-2 100%

4. Test Execution Summary

Execution Date: [Date] Executed By: [Name]

Test Case Result Duration Notes
TC-SWE-001-1 PASS 15ms
TC-SWE-001-2 PASS 12ms
TC-SWE-001-3 PASS 18ms

Overall Pass Rate: 100%


5. Defects Found

ID Test Case Description Severity Status
DEF-001 TC-SWE-005-2 Boundary overflow Critical Fixed

6. Approval

Role Name Signature Date
Test Engineer [Name]
QA Lead [Name]

---

## 4. Code Review Checklist

**Process**: SUP.2
**Template File**: `Code_Review_Checklist.md`

```markdown
# Code Review Checklist
## ASPICE SUP.2 Compliance

**Pull Request**: #[NUMBER]
**Component**: [Name]
**Author**: [Name]
**Reviewer**: [Name]
**Date**: YYYY-MM-DD
**Safety Class**: ASIL-B

---

## 1. General Code Quality

- [ ] Code compiles without warnings (-Wall -Wextra)
- [ ] Code follows project naming conventions
- [ ] Code is properly formatted (clang-format applied)
- [ ] No dead code or commented-out blocks
- [ ] No TODO/FIXME comments without tickets

---

## 2. MISRA C:2012 Compliance

- [ ] PC-lint Plus report shows 0 violations
- [ ] All Required rules are satisfied
- [ ] Deviations are documented with justification
- [ ] No use of forbidden functions (malloc, strcpy, etc.)

---

## 3. Documentation

- [ ] All functions have Doxygen headers
- [ ] All functions have @implements tags
- [ ] Complex algorithms have inline comments
- [ ] Header file has file-level Doxygen comment
- [ ] README updated if public API changed

---

## 4. Error Handling

- [ ] All pointer parameters are checked for NULL
- [ ] All return codes are checked
- [ ] Error paths are tested
- [ ] Resource cleanup on error paths (no memory leaks)
- [ ] No use of assert() (forbidden in production code)

---

## 5. Safety

- [ ] Safety-critical functions identified
- [ ] Fail-safe behavior implemented
- [ ] Plausibility checks on sensor inputs
- [ ] Watchdog refresh is present
- [ ] No use of dynamic memory allocation

---

## 6. Testing

- [ ] Unit tests pass (100% pass rate)
- [ ] Code coverage ≥ 100% for ASIL-B
- [ ] All test cases have @verifies tags
- [ ] Boundary conditions tested
- [ ] Error injection tests present

---

## 7. Traceability

- [ ] All requirements have @implements tags
- [ ] Traceability matrix updated
- [ ] No orphan code (all code traces to requirement)

---

## 8. Performance

- [ ] Real-time constraints met (WCET analysis)
- [ ] No busy-wait loops
- [ ] Memory usage within budget
- [ ] Stack usage analyzed (no recursion)

---

## 9. Security (if applicable)

- [ ] No hard-coded credentials
- [ ] Input validation for external data
- [ ] Buffer overflow protection
- [ ] CWE top 25 reviewed

---

## Decision

- [ ] **APPROVE** - Ready to merge
- [ ] **APPROVE WITH COMMENTS** - Merge after minor fixes
- [ ] **REQUEST CHANGES** - Rework required

**Comments**:
[Detailed feedback]

**Reviewer Signature**: _______________
**Date**: _______________

5. Software Release Notes

Process: MAN.3 Template File: Release_Notes_Template.md

# Release Notes
## [PROJECT_NAME] v[X.Y.Z]

**Release Date**: YYYY-MM-DD
**Release Type**: Major | Minor | Patch
**ASPICE Level**: CL2
**Safety Class**: ASIL-B

---

## Summary

[Brief 2-3 sentence summary of this release]

---

## What's New

### Features
- **[FEATURE-001]**: [Description] ([SYS-045])
- **[FEATURE-002]**: [Description] ([SYS-046])

### Enhancements
- **[ENH-001]**: [Description]
- **[ENH-002]**: [Description]

### Bug Fixes
- **[FIX-001]**: Fixed [issue description] ([DEF-123])
- **[FIX-002]**: Fixed [issue description] ([DEF-124])

---

## Requirements Implemented

| Requirement ID | Title | Verification |
|----------------|-------|--------------|
| [SWE-001] | Maintain Set Speed | 6 test cases, PASS |
| [SWE-002] | Safe Following Distance | 8 test cases, PASS |

**Total Requirements**: 45
**Test Cases**: 182
**Pass Rate**: 100%

---

## Quality Metrics

| Metric | Value | Target | Status |
|--------|-------|--------|--------|
| Code Coverage | 100% | 100% | [PASS] |
| MISRA Violations | 0 | 0 | [PASS] |
| Defect Density | 0.8/KLOC | <2/KLOC | [PASS] |
| Complexity (avg) | 5.2 | <10 | [PASS] |

---

## Known Issues

| ID | Description | Workaround | Target Fix |
|----|-------------|------------|------------|
| [ISSUE-001] | [Minor display issue] | [Workaround] | v1.2.0 |

---

## Upgrade Instructions

### Prerequisites
- [Prerequisite 1]
- [Prerequisite 2]

### Steps
1. [Step 1]
2. [Step 2]
3. [Step 3]

### Rollback Procedure
[Instructions to rollback if needed]

---

## Compatibility

| Component | Min Version | Max Version |
|-----------|-------------|-------------|
| AUTOSAR BSW | 4.4.0 | 4.4.x |
| ECU Hardware | TC397 Rev B | TC397 Rev D |

---

## Documentation

- [Software Requirements Specification v2.1](docs/SRS_v2.1.pdf)
- [Architecture Design Document v2.0](docs/ADD_v2.0.pdf)
- [Test Report v1.5](docs/Test_Report_v1.5.pdf)

---

## Approval

| Role | Name | Signature | Date |
|------|------|-----------|------|
| Release Manager | [Name] | | |
| Quality Assurance | [Name] | | |
| Safety Engineer | [Name] | | |