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.

Acessing state registers of a FSM for diagnostic purposes

Status
Not open for further replies.

anindya

Newbie level 4
Newbie level 4
Joined
Jun 21, 2010
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
india
Visit site
Activity points
1,341
ENTITY MOORE IS
PORT(A,CLK,RST:IN BIT;
F:OUT BIT);
END MOORE;

ARCHITECTURE FSMOF MOORE IS

SUBTYPE STATE_TYPE IS STD_
LOGIC_VECTOR (2DOWNTO 0);
SIGNAL STATE:STATE_TYPE;
CONSTANT S0:
STATE_TYPE:="001";
CONSTANT S1:
STATE_TYPE:="010";
CONSTANT S2:
STATE_TYPE:="100";
SIGNAL CURRENT_STATE,
NEXT_STATE :STATE_TYPE;
BEGIN
FF:pROCESS (CLK,RST)BEGIN
IF (RST=’1’)THEN
CURRENT_STATE <=S0 ;
ELSIF (CLK’EVENT AND CLK=’1’)
THEN
CURRENT_STATE<=NEXT_STATE;
END IF ;
END PROCESS FF ;
LOGIC:pROCESS (A,
CURRENT_STATE)BEGIN
CASE CURRENT_STATE IS
WHEN S0=>F <= ’0’;
IF (A=’0’)THEN
NEXT_STATE <=S 0;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN S1=>F <= ’0’;
IF (A=’0’)THEN
NEXT_STATE <=S2;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN S2=>F <= ’1’;
IF (A=’0’)THEN
NEXT_STATE <=S0;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN OTHERS =>
CURRENT_STATE <=S0;
END CASE;
END PROCESS;
END FSM ;

the Question is at run time how can i access the state register having So/S1 for diagnostic purposes ?
 

put your code like that

Code:
ENTITY MOORE IS
PORT(A,CLK,RST:IN BIT;
F:OUT BIT);
END MOORE;

ARCHITECTURE FSMOF MOORE IS

SUBTYPE STATE_TYPE IS STD_
LOGIC_VECTOR (2DOWNTO 0);
SIGNAL STATE:STATE_TYPE;
CONSTANT S0:
STATE_TYPE:="001";
CONSTANT S1:
STATE_TYPE:="010";
CONSTANT S2:
STATE_TYPE:="100";
SIGNAL CURRENT_STATE,
NEXT_STATE :STATE_TYPE;
BEGIN
FF:PROCESS (CLK,RST)BEGIN
IF (RST=’1’)THEN 
CURRENT_STATE <=S0 ;
ELSIF (CLK’EVENT AND CLK=’1’)
THEN
CURRENT_STATE<=NEXT_STATE;
END IF ;
END PROCESS FF ;
LOGIC:PROCESS (A,
CURRENT_STATE)BEGIN
CASE CURRENT_STATE IS
WHEN S0=>F <= ’0’;
IF (A=’0’)THEN
NEXT_STATE <=S 0;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN S1=>F <= ’0’;
IF (A=’0’)THEN
NEXT_STATE <=S2;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN S2=>F <= ’1’;
IF (A=’0’)THEN
NEXT_STATE <=S0;
ELSE
NEXT_STATE <=S1;
END IF;
WHEN OTHERS =>
CURRENT_STATE <=S0;
END CASE;
END PROCESS;
END FSM ;

- - - Updated - - -

Now to your question. Declare current_state as output. This is how you can debug states of moore fsm.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top