prashanthi999
Member level 1
i have been implementing the sequence detection of 1101 in system generator using "mcode" block that performs state machines , i have understand the other things in code, but could not get the meaning of this sentence "persistent state , state = x1_state(start, {x1unsigned, 2,0});" can anybody tell what the meaning of that sentence
the whole code is of 1101 pattern detection
the whole code is of 1101 pattern detection
Code:
function matched = detect_1101(d_in)
start= 0;
found1=1;
found11=2;
found110=3;
persistent state , state = x1_state(start, {x1unsigned, 2,0});
matched = 0;
switch state
case start
if d_in ==1
state = found1;
else
state =start;
end
case found1
if d_in ==1
state = found11 ;
else
state =start;
end
case found11
if d_in ==0
state = found110;
else
state =found11;
end
case found110
if d_in ==1
state = found1;
matched = 1;
else
state = start;
end
otherwise
state = start;
end
end
Last edited by a moderator: