08-11-2011 06:56 PM
In my design, I want to add a StateMachine into the .cdc file, using the Chipscope to monitor how the StateMachine works. The StateMachine ,which I give the name "reg [9:0] CBLTDataBuildIIStateManchine" in my code, has ten-state. However, when come to editing the Chipscope cdc file, the states increased to more than 10 states in the Net name list. As you can see in the picture, the states has increased to 18 states, many suffixes being added, and I don't know what these suffixes want to tell me?
My question is: How I can Monitor this StateMachine? Within these 18 states, which ones should I choose in my "Data Signals" Tab.
I appreciate for your help! ^_^
08-11-2011 09:19 PM
It's often the case that synthesis tool implements state machines differently than they're coded in HDL. For example, the default behaviour of XST is to implement small state machines as one-hot.
You can search the synthesis report for "CBLTDataBuildIIStateMachine" to get better idea how it's being synthesized.
One way to monitor a state machine without interfering with the synthesis tool optimizations is to assign states and not bits, as follows:
assign chipscope_bit_0 = CBLTDataBuildIIStateManchine == MY_STATE_0;
assign chipscope_bit_1 = CBLTDataBuildIIStateManchine == MY_STATE_1;
The disadvantage of this method is that it has to be done before synthesis.
08-11-2011 09:58 PM
Another thing you can do is force the FSM to use 'user' encoding, though this might result in poorer timing if XST determined that some other method was superior.
(* fsm_encoding = "user" *) reg [6:0] state = 0;
08-12-2011 08:20 AM
It looks to me like your machine actually coded into fewer state variables. When looking
for your state variable, watch the right column "Base Type" and select the signals that
are coming from flip-flops rather than LUTs. In your case that would be:
Another thing I found is that XST likes to reverse the bit numbering when encoding
states. So if this is actually binary encoded, I would expect FSM_FFd1 to be the
most significant bit. Even if it is binary encoded, the states may not match your source
unless you took Joelby's advice and used "user" encoding.
09-05-2011 08:23 PM
What exactly did you try?
Are you sure that all of your states are actually reachable? They'll be optimised out if they can never be reached.
Looking at your screenshot again, most of the signals you highlighted are LUTs of uncertain function. In this case, you probably only care about the state register, which are the ones of base type FDC_1. Have a look at your synthesis output to see how your FSM states have been translated to hardware.