# mriscoc/risc-v_serv architecture

> Architecture diagram of the GitHub repository mriscoc/risc-v_serv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mriscoc/risc-v_serv
- Repository: https://github.com/mriscoc/risc-v_serv

## Overview

SERV is a compact bit-serial RISC-V CPU, with Servant as its reference FPGA SoC. The user-facing path is loading firmware into Servant and observing its execution output, such as UART text. The tree also shows CPU datapath/control modules, FPGA board integrations, and Zephyr support. The README documents the CPU–SoC relationship and firmware workflow; sampled source covers Zephyr drivers, not RTL internals, so internal call relationships are not asserted.

Main entry points: [`servant/servant.v`](https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant.v) (Servant SoC), [`rtl/serv_top.v`](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_top.v) (SERV Core), [`servant`](https://github.com/mriscoc/risc-v_serv/tree/main/servant) (Board Integrations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cpu["SERV CPU"]
  node_serv["SERV Core<br/>[serv_top.v]"]
  node_decode["Instruction Decode<br/>[serv_decode.v]"]
  node_control["Execution Control<br/>[serv_ctrl.v]"]
  node_alu["ALU<br/>[serv_alu.v]"]
  node_register_file["Register File<br/>[serv_rf_top.v]"]
  node_csr["CSR Unit<br/>[serv_csr.v]"]
  node_memory_interface["Memory Interface<br/>[serv_mem_if.v]"]
  node_debug["Debug Unit<br/>[serv_debug.v]"]
end

subgraph group_soc["Servant SoC"]
  node_servant["Servant SoC<br/>[servant.v]"]
  node_ram[("SoC RAM<br/>[servant_ram.v]")]
  node_timer["SoC Timer<br/>[servant_timer.v]"]
  node_gpio["GPIO<br/>[servant_gpio.v]"]
end

subgraph group_platforms["FPGA Platforms"]
  node_board_ports["Board Integrations"]
end

subgraph group_zephyr["Zephyr Support"]
  node_zephyr_timer["Zephyr Timer Driver<br/>[serv_timer.c]"]
  node_bitbang_uart["Bitbang UART Driver<br/>[uart_bitbang.c]"]
  node_irq["Interrupt Support<br/>[irq.c]"]
  node_idle["CPU Idle Support<br/>[cpu_idle.c]"]
end

node_user(("User"))
node_firmware["Firmware"]
node_uart_output(("UART Output"))

node_user -->|"selects"| node_firmware
node_firmware -->|"loads into"| node_servant
node_servant -->|"integrates"| node_serv
node_servant -->|"produces"| node_uart_output
node_servant -->|"ported to"| node_board_ports

click node_serv "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_top.v"
click node_decode "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_decode.v"
click node_control "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_ctrl.v"
click node_alu "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_alu.v"
click node_register_file "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_rf_top.v"
click node_csr "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_csr.v"
click node_memory_interface "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_mem_if.v"
click node_debug "https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_debug.v"
click node_servant "https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant.v"
click node_ram "https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_ram.v"
click node_timer "https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_timer.v"
click node_gpio "https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_gpio.v"
click node_board_ports "https://github.com/mriscoc/risc-v_serv/tree/main/servant"
click node_zephyr_timer "https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/drivers/timer/serv_timer.c"
click node_bitbang_uart "https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/drivers/serial/uart_bitbang.c"
click node_irq "https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/soc/riscv/servant/irq.c"
click node_idle "https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/soc/riscv/servant/cpu_idle.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_serv,node_decode,node_control,node_alu,node_register_file,node_csr,node_memory_interface,node_debug,node_user toneBlue
class node_servant,node_ram,node_timer,node_gpio toneAmber
class node_board_ports toneMint
class node_zephyr_timer,node_bitbang_uart,node_irq,node_idle toneRose
class node_firmware,node_uart_output toneIndigo
```

## Components

### SERV CPU

- [SERV Core](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_top.v): `rtl/serv_top.v`
- [Instruction Decode](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_decode.v): `rtl/serv_decode.v`
- [Execution Control](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_ctrl.v): `rtl/serv_ctrl.v`
- [ALU](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_alu.v): `rtl/serv_alu.v`
- [Register File](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_rf_top.v): `rtl/serv_rf_top.v`
- [CSR Unit](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_csr.v): `rtl/serv_csr.v`
- [Memory Interface](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_mem_if.v): `rtl/serv_mem_if.v`
- [Debug Unit](https://github.com/mriscoc/risc-v_serv/blob/main/rtl/serv_debug.v): `rtl/serv_debug.v`

### Servant SoC

- [Servant SoC](https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant.v): `servant/servant.v`
- [SoC RAM](https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_ram.v): `servant/servant_ram.v`
- [SoC Timer](https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_timer.v): `servant/servant_timer.v`
- [GPIO](https://github.com/mriscoc/risc-v_serv/blob/main/servant/servant_gpio.v): `servant/servant_gpio.v`

### FPGA Platforms

- [Board Integrations](https://github.com/mriscoc/risc-v_serv/tree/main/servant): `servant`

### Zephyr Support

- [Zephyr Timer Driver](https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/drivers/timer/serv_timer.c): `zephyr/drivers/timer/serv_timer.c`
- [Bitbang UART Driver](https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/drivers/serial/uart_bitbang.c): `zephyr/drivers/serial/uart_bitbang.c`
- [Interrupt Support](https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/soc/riscv/servant/irq.c): `zephyr/soc/riscv/servant/irq.c`
- [CPU Idle Support](https://github.com/mriscoc/risc-v_serv/blob/main/zephyr/soc/riscv/servant/cpu_idle.c): `zephyr/soc/riscv/servant/cpu_idle.c`

### Other components

- **User**
- **Firmware**
- **UART Output**

## Connections

- User → Firmware: selects (evidence: `README.md`)
- Firmware → Servant SoC: loads into (evidence: `README.md`)
- Servant SoC → SERV Core: integrates (evidence: `README.md`)
- Servant SoC → UART Output: produces (evidence: `README.md`)
- Servant SoC → Board Integrations: ported to (evidence: `README.md`)
