Skip to content
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

Release staging for v2.0.0 #49

Merged
merged 126 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
38aa8f1
Tidy the pll_sim function
ed-xmos Nov 3, 2023
7b4eea2
WIP decompose model into blocks
ed-xmos Nov 8, 2023
4b26ef9
Further WIP restructure of simulator
ed-xmos Nov 8, 2023
1538de9
Upgrade audio modulator to continuous phase
ed-xmos Nov 8, 2023
9b9cafb
Initial loop closed for LUT sw_pll model
ed-xmos Nov 9, 2023
30892e3
Enable jitter compensation
ed-xmos Nov 9, 2023
381e7f9
Add first_loop to match C
ed-xmos Nov 9, 2023
b79c92d
Sim now generates audio modulated tone
ed-xmos Nov 9, 2023
ee704f0
Fix audio tone modulation
ed-xmos Nov 9, 2023
13eb089
Initial rough (incomplete) SDM sim
ed-xmos Nov 9, 2023
a124e0f
Very basic full sdm sim
ed-xmos Nov 10, 2023
a7eaca1
Tidy up
ed-xmos Nov 10, 2023
697fa86
Ensure sw_pll python imports from same dir + update test_lib_sw_pll.py
ed-xmos Nov 10, 2023
6d6fa50
Fixing tests
ed-xmos Nov 10, 2023
6a60a8d
Lots of test fixes
ed-xmos Nov 13, 2023
5b9e279
Split Jenkins into stages
ed-xmos Nov 13, 2023
d6690c8
Jenkinsfile formatting
ed-xmos Nov 13, 2023
a2c85e0
Typo in jenkinsfile
ed-xmos Nov 13, 2023
6f7ce42
Update submodules to latest tagged releases
ed-xmos Nov 13, 2023
64d77e8
Make past few commit changes actually work
ed-xmos Nov 13, 2023
028d193
Revert infrapps
ed-xmos Nov 13, 2023
4a0f2d2
Fix checkout
ed-xmos Nov 13, 2023
b9cba06
Some general tidying
ed-xmos Nov 13, 2023
aafe668
Ensure error zeroed on first_loop
ed-xmos Nov 13, 2023
bce78da
Add scipy to requirements
ed-xmos Nov 13, 2023
1127573
Support non-fractional setting of app pll and in sdm dco
ed-xmos Nov 13, 2023
b3c5976
Add comments to class methods
ed-xmos Nov 14, 2023
6069ce5
Add 500k SDM update profiles and tidy
ed-xmos Nov 15, 2023
b3baa28
Add generation of register setup for SDM DCO
ed-xmos Nov 15, 2023
1f0289f
Initial copy of simple example and separate out pfd
ed-xmos Nov 15, 2023
4eafeeb
WIP SDM C
ed-xmos Nov 15, 2023
e0df4c1
Very basic working SDM loop
ed-xmos Nov 16, 2023
828d6fb
Add double integral term
ed-xmos Nov 16, 2023
83e4f8f
Add missing version bump
ed-xmos Nov 16, 2023
0577d8f
Another bump missing
ed-xmos Nov 16, 2023
0e35d3f
Fix check for zero Kii
ed-xmos Nov 16, 2023
4af5649
Typo Ki -> Kii
ed-xmos Nov 16, 2023
d74b857
Add missing register setup file
ed-xmos Nov 16, 2023
8041d8a
Copyright
ed-xmos Nov 16, 2023
0fa6f32
Remove repeated fn
ed-xmos Nov 16, 2023
d3742f7
WIP make HW setup generic
ed-xmos Nov 20, 2023
e9b0edf
Refactor with struct of structs
ed-xmos Nov 20, 2023
dba71af
Fix build error in i2s example
ed-xmos Nov 20, 2023
7604f86
Make pfd init common
ed-xmos Nov 20, 2023
969427c
Fix tests
ed-xmos Nov 20, 2023
bc6b983
Test fix
ed-xmos Nov 20, 2023
a6a2295
Add IIR to C SDM
ed-xmos Nov 21, 2023
ae246d9
Separate out low level equiv test
ed-xmos Nov 21, 2023
c092c5a
Merge branch 'feature/sdm' into feature/sdm_c
ed-xmos Nov 21, 2023
56a31a5
Tidy test separation
ed-xmos Nov 21, 2023
c2e4899
Move SDM code from example to lib
ed-xmos Nov 21, 2023
7c82e6f
Add initial SDM DCO test app
ed-xmos Nov 21, 2023
0d261ac
Keep param inside object in DCO
ed-xmos Nov 21, 2023
9bd2532
WIP SDM DCO test
ed-xmos Nov 21, 2023
5213860
Basic working SDM DCO test
ed-xmos Nov 22, 2023
589d5b5
Finished DCO SDM test but fails after 20 iters
ed-xmos Nov 22, 2023
d500641
SDM ctrl test firmware
ed-xmos Nov 22, 2023
9b05864
Fix mask op
ed-xmos Nov 22, 2023
ecd77c8
Fix SDM DCO equiv test
ed-xmos Nov 22, 2023
67729a5
Add SDM tests to build
ed-xmos Nov 23, 2023
b944eb0
Refactor and tidy
ed-xmos Nov 23, 2023
85f5370
Add failing SDM ctrl test
ed-xmos Nov 23, 2023
a446b23
Passing SDM ctrl app
ed-xmos Nov 23, 2023
c35f689
add exclude for autgen files
ed-xmos Nov 23, 2023
088d884
Fix exclude
ed-xmos Nov 23, 2023
69e67bd
Merge pull request #45 from ed-xmos/feature/sdm
ed-xmos Nov 23, 2023
1a614e9
remove unnecessary inheritance
ed-xmos Nov 23, 2023
2c71246
Merge commit '69e67bd53c113b903acc0e1dabc79d1f2f98254d' into feature/…
ed-xmos Nov 23, 2023
ef3e62a
Tidy example and add lock detect for SDM
ed-xmos Nov 23, 2023
c0f5969
Refactor lock status in model
ed-xmos Nov 27, 2023
20cedc9
SDM C API tidy and doxy
ed-xmos Nov 27, 2023
4992035
Os in test apps
ed-xmos Nov 27, 2023
80bd5a9
Improve model comments
ed-xmos Nov 27, 2023
55b5ca5
Run python model examples and archive
ed-xmos Nov 27, 2023
a844de2
Run through all SDM profiles for test and improve artefact store
ed-xmos Nov 27, 2023
9685467
Merge branch 'feature/add_ii' into feature/sdm_c
ed-xmos Nov 27, 2023
db99260
Finish adding II term and fix example run
ed-xmos Nov 27, 2023
8d01815
Changelog and typo fix
ed-xmos Nov 27, 2023
fcccf6e
Missing version bump
ed-xmos Nov 27, 2023
781d70a
Add Kii into tests
ed-xmos Nov 27, 2023
4efa998
Fix missing handling of Kii
ed-xmos Nov 27, 2023
b6d69eb
II clipping now tested and equivalent
ed-xmos Nov 27, 2023
ae58cb9
Var typo
ed-xmos Nov 27, 2023
1fe88c9
Remove some copy pasta test comments
ed-xmos Nov 28, 2023
fa28fce
Update readme and add diagrams + source
ed-xmos Nov 28, 2023
c77ef19
Merge branch 'feature/sdm_c' into feature/docs_update
ed-xmos Nov 28, 2023
ef75923
WIP docs update + lots of images
ed-xmos Nov 28, 2023
4004640
rename examples for lut/sdm
ed-xmos Nov 28, 2023
600f692
Working doc build
ed-xmos Nov 28, 2023
7e7bdca
Fix doxy formatting
ed-xmos Nov 28, 2023
9fa5fee
Merge pull request #46 from ed-xmos/feature/sdm_c
ed-xmos Nov 29, 2023
54a320d
Regroup API in docs + various fixes
ed-xmos Nov 29, 2023
babfb50
Merge commit '9fa5fee7e121a06aa92f2e83e5fc53e9681eacf7' into feature/…
ed-xmos Nov 29, 2023
c7bddf5
Add missing h files to git
ed-xmos Nov 29, 2023
29c1f6c
Vanilla sw_pll now called sw_pll_lut
ed-xmos Nov 29, 2023
cb8edba
actions->jenkins for doc build
ed-xmos Nov 29, 2023
ddd8f7e
Debug
ed-xmos Nov 29, 2023
8f53fe6
debug
ed-xmos Nov 29, 2023
8b5ff37
debug
ed-xmos Nov 29, 2023
96788c8
Add docs back in
ed-xmos Nov 29, 2023
a76581f
Tweak docker paths
ed-xmos Nov 29, 2023
50173b4
settings.yml in root and update paths
ed-xmos Nov 29, 2023
9e6b2e2
Missing escape character
ed-xmos Nov 29, 2023
4867dfe
More doc fixes
ed-xmos Nov 30, 2023
759f021
Rejig of docs
ed-xmos Nov 30, 2023
fdf80c9
Fix path
ed-xmos Nov 30, 2023
bdb970f
Move typical LUT profiles to sw_pll_sim
ed-xmos Nov 30, 2023
99efe2f
rst updates
ed-xmos Nov 30, 2023
bad7206
sw_pll_reset -> sw_pll_lut_reset
ed-xmos Dec 1, 2023
d07932d
Missed api usage
ed-xmos Dec 1, 2023
760e8d9
Tidy the SDM API
ed-xmos Dec 1, 2023
6e57aab
API typo
ed-xmos Dec 1, 2023
b1e54d1
API doc tidy
ed-xmos Dec 1, 2023
c0cdef2
remove redundant file
ed-xmos Dec 1, 2023
98afbfb
Small fixes
ed-xmos Dec 1, 2023
77a8ebc
Note about file overwrite in sim
ed-xmos Dec 1, 2023
75b8364
docgen and source check tidy
ed-xmos Dec 1, 2023
1142c71
Make the SDM generator produce the timing info for SDM loop
ed-xmos Dec 1, 2023
3c4a881
Warning comments in sdm example
ed-xmos Dec 1, 2023
bb14c91
Add descriptions of the PI and PFD
ed-xmos Dec 4, 2023
74068d8
Section re-layout
ed-xmos Dec 4, 2023
ca10b63
Change titles in doc
ed-xmos Dec 4, 2023
6969502
Refactoring of the resource setup var names and docs to make clearer
ed-xmos Dec 4, 2023
7b1c981
Final tidy items from doc review
ed-xmos Dec 5, 2023
3f11937
Add missing images
ed-xmos Dec 5, 2023
19a3e71
Merge pull request #48 from ed-xmos/feature/docs_update
ed-xmos Dec 5, 2023
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
64 changes: 0 additions & 64 deletions .github/workflows/docs.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ compile_commands.json
.python-version
__pycache__/
modules/
doc/doc/_build
doc/_out
_build
2 changes: 2 additions & 0 deletions .xmos_ignore_source_check
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
python/sw_pll/pll_calc.py
register_setup.h
fractions.h
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
lib_sw_pll library change log
=============================

2.0.0
-----

* ADDED: Double integral term to controller
* ADDED: Sigma Delta Modulator option for PLL
* CHANGED: Refactored Python model into analogous objects

1.1.0
-----

Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(modules/fwk_io)
add_subdirectory(tests/test_app)
add_subdirectory(tests/test_app_low_level_api)
add_subdirectory(tests/test_app_sdm_dco)
add_subdirectory(tests/test_app_sdm_ctrl)
endif()
90 changes: 72 additions & 18 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,88 @@ pipeline {
)
}
environment {
REPO = 'lib_sw_pll'
PYTHON_VERSION = "3.10.5"
VENV_DIRNAME = ".venv"
}

stages {
stage('ci') {
stage('Build and tests') {
agent {
label 'linux&&64'
}
steps {
sh 'mkdir lib_sw_pll'
// source checks require the directory
// name to be the same as the repo name
dir('lib_sw_pll') {
// checkout repo
checkout scm
installPipfile(false)
withVenv {
withTools(params.TOOLS_VERSION) {
sh './tools/ci/checkout-submodules.sh'
catchError {
sh './tools/ci/do-ci.sh'
stages{
stage('Checkout'){
steps {
sh 'mkdir ${REPO}'
// source checks require the directory
// name to be the same as the repo name
dir("${REPO}") {
// checkout repo
checkout scm
installPipfile(false)
withVenv {
withTools(params.TOOLS_VERSION) {
sh './tools/ci/checkout-submodules.sh'
}
}
zip archive: true, zipFile: "build.zip", dir: "build"
zip archive: true, zipFile: "tests.zip", dir: "tests/bin"
archiveArtifacts artifacts: "tests/bin/timing-report.txt", allowEmptyArchive: false
}
}
}
stage('Docs') {
environment { XMOSDOC_VERSION = "v4.0" }
steps {
dir("${REPO}") {
sh "docker pull ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION"
sh """docker run -u "\$(id -u):\$(id -g)" \
--rm \
-v \$(pwd):/build \
ghcr.io/xmos/xmosdoc:$XMOSDOC_VERSION -v html latex"""

// Zip and archive doc files
zip dir: "doc/_build/", zipFile: "sw_pll_docs.zip"
archiveArtifacts artifacts: "sw_pll_docs.zip"
}
}
}
stage('Build'){
steps {
dir("${REPO}") {
withVenv {
withTools(params.TOOLS_VERSION) {
sh './tools/ci/do-ci-build.sh'
}
}
}
}
}
stage('Test'){
steps {
dir("${REPO}") {
withVenv {
withTools(params.TOOLS_VERSION) {
catchError {
sh './tools/ci/do-ci-tests.sh'
}
zip archive: true, zipFile: "build.zip", dir: "build"
zip archive: true, zipFile: "tests.zip", dir: "tests/bin"
archiveArtifacts artifacts: "tests/bin/timing-report*.txt", allowEmptyArchive: false

junit 'tests/results.xml'
junit 'tests/results.xml'
}
}
}
}
}
stage('Python examples'){
steps {
dir("${REPO}") {
withVenv {
catchError {
sh './tools/ci/do-model-examples.sh'
}
archiveArtifacts artifacts: "python/sw_pll/*.png,python/sw_pll/*.wav", allowEmptyArchive: false
}
}
}
}
Expand Down
57 changes: 28 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,32 @@ lib_sw_pll

This library contains software that, together with the on-chip application PLL, provides a PLL that will generate a clock phase locked to an input clock.

********************************
Building and running the example
********************************
It supports both Look Up Table (LUT) and Sigma Delta Modulated (SDM) Digitally Controlled Oscillators (DCO), a Phase Frequency Detector (PFD) and
configurable Proportional Integral (PI) controllers which together form a hybrid Software/Hardware Phase Locked Loop (PLL).

Ensure a correctly configured installation of the XMOS tools.
Examples are provided showing a master clock locking to a low frequency input reference clock and also to an I2S slave interface.

*********************************
Building and running the examples
*********************************

Ensure a correctly configured installation of the XMOS tools and open an XTC command shell. Please check that the XMOS tools are correctly
sourced by running the following command::

$ xcc
xcc: no input files

.. note::
Instructions for installing and configuring the XMOS tools appear on `the XMOS web site <https://www.xmos.ai/software-tools/>`_.

Place the fwk_core and fwk_io repositories in the modules directory of lib_sw_pll.
Place the fwk_core and fwk_io repositories in the modules directory of lib_sw_pll. These are required dependencies for the example apps.
To do so, from the root of lib_sw_pll (where this read me file exists) type::

mkdir modules
pushd modules
cd modules
git clone --recurse-submodules [email protected]:xmos/fwk_core.git
git clone --recurse-submodules [email protected]:xmos/fwk_io.git
popd
cd ..

.. note::
The fwk_core and fwk_io repositories have not been sub-moduled into this Git repository because only the examples depend upon them.
Expand All @@ -30,43 +39,33 @@ On linux::

cmake -B build -DCMAKE_TOOLCHAIN_FILE=modules/fwk_io/xmos_cmake_toolchain/xs3a.cmake
cd build
make simple
make simple_lut simple_sdm i2s_slave_lut

On Windows::

cmake -G "NMake Makefiles" -B build -DCMAKE_TOOLCHAIN_FILE=modules/fwk_io/xmos_cmake_toolchain/xs3a.cmake
cmake -G "Ninja" -B build -DCMAKE_TOOLCHAIN_FILE=modules/fwk_io/xmos_cmake_toolchain/xs3a.cmake
cd build
nmake simple
ninja simple_lut simple_sdm i2s_slave_lut


To run the firmware, first connect LRCLK and BCLK (connects the test clock output to the PLL input)
and run the following command where <my_example> can be *simple* which uses the XCORE-AI-EXPLORER board
or *i2s_slave* which uses either the EVK3600 of EVK3800 board::
To run the firmware, first connect LRCLK and BCLK (connects the test clock output to the PLL reference input)
and run the following command where <my_example> can be *simple_lut* or *simple_sdm* which use the XCORE-AI-EXPLORER board
or *i2s_slave_lut* which uses the XK-VOICE-SQ66 board::

xrun --xscope <my_example>.xe


For simple.xe, to see the PLL lock, put one scope probe on either LRCLK/BCLK (reference) and the other on PORT_I2S_DAC_DATA to see the
recovered clock which has been hardware divided back down to the same rate as the input clock.
For simple_xxx.xe, to see the PLL lock, put one scope probe on either LRCLK/BCLK (reference input) and the other on PORT_I2S_DAC_DATA to see the
recovered clock which has been hardware divided back down to the same rate as the input reference clock.

For i2s_slave.xe you will need to connect a 48kHz I2S master to the LRCLK, BCLK pins. You may then observe the I2S input being
For i2s_slave_lut.xe you will need to connect a 48kHz I2S master to the LRCLK, BCLK pins. You may then observe the I2S input data being
looped back to the output and the MCLK being generated. A divided version of MCLK is output on PORT_I2S_DATA2 which allows
direct comparison of the input reference (LRCLK) with the recovered clock at the same frequency.

*****************
Running the tests
*****************

A test is available which checks the C implementation and the simulator, to run it::
direct comparison of the input reference (LRCLK) with the recovered clock at the same, and locked, frequency.

cmake -B build -DCMAKE_TOOLCHAIN_FILE=xmos_cmake_toolchain/xs3a.cmake
cmake --build build --target test_app
pip install -r .
cd tests
pytest

*********************************
Generating new PLL configurations
*********************************

Please see `doc/sw_pll.rst` for further details on how to design and build new sw_pll configurations. This covers the tradeoff between lock range, noise and memory usage.
Please see `doc/rst/sw_pll.rst` for further details on how to design and build new sw_pll configurations. This covers the tradeoff between lock range,
oscillator noise and resource usage.
Loading