HDL Coder Java null pointer exception during automatic Fixed-Point conversion
Show older comments
I was testing a design with HDL Coder and kept running into a Java NullPointerException. To debug the issue, I created several simple tests each involving matrix-wise power, matrix transpose, and complex numbers, HDL Coder still reports basically same errors for these operations.
Error code:
Exception in thread "AWT-EventQueue-0": java.lang.NullPointerException
at com.mathworks.toolbox.coder.model.MetadataTree.getFunctionNode(MetadataTree.java:59)
at com.mathworks.toolbox.coder.model.MetadataTree.getNode(MetadataTree.java:44)
at com.mathworks.toolbox.coder.model.MetadataTree.put(MetadataTree.java:27)
at com.mathworks.toolbox.coder.mi.ConversionUtils.convertRangesAndTypes(ConversionUtils.java:562)
at com.mathworks.toolbox.coder.mi.ConversionUtils.convertRangesAndTypes(ConversionUtils.java:500)
at com.mathworks.toolbox.coder.fixedpoint.FixedPointController.handleSimulationResults(FixedPointController.java:690)
at com.mathworks.toolbox.coder.fixedpoint.FixedPointController.access$1100(FixedPointController.java:71)
at com.mathworks.toolbox.coder.fixedpoint.FixedPointController$11.handleResult(FixedPointController.java:506)
at com.mathworks.toolbox.coder.mi.FevalCommand$1.run(FevalCommand.java:119)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Accepted Answer
More Answers (1)
Navan Ruthramoorthy
on 28 Jan 2026 at 19:59
1 vote
Hi Xiaotong,
Your test bench files do not seem to be calling the design files you have attached. For example, the function tb_hdl_matrix_power calls hdl_matrix_power which is not attached. But you have attached hdl_array_power.m.
Could you share which release you are using?
To see a working example you can type
>> mlhdlc_demo_setup sfir
This will create a temporary folder with sample design and testbench. You can use the files mlhdlc_sfir (design) and mlhdlc_sfir_tb (test bench) from the temporary directory that got created and try HDL code generation.
Categories
Find more on Code Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!