Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

mcode block in system generator

Status
Not open for further replies.

prashanthi999

Member level 1
Joined
Nov 19, 2014
Messages
39
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
287
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

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:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top