# altera-fpga/agilex-ed-drive-on-chip architecture

> Architecture diagram of the GitHub repository altera-fpga/agilex-ed-drive-on-chip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/altera-fpga/agilex-ed-drive-on-chip
- Repository: https://github.com/altera-fpga/agilex-ed-drive-on-chip

## Overview

This repository provides modular Drive-On-Chip hardware variants, with Nios V software for motor-drive control. The documented variants cover dual-axis, six-axis, and safety-focused dual-axis systems; the available source tree gives the clearest implementation view of the Nios V control software. Its runtime is organized around application startup and motor tasks, control algorithms, sensing and power-board interfaces, and platform services. Source evidence is incomplete, so uncertain runtime calls are shown as unverified rather than asserted.

Main entry points: [`custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c) (Motor task), [`custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc.c`](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc.c) (Motor control core), [`custom_user_subsystems/drive_subsystems/software/niosv/common/main.c`](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/main.c) (Application startup), [`custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/main.c`](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/main.c) (Six-axis startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Drive application"]
  node_app["Application startup<br/>[main.c]"]
  node_six_axis_app["Six-axis startup<br/>[main.c]"]
  node_motor_task["Motor task<br/>[motor_task.c]"]
  node_six_axis_task["Six-axis motor task<br/>[motor_task.c]"]
  node_motion_task["Motion task<br/>[motion_task.c]"]
  node_debug["Console and debug<br/>[mc_debug.c]"]
end

subgraph group_control["Motor control"]
  node_mc_core["Motor control core<br/>[mc.c]"]
  node_foc["FOC algorithm<br/>[foc.c]"]
  node_mc_dsp["DSP utilities<br/>[mc_dsp.c]"]
  node_waveform["Waveform generation<br/>[waveform.c]"]
  node_motor_sim["Motor simulation<br/>[motor.c]"]
  node_dspba["DSP hardware interface<br/>[DF_fixp16_alu_av.c]"]
end

subgraph group_io["Drive interfaces"]
  node_adc["Power-board ADC<br/>[doc_adc.c]"]
  node_pwm["PWM interface<br/>[ssg_emb_pwm.c]"]
  node_dsm["Drive state machine<br/>[ssg_emb_dsm.c]"]
  node_encoder["Encoder and QEP<br/>[qep.c]"]
  node_resolver["Resolver interface<br/>[AU6805.c]"]
end

subgraph group_platform["Platform services"]
  node_platform["Platform services<br/>[platform.c]"]
  node_motor_types["Motor types<br/>[motor_types.c]"]
  node_monitor["System monitor<br/>[monitor_task.c]"]
  node_performance["Performance counters"]
end

node_operator(("Drive operator"))
node_variants["Drive variants"]
node_drive_hardware["Drive hardware"]

node_operator -->|"selects design"| node_variants
node_variants -.->|"includes software"| node_app
node_variants -.->|"includes software"| node_six_axis_app
node_app -.->|"starts task"| node_motor_task
node_six_axis_app -.->|"starts task"| node_six_axis_task
node_motor_task -->|"uses control"| node_mc_core
node_motor_task -->|"uses FOC"| node_foc
node_motor_task -->|"uses accelerator"| node_dspba
node_motor_task -->|"uses debug"| node_debug
node_six_axis_task -->|"uses FOC"| node_foc
node_mc_core -.->|"reads samples"| node_adc
node_mc_core -.->|"sets outputs"| node_pwm
node_mc_core -.->|"controls state"| node_dsm
node_mc_core -.->|"reads position"| node_encoder
node_mc_core -.->|"reads position"| node_resolver
node_motion_task -.->|"uses waveforms"| node_waveform
node_motor_sim -.->|"models behavior"| node_drive_hardware
node_platform -.->|"uses definitions"| node_motor_types
node_monitor -.->|"uses services"| node_platform
node_motor_task -->|"measures execution"| node_performance
node_adc -.->|"reads signals"| node_drive_hardware
node_pwm -.->|"drives phases"| node_drive_hardware
node_dsm -.->|"controls drive"| node_drive_hardware

click node_app "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/main.c"
click node_six_axis_app "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/main.c"
click node_motor_task "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c"
click node_six_axis_task "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/mc/motor_task.c"
click node_motion_task "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motion_task.c"
click node_debug "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_debug.c"
click node_mc_core "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc.c"
click node_foc "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/foc/foc.c"
click node_mc_dsp "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_dsp.c"
click node_waveform "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/waveform/waveform.c"
click node_motor_sim "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/motorsim/motor.c"
click node_adc "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/powerboard/doc_adc.c"
click node_pwm "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_pwm.c"
click node_dsm "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_dsm.c"
click node_encoder "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/qep/qep.c"
click node_resolver "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/resolver/AU6805.c"
click node_platform "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/common/platform.c"
click node_motor_types "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/motors/motor_types.c"
click node_monitor "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/os/monitor_task.c"
click node_performance "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/perf/altera_avalon_performance_counter.c"
click node_dspba "https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/dspba/DF_fixp16_alu_av.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_six_axis_app,node_motor_task,node_six_axis_task,node_motion_task,node_debug toneBlue
class node_mc_core,node_foc,node_mc_dsp,node_waveform,node_motor_sim,node_dspba toneAmber
class node_adc,node_pwm,node_dsm,node_encoder,node_resolver toneMint
class node_platform,node_motor_types,node_monitor,node_performance toneRose
class node_operator,node_variants,node_drive_hardware toneIndigo
```

## Components

### Drive application

- [Application startup](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/main.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/main.c`
- [Six-axis startup](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/main.c): `custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/main.c`
- [Motor task](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`
- [Six-axis motor task](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/mc/motor_task.c): `custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/mc/motor_task.c`
- [Motion task](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motion_task.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motion_task.c`
- [Console and debug](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_debug.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_debug.c`

### Motor control

- [Motor control core](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc.c`
- [FOC algorithm](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/foc/foc.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/foc/foc.c`
- [DSP utilities](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_dsp.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/mc_dsp.c`
- [Waveform generation](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/waveform/waveform.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/waveform/waveform.c`
- [Motor simulation](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/motorsim/motor.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/motorsim/motor.c`
- [DSP hardware interface](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/dspba/DF_fixp16_alu_av.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/components/dspba/DF_fixp16_alu_av.c`

### Drive interfaces

- [Power-board ADC](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/powerboard/doc_adc.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/platform/powerboard/doc_adc.c`
- [PWM interface](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_pwm.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_pwm.c`
- [Drive state machine](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_dsm.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/components/ssg_emb_dsm.c`
- [Encoder and QEP](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/qep/qep.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/components/qep/qep.c`
- [Resolver interface](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/components/resolver/AU6805.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/components/resolver/AU6805.c`

### Platform services

- [Platform services](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/common/platform.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/platform/common/platform.c`
- [Motor types](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/platform/motors/motor_types.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/platform/motors/motor_types.c`
- [System monitor](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/os/monitor_task.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/os/monitor_task.c`
- [Performance counters](https://github.com/altera-fpga/agilex-ed-drive-on-chip/blob/main/custom_user_subsystems/drive_subsystems/software/niosv/common/perf/altera_avalon_performance_counter.c): `custom_user_subsystems/drive_subsystems/software/niosv/common/perf/altera_avalon_performance_counter.c`

### Other components

- **Drive operator**
- **Drive variants**
- **Drive hardware**

## Connections

- Drive operator → Drive variants: selects design
- Drive variants → Application startup: includes software
- Drive variants → Six-axis startup: includes software
- Application startup → Motor task: starts task
- Six-axis startup → Six-axis motor task: starts task
- Motor task → Motor control core: uses control (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`)
- Motor task → FOC algorithm: uses FOC (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`)
- Motor task → DSP hardware interface: uses accelerator (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`)
- Motor task → Console and debug: uses debug (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`)
- Six-axis motor task → FOC algorithm: uses FOC (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/3x2-axis/common/mc/motor_task.c`)
- Motor control core → Power-board ADC: reads samples
- Motor control core → PWM interface: sets outputs
- Motor control core → Drive state machine: controls state
- Motor control core → Encoder and QEP: reads position
- Motor control core → Resolver interface: reads position
- Motion task → Waveform generation: uses waveforms
- Motor simulation → Drive hardware: models behavior
- Platform services → Motor types: uses definitions
- System monitor → Platform services: uses services
- Motor task → Performance counters: measures execution (evidence: `custom_user_subsystems/drive_subsystems/software/niosv/common/mc/motor_task.c`)
- Power-board ADC → Drive hardware: reads signals
- PWM interface → Drive hardware: drives phases
- Drive state machine → Drive hardware: controls drive
