Errors when using HDL coder

Hallo, when i was using hdl coder for my project, and I keep getting this issue:
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)

댓글 수: 4

Raghu Boggavarapu
Raghu Boggavarapu 2025년 11월 24일
Xiaotong Could you please share with us some steps to reproduce the issue.
Xiaotong
Xiaotong 2025년 11월 25일
편집: Xiaotong 2025년 11월 25일
Hi, I tried this code in hdlcoder in both Matlab and simulink, and the issue appeared:
function [out,out_valid ] = Interleave3 (in, in_valid, in_start, in_final, iBIL)
persistent T v v_valid i j k in_buffer E STARTED READY1 READY2 out_buffer
if isempty(v)
T = uint16(0);
v = false(1,2025); %% 45*45
v_valid = false(1,2025);
i = uint16(0);
j = uint16(0);
k = uint16(0);
E = uint16(0);
STARTED = false;
in_buffer = false(1,1024);
READY1 = false;
READY2 = false;
out_buffer = false(1,1024);
end
T = uint16(ceil((cordicsqrt(1 + bitsll(E,3))-1) / 2 ));
out = false;
out_valid = false;
if in_start
T = uint16(0);
v = false(1,2025); %% 45*45
v_valid = false(1,2025);
i = uint16(0);
j = uint16(0);
k = uint16(0);
E = uint16(0);
STARTED = true;
in_buffer = false(1,1024);
READY1 = false;
READY2 = false;
out_buffer = false(1,1024);
end
if in_valid && STARTED
E = E+1;
in_buffer(E) = in;
end
if in_final && STARTED
READY1 = true;
STARTED = false;
end
if READY1
if i<=T
%coder.unroll();
%for q = 1:16
if j<T-i
if k<E
v(i+45*j+1) = in_buffer(k+1);
v_valid(i+45*j+1) = true;
end
k = k+1;
j = j+1;
end
if j<T-i
if k<E
v(i+45*j+1) = in_buffer(k+1);
v_valid(i+45*j+1) = true;
end
k = k+1;
j = j+1;
end
if j<T-i
if k<E
v(i+45*j+1) = in_buffer(k+1);
v_valid(i+45*j+1) = true;
end
k = k+1;
j = j+1;
end
if j<T-i
if k<E
v(i+45*j+1) = in_buffer(k+1);
v_valid(i+45*j+1) = true;
end
k = k+1;
j = j+1;
end
%end
if j == T-i
j = uint16(0);
i = i+1;
end
else
READY1 = false;
READY2 = true;
k = uint16(0);
i = uint16(0);
j = uint16(0);
end
end
if READY2
if j<=T
%coder.unroll();
%for q = 1:16
if i<T-j
out_buffer(k+1)= v(i+45*j+1) && v_valid(i+45*j+1) ;
k = k+1*uint16(v_valid(i+45*j+1));
i = i+1;
end
if i<T-j
out_buffer(k+1)= v(i+45*j+1) && v_valid(i+45*j+1) ;
k = k+1*uint16(v_valid(i+45*j+1));
i = i+1;
end
if i<T-j
out_buffer(k+1)= v(i+45*j+1) && v_valid(i+45*j+1) ;
k = k+1*uint16(v_valid(i+45*j+1));
i = i+1;
end
if i<T-j
out_buffer(k+1)= v(i+45*j+1) && v_valid(i+45*j+1) ;
k = k+1*uint16(v_valid(i+45*j+1));
i = i+1;
end
%end
if j == T
k = uint16(0);
end
if j == T-i
i = uint16(0);
j = j+1;
end
else
out_valid = true;
k = k+1;
out = out_buffer(k);
if k == E
READY2 = false;
end
end
end
end
Abhijeet
Abhijeet 2025년 11월 25일
Hello @Xiaotong,
Thanks for sharing your script. It appears the issue takes place within the "Fixed Point Conversion" step when you supply it with your test bench script. If you have supplied your own "Simulation Ranges" and "Proposed Types" please share that with us as well along with your test bench script. This will help us reproduce the issue and work on a fix.
Thanks.
Xiaotong
Xiaotong 2025년 11월 26일
thanks for you response. Here is my testbench; And I didn't manually specify the ranges, the ranges are analyzed from the tb.
function tb_Interleave3 ()
in = [1 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 0 1 1 0 1 0 0 0 1 1 ];
iBIL = true;
e = logical([in, zeros(1,500)]);
e_valid = logical([ones(1,54),zeros(1,500)]);
e_start = logical([1,zeros(1,500)]);
e_final = logical([zeros(1,53),1,zeros(1,500)]);
iBIL = true;
for i=1:500
[ult(i),ult_valid(i)] = Interleave3 (e(i),e_valid(i), e_start(i), e_final(i), iBIL);
end
end
Thanks!

댓글을 달려면 로그인하십시오.

답변 (1개)

Kiran Kintali
Kiran Kintali 2025년 11월 24일

0 개 추천

Can you reach out to technical support with the reproduction steps?

카테고리

도움말 센터File Exchange에서 Code Generation에 대해 자세히 알아보기

제품

질문:

2025년 11월 24일

댓글:

2025년 11월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by