Skip to content
Je-Leo-ASPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

DPD - Digital Predistortion

Study and implementation project for Digital Predistortion (DPD) to compensate for nonlinearities in power amplifiers. This repository brings together the Python/Octave modeling flow, coefficient generation, VHDL implementation, and simulation-based validation.

Overview

The main project flow is:

  1. Read the measured power amplifier data.
  2. Model the behavior using a memory polynomial.
  3. Calculate and normalize the DPD coefficients.
  4. Validate the model in floating-point and fixed-point formats.
  5. Generate or adjust constants for VHDL.
  6. Simulate the VHDL architecture and compare the output against references.
  7. Optionally run post-synthesis/post-place-and-route simulation in Questa/ModelSim.

Project structure

DPD/
├── INPUT/          Input data in .mat format
├── OUTPUT/         Generated results: coefficients, validations, and simulation outputs
├── Master/         Main Python notebooks and helper functions
├── TCC/            TCC activity/experiment notebooks
├── OCTAVE/         Octave/MATLAB scripts used in the initial activities
├── VHDL/           VHDL implementation, testbench, and simulation/synthesis scripts
├── questa_sim/     Files and instructions for timing simulation in Questa/ModelSim
├── diagramas/      Project process and calculation-flow diagrams
├── requirements.txt
└── README.md

INPUT/

Contains the measured or prepared data files used for training and validation:

  • IN_OUT_PA.mat
  • data_LDMOS_formatted_4500p.mat
  • in_out_SBRT2_direto.mat

These files are used by the notebooks to extract the power amplifier input/output signals and calculate the models.

OUTPUT/

Contains artifacts generated during the flow:

  • NumPy coefficient files (.npy), such as coefficients_norm_DPD.npy and coefficients_norm_pa.npy;
  • validation data in CSV format;
  • VHDL/FPGA simulation outputs in .txt format;
  • intermediate comparisons and metrics.

This directory works as the results area shared by Python, VHDL, and the simulation flows.

Master/

This is the main Python development directory. It contains:

  • notebooks from M1.ipynb to M8.ipynb, organizing the project steps;
  • separar_dados_pa.ipynb, used for data preparation/separation;
  • M7 Coeficientes vhdl.ipynb, used in the coefficient generation/adaptation flow for VHDL;
  • functions.py, with helper functions for memory polynomials, fixed-point processing, NMSE, simulation-output loading, and complex-vector comparison;
  • .npy vectors used to compare calculated and simulated models.

TCC/

Contains auxiliary activity or experiment notebooks:

  • at1.ipynb to at5.ipynb.

Use this directory as an experimentation history and support material for the main development flow.

OCTAVE/

Contains Octave/MATLAB scripts:

  • atividade_m1.m
  • atividade_m2.m
  • atividade_m3.m
  • exemplo_plot_PSD.txt

These files record early analysis and calculation steps outside the main Python flow.

VHDL/

Contains the hardware implementation:

  • DPD.vhd: main DPD module;
  • functions.vhd: helper functions and types used by the VHDL code;
  • complex_constants.vhd: complex constants used by the architecture;
  • tb_main.vhd: testbench;
  • simular.sh: compiles and simulates with GHDL;
  • sintetizar.sh: runs logic synthesis with Yosys + GHDL plugin;
  • reports, compilation objects, and output.vcd generated by the tools.

questa_sim/

Contains files and documentation for post-place-and-route timing simulation using Questa/ModelSim:

  • DPD_timesim.v
  • DPD_timesim.sdf
  • glbl.v
  • setup.do
  • README.md

See questa_sim/README.md for the specific step-by-step instructions for this simulation.

diagramas/

Contains editable Draw.io diagrams:

  • diagrama_process.drawio
  • fluxo_de_calculo.drawio
  • process_2.drawio

Use these files to understand or update the visual documentation of the flow.

Requirements

Python

  • Python 3.8 or newer
  • Dependencies listed in requirements.txt:
    • numpy
    • scipy
    • matplotlib
    • sympy

To open the notebooks, installing Jupyter is also recommended:

pip install notebook

Octave/MATLAB

Required only to run the scripts in OCTAVE/.

VHDL and synthesis

The scripts in VHDL/ assume OSS CAD Suite is available at:

/opt/oss-cad-suite

Tools used:

  • GHDL, for behavioral simulation;
  • Yosys with the GHDL plugin, for logic synthesis;
  • GTKWave, optional, to inspect output.vcd.

For timing simulation in questa_sim/, the flow uses Xilinx ISE 14.7, Netgen, and Questa/ModelSim. See questa_sim/README.md.

Getting started

Clone the project and enter the directory:

git clone https://github.com/Je-Leo-AS/DPD.git
cd DPD

Create and activate a Python virtual environment:

python -m venv .venv
source .venv/bin/activate

Install the dependencies:

pip install -r requirements.txt
pip install notebook

Open the notebooks:

jupyter notebook

Start with the Master/ directory. A suggested order is:

  1. Master/separar_dados_pa.ipynb
  2. Master/M1.ipynb to Master/M6-Avaliacao-mp .ipynb
  3. Master/M7 Coeficientes vhdl.ipynb
  4. Master/M8.ipynb

This sequence follows data preparation, modeling, evaluation, coefficient generation, and validation.

VHDL simulation

Enter the VHDL/ directory:

cd VHDL

Run the behavioral simulation:

./simular.sh

The script compiles functions.vhd, DPD.vhd, and tb_main.vhd, elaborates the tb testbench, and generates:

VHDL/output.vcd

For logic synthesis with Yosys + GHDL:

./sintetizar.sh

The report is saved at:

VHDL/relatorio_sintese.txt

Result comparison

The functions in Master/functions.py include utilities to:

  • load simulation outputs;
  • align signals by delay;
  • calculate mean error, maximum error, and NMSE;
  • compare complex vectors generated by Python and VHDL.

The results used in these comparisons are mainly stored in OUTPUT/ and in some .npy vectors inside Master/.

Notes

  • The main README describes the general project flow.
  • Post-place-and-route timing simulation has its own instructions in questa_sim/README.md.
  • Compilation files, reports, and simulation outputs can be regenerated by running the corresponding notebooks and scripts.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages