GPS Acquisition Using AMD RFSoC Device
This example shows how to simulate the global positioning system (GPS) Acquisition algorithm in Simulink® using an SoC Blockset™ implementation targeted on an AMD® Zynq® UltraScale+™ RFSoC ZCU111 Evaluation Board.
Supported Hardware Platforms
AMD Zynq UltraScale+ RFSoC ZCU111 Evaluation Kit + XM500 Balun card.
Design Task
In this example, the design task is to implement a GPS acquisition system on an AMD RFSoC device. This example shows the workflow for designing, simulating, and deploying the GPS acquisition algorithm on the hardware. This figure shows the conceptual overview of the example.
The GPS acquisition performs high-speed signal processing tasks and makes it well-suited for FPGA implementation on the programmable logic (PL) of the radio platform. To implement this algorithm on the PL, the example uses the Simulink hardware model from the GPS HDL Acquisition and Tracking Using C/A Code (Wireless HDL Toolbox) example as model reference. The example is also equipped with an LUT-Based GPS waveform generator with a C/A code generator, an internal channel to apply carrier frequency offset (CFO), carrier frequency drift (CFD), and an HDL additive white Gaussian noise (AWGN) channel from the HDL Implementation of AWGN Generator (Wireless HDL Toolbox) example.
Design Using SoC Blockset
Create an SoC model soc_GPS_top
as the top model and set the Hardware Board parameter to Xilinx Zynq UltraScale+ RFSoC ZCU111 evaluation kit
. The top model includes FPGA model soc_GPS_fpga
and processor model soc_GPS_proc
, which are instantiated as model references. The top model also includes AXI4-Stream to Software block that shares the external memory between the FPGA and the processor.
Create an SoC model soc_GPS_hwtop
to act as the top-level model for simulating a hardware algorithm with a static configuration. This model includes the FPGA model soc_GPS_fpga
.
RF Data Converter Configuration
An RFSoC device has its RF data converter connected to the PL. To configure the analog to digital converter (ADC) and digital to analog converter (DAC) settings, use the RF Data Converter block. The block provides an interface to the AMD RF Data Converter IP in Simulink to model a GPS system destined for implementation on an AMD RFSoC device.
To meet the 860 MHz RF carrier frequency and 196.608 Msps baseband sample rate, configure the RF Data Converter block according to the settings described here and shown in the figure.
Set the NCO frequency parameter for the DAC and ADC mixers to
0.860
GHz.Set the DAC and ADC sample rates to
3145.728
Msps.Choose the values of Interpolation mode (xN), Decimation mode (xN), and Samples per clock cycle parameters such that the effective clock cycle (sample rate) for the GPS algorithm FPGA is the desirable value. For this example, the desired value is 196.608 Msps. This value is calculated and displayed on the block mask as the Stream clock frequency (MHz) parameter after you click Apply.
Set the Decimation mode (xN) parameter to
4
. The effective sample rate after vector decimation is 786.432 Msps.Set the Samples per clock cycle parameter to
4
to get the clock cycle (baseband sample rate) to 196.608 Msps.
Similarly, in the DAC tab, set the Interpolation mode (xN) parameter to 4
and the Samples per clock cycle parameter to 4
. With these settings, the Stream clock frequency parameter is (3145.728)/(4*4) = 196.608 MHz.
Hardware Logic Design
The FPGA model soc_GPS_fpga
consists of four subsystems: Vector Repeat
(connected to the DAC part of the RFDC block), Vector Decimation
(connected to the ADC part of the RFDC block), GPS Waveform 4 satellites
, and GPS Acquisition
.
The Vector Decimator
subsystem receives the packed 4 samples as 64 bits. This subsystem decimates input vector samples by 4, further decimates the scalar streaming samples by 6 sends them to the GPS Acquisition
subsystem. The sample rate after the Vector Decimator block is 32.768 Msps, as expected by GPS Acquisition
subsystem for its processing.
The GPS Waveform 4 Satellites
subsystem has an LUT-Based GPS waveform generators for 4 satellites, 4 AWGN
subsystem and 4 NCO with Ramp Doppler Rate
subsystem for each of the satellites. The AWGN
subsystem uses the AWGN generator from the HDL Implementation of AWGN Generator (Wireless HDL Toolbox) example. The NCO with Ramp Doppler Rate
subsystem performs the CFO and CFD insertion using the NCO (DSP HDL Toolbox) block.
In the receive path, the Vector Decimator
subsystem receives the packed four samples with a sample rate of 786.432 Msps from the RF Data Converter block. The Vector Decimator
subsystem decimates input vector samples by 4 and further decimates the scalar samples by 6 and sends them to the GPS acquisition
subsystem. The sample rate after the Vector Decimator
subsystem is 32.768 Msps, as expected by the GPS Acquisition
subsystem for its processing. In the transmit path, the LUT-Based GPS waveform generator sends the samples to the RF Data Converter block through the Vector Repeat
subsystem. The Vector Repeat
subsystem repeats the input samples by 24 (786.432 Msps) and sends them to the RF Data Converter block as a vector of four samples.
Processor Logic Design
The processor logic contains a read task and a periodic task. The periodic task is a timer-driven task with a periodic time of 1e-2, which is defined in the task manager. The periodic task drives the control and status signals of the hardware algorithm through the AXI4-Lite registers. The model displays status information such as PRNID, Doppler offset, code phase offset for 4 satellites from the GPS acquisition algorithm. The controller provides status information to the MATLAB host by using UDP blocks.
The two tasks are modeled under the Processor Algorithm Periodic
subsystem in the processor model soc_GPS_proc
and are connected to the Task Manager block at the top level.
Host Model
The processor sends the GPS Acquisition
subsystem status signals directly back to the host over the Ethernet link by using UDP Write blocks. The IP address of the UDP Write block in the processor model must be configured to the IP address of the host. This interface model, which runs on the host, shows how to receive data from the hardware platform and how to postprocess it.
Simulate
To confirm its basic operation, run the hardware generation model. The model callback runs the soc_GPS_init
script to initialize variables required for simulation to the workspace. To access the callback initialization, select MODELING > Model Settings > Model Properties > Callbacks > InitFcn.
### Searching for referenced models in model 'soc_GPS_hwtop'. ### Found 1 model reference targets to update. ### Starting serial model reference simulation build. ### Model reference simulation target for soc_GPS_fpga is up to date. Build Summary 0 of 1 models built (1 models already up to date) Build duration: 0h 3m 42.955s
Because the model contains a large number of HDL-optimized blocks, which simulate using sample-based signals it takes a while for the simulation.
To enable the channel in the GPS waveform 4 satellites
subsystem, set OverAir to false
. You can control the channel by using channel impairments parameters on the constant blocks Four SNRdBs
, Four Doppler Drifts
, and Four Doppler Offsets
. When you set Over_Air to true
, the GPS signals are transmitted and received externally through the ADC, DAC, and RF Data converter. The channel impairments get added externally in real time.
If you want to see the complete hardware and software simulation of the GPS acquisition algorithm and the controller dynamic configuration, run the soc_GPS_top
model. Run the host model to see the status signals.
Implement and Run on Hardware
Hardware Setup
Connect the SMA connector on the XM500 Balun card to complete the loopback between the DAC and ADC, according to these connections: DAC229_T1_CH2 (J5) to ADC224_T0_CH0 (J4).
To implement the model on a supported SoC board, use the SoC Builder tool. Ensure that the Hardware Board option is set to Xilinx Zynq UltraScale+ RFSoC ZCU111 Evaluation Kit
on the System on Chip tab of the Simulink toolstrip.
To open SoC Builder, click Configure, Build, & Deploy. After the SoC Builder tool opens, follow these steps.
On the Setup screen, select Build Model and click Next.
On the Select Build Action screen, select Build and load for external mode and then click Next.
On the Select Project Folder screen, specify the project folder and then click Next.
On the Review Memory Map screen, click View/Edit Memory Map to view the memory map and then click Next.
On the Validate Model screen, click Validate to check the compatibility of the model for implementation and then click Next.
On the Build Model screen, click Build to begin building the model. An external shell opens when FPGA synthesis begins. Click Next.
On the Connect Hardware screen, click Test Connection to test the connectivity of the host computer with the SoC board. Click Next to go to the Run Application screen.
FPGA synthesis often takes more than 30 minutes to complete. To save time, you can use the provided pre-generated bitstream by following these steps.
Close the external shell to terminate FPGA synthesis.
Copy the pre-generated bitstream to your project folder by entering this command at the MATLAB command prompt.
copyfile(fullfile(matlabroot, ... 'toolbox','soc','supportpackages','whdlsocexamples', ... 'bitstreams','soc_GPS_top-XilinxZynqUltraScale_RFSoCZCU111EvaluationKit.bit'),'./soc_prj');
Click Load and Run to load the pre-generated bitstream and run the model on the SoC board. After the bit file is loaded, open the generated software model.
Run the model in external mode by clicking Monitor & Tune. You can control the configuration from the Simulink model.
Status Signals from Hardware
Run the host model to see the received status signals. When the host interface model runs successfully, the model displays the status signals.
Run MATLAB Interface Script
You can control the deployed design using a MATLAB script running on the host. The Prototype Generated IP Core in MATLAB (HDL Coder) example shows how the HDL Coder™ software generates the interface definition function and the connection between MATLAB and the FPGA. SoC Builder generates the gs_soc_GPS_top_setup
function inside the project folder. This function is copied into the runGPSAcquisitionHardware
script.
The runGPSAcquisitionHardware
script implements the MATLAB control of the deployed design using the generated interface. The script writes control signals to the FPGA, reads results from the FPGA, and displays results in a table.
Conclusion
This example demonstrated how to integrate the GPS acquisition algorithm on an AMD ZCU111 evaluation board using an SoC Blockset implementation and how to verify the design in simulation and on hardware.
Related Topics
- GPS HDL Acquisition and Tracking Using C/A Code (Wireless HDL Toolbox)