Read AXI4 address locations from Simulink

How can I read a particular address location from the AXI4 interface within Simulink HDL coder? For example, if I have a reference design that includes the Altera System ID Peripheral Core and it is located at base address 0x0000_0080, how could I read the system ID (offset 0) into my Simulink model? Normally, in my C program I would use mmap() to map physical addressses in the Linux virtual memory space and create a pointer to the base address of the IP core. I don't know if MATLAB has an equivalent function or how can I map something from /dev/mem to the matlab program's address space?

 Accepted Answer

Hi @John,
To read AXI4 address location from Simulink, you can use a MATLAB Function Block to write a function to capture the data at the required address. MATLAB's "readmemory" function reads the data from AXI4 memory-mapped locations.
For more information and steps, refer to the following MathWorks documentation links:
I hope this is beneficial!

1 Comment

I wasn't necessarily trying to access RAM but instead accessing a custom IP core from the processor's address space. I was able to solve this problem by editing the device tree on the cyclone V to allocate a region of address space for my IP core and load the Mathworks mwipcore driver for this device. I was then able to use the AXI4 Read block in Simulink https://www.mathworks.com/help/ecoder/alterasoc/ref/axi4read.html except I changed the device name parameter from /dev/mwipcore to where my device was located. I found this link helpful for understanding how to edit the device tree using HDL Coder: https://www.mathworks.com/help/hdlcoder/ug/generate-devicetree-for-ip-core.html . I'll accept your answer anyway in case someone else finds it helpful.

Sign in to comment.

More Answers (0)

Products

Release

R2024b

Tags

Asked:

on 14 Mar 2025

Commented:

on 10 Apr 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!