element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
FPGA
  • Technologies
  • More
FPGA
Blog Use MATLAB to Debug your SoC IP Core
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join FPGA to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mbrown
  • Date Created: 27 Apr 2018 9:02 PM Date Created
  • Views 1366 views
  • Likes 8 likes
  • Comments 1 comment
  • ultrazed
  • soc
  • avnet design
  • avnet
  • ultrascale
  • zynq
  • xilinx
  • fpgafeatured
  • mathworks
  • matlab
  • xilinx zynq ultrascale
  • hdl verifier
  • xilinx zynq
  • matthew brown
  • avnet_coding
  • simulink
Related
Recommended

Use MATLAB to Debug your SoC IP Core

mbrown
mbrown
27 Apr 2018

Recently I discovered a clever way in MATLAB to interact with my HDL IP cores in situ, running in the programmable logic. Yes, of course, there are many ways to probe logic in an FPGA, but this one is particularly helpful when I need to analyze bits that represents sampled signals.

 

A few benefits of this method:

  • Simple setup – ARM subsystem is not involved
  • Pass buffers of data to/from MATLAB workspace
  • Post-capture analysis natively in MATLAB (no need to transfer vector files)

 

With only a JTAG connection to your PC and a little IP block (below) in your Vivado design, you can use the MATLAB HDL Verifier tool to access any AXI-based peripheral in your Xilinx SoC.

image

 

This is the MATLAB as AXI Master block. A similar token exists in the Xilinx Vivado IP catalog, called JTAG to AXI Master. Don’t get the two confused.

 

The Xilinx version is great for issuing TCL commands to address AXI-based peripherals, send and receive data, and verify bus transactions are happening correctly. The MATLAB as AXI Master block provides the same functionality, but instead of TCL in Vivado you can work natively at the MATLAB command prompt.

 

The hardware I'm using today is Avnet’s UltraZed 3EG System-on-Module. Buy UltraZed 3EG Starter KitBuy UltraZed 3EG Starter Kit

 

image

I recently posted Program MiniZed over WiFi using Simulink to introduce a way to quickly start designing Xilinx Zynq SoCs applications, long before you understand the complexity of the hardware and software required. In today’s blog I am narrowing our scope. We’ll put code generation aside and explore a simple way to move samples (data) in and out of the programmable logic (PL) subsystem of a Xilinx MPSoC.

 

Let’s see how the MATLAB as AXI Master is put into service in a Vivado IPI Block Design for UltraScale+ MPSoC.

image

I said that the ARM isn’t involved in the system, but here it is in the diagram. Why?

 

The processor subsystem (PS) is providing the clock to my PL design. That’s all. Nothing else. So the Zynq US+ MPSoC block must be in the design, but rest assured that

no SDK work is required. In fact, the block is automatically configured by way of Avnet's Board Definition File (BDF) for the UltraZed EG kit.

 

The device under test (DUT) in this case would be any AXI peripheral IP you connect to the master port of the AXI Interconnect block. As a first design, I simply connected an AXI BRAM Controller and a modest amount of BRAM from the Vivado IP catalog.

image

With this minimal Vivado infrastructure in place, I can now issue simple read/write memory commands in MATLAB to transfer data to/from my IP peripheral (BRAM in this case).

 

The address of my AXI IP peripheral is easy to find in the Vivado “Address Editor”

image

You can see the base address of my AXI BRAM peripheral is 0xC000_0000.

To write 255 to my IP peripheral I simply type the following in the MATLAB command window:

 

     >> h.writememory('c0000000', 255)

 

To write a block of memory from MATLAB workspace, just reference a variable from your workspace.

 

     >> h.writememory(' c0000000', pskwave)

 

Reading from a single location in the peripheral is just as easy.

 

     >> rx = h.readmemory(' c0000000',256)

 

If you want to read a contiguous section of memory space in your IP peripheral, specify a start address and offset, and HDL Verifier will retrieve the data.

 

     >> rx = h.readmemory(' c0000000',32000)

 

Once you have the data in MATLAB workspace, the signal processing world is your oyster.

 

You can now run algorithmic scripts to manipulate the data, or use spectral analysis to dissect the frequency domain quality, plot data in a spectrum scope … you get the idea.

Note: you can even program the device directly from the MATLAB command window.

 

     >> filProgramFPGA('Xilinx Vivado', fpgaFile, 1);

 

Pretty impressive considering it only requires you to add a small JTAG block into your design. Even a beginner with the Vivado tools can tackle this kind of modification in an afternoon.

 

Enjoy!

  • Sign in to reply

Top Comments

  • rachaelp
    rachaelp over 7 years ago +4
    Oh this looks very cool! I'm planning to get back into some more serious FPGA design this year as it's been too long since I did a really big FPGA design and I was also looking at MatLab and this seems…
  • rachaelp
    rachaelp over 7 years ago

    Oh this looks very cool! I'm planning to get back into some more serious FPGA design this year as it's been too long since I did a really big FPGA design and I was also looking at MatLab and this seems like a good excuse justification for spending the money on a MatLab license!

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube