Variable Not fully defined on some execution path error
Ältere Kommentare anzeigen
I have some code that is inside a simulink block that gets an error when it's compiled. It says a variable is not fully defined on some execution paths, but it's not true.
Here's a simplified version of the code:
function myfunc(logicA, logicB)
A = logicA;
B = logicB; % also input from the function
if A
X = 1;
elseif B
X = 2;
end
if (A || B)
Y = X;
end
It complies fine if I change it to
function myfunc(logicA, logicB)
A = logicA;
B = logicB; % also input from the function
X=2
if A
X = 1;
end
if (A || B)
Y = X;
end
It looks like the compiler doesn't realize that it doesn't need X if (A || B) is false?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu HDL Verifier finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!