Skip to content

Add apsk_demo example... #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions examples/ulxs3/apsk_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output/
lextab.py
yacctab.py
38 changes: 38 additions & 0 deletions examples/ulxs3/apsk_demo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Makefile based on https://github.com/ulx3s/blink/blob/main/Makefile
.ONESHELL: # Applies to every targets in the file!

PYFILES = lextab.py yacctab.py
DIR = output/pipelinec_top

all: build prog

build:
../../../src/pipelinec apsk_demo.c --top pipelinec_top --out_dir output
cp pll.v $(DIR)
cp top.v $(DIR)

apsk_demo.json:
cd $(DIR)
echo -n "yosys -m ghdl -p 'ghdl --std=08 -frelaxed " > build.sh
cat ../vhdl_files.txt >> build.sh
echo "-e pipelinec_top; read_verilog top.v; synth_ecp5 -abc9 -nowidelut -json apsk_demo.json' > ../yosyslog.log " >> build.sh
bash build.sh

ulx3s.bit: ulx3s_out.config
cd $(DIR)
ecppack ulx3s_out.config ulx3s.bit

ulx3s_out.config: apsk_demo.json
cd $(DIR)
nextpnr-ecp5 --85k --json apsk_demo.json \
--pre-pack ../clocks.py --seed 1 \
--lpf ../../ulx3s_v20.lpf \
--textcfg ulx3s_out.config \
--package CABGA381

prog: ulx3s.bit
cd $(DIR)
fujprog ulx3s.bit

clean:
rm -rf output rm ulx3s_out.config ulx3s.bit $(PYFILES)
62 changes: 62 additions & 0 deletions examples/ulxs3/apsk_demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# APSK Modulator on FPGA

> [!WARNING]
>
> This code was tested on an earlier version of PipelineC within a configured environment, in case of issues feel free to ask for help.

This is a 16-APSK (and, 32-APSK, as a bonus) digital modulator implemented using the [PipelineC](https://github.com/JulianKemmerer/PipelineC) high-level synthesis HDL, running on a Lattice ECP5 (ULX3S) FPGA.

The modulator generates a baseband or RF-shifted signal using a chain of modular components:
- Pseudo-random data generation (LFSR)
- APSK symbol mapping
- CIC interpolation
- Digital upconversion (DUC)
- Delta-Sigma DACs (Low-pass & Band-pass)

📖🔗 **[Read the full article on LinkedIn →](https://www.linkedin.com/pulse/16-apsk-modulator-fpga-using-pipelinec-hdl-paulo-dutra-79uce)**

---

## 🔧 Block Diagram

![PipelineC 16-APSK Modulator Block Diagram and Some explanation about the design](images/image.png)
*PipelineC 16-APSK Modulator Block Diagram and Some explanation about the design*

---

## ⚙️ FPGA Output

### Constellation Output (Baseband)

![Actual Constellation diagram and Spectrum generated by the FPGA Design visualized on a Rigol DHO804 Oscilloscope](images/image-1.png)
*Actual Constellation diagram and Spectrum generated by the FPGA Design using an external RC low-pass filter, visualized on a Rigol DHO804 Oscilloscope*

---

### RF Output Spectrum (~7.68 MHz)

![Band-Pass Delta Sigma Modulator output spectrum visualized using the FFT of the Rigol DHO804 Oscilloscope](images/image-2.png)
*Band-Pass Delta Sigma Modulator output spectrum visualized using the FFT of the Rigol DHO804 Oscilloscope.*
---

## 🔬 Tools & Tech

- **HDL**: [PipelineC](https://github.com/JulianKemmerer/PipelineC) (C-based HLS HDL) + [OSS CAD Suite](https://github.com/YosysHQ/oss-cad-suite-build)
- **Simulation**: [CocoTB](https://www.cocotb.org/) + [GHDL](https://ghdl.github.io/ghdl/)
- **Board**: [ULX3S](https://ulx3s.github.io) (Lattice ECP5-85F)
- **Testbench**: Python, Matplotlib, GTKWave
- **Output**: Delta-Sigma DACs (2nd Order LP & Band-Pass)

---

## 📎 License

MIT © Paulo Dutra – PU4THZ

---

## 📌 TODO
- [ ] Test if this still works (many changes on the repo...)
- [ ] Improve documentation (diagrams, usage, examples)

📫 Feedback and collaboration are welcome!
Loading