UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 3497

F1.x State Machine Editor: Syntax Error 1031: Undefined identifier name 'SREG0'

Description

Keywords: user-defined encoding, XABEL, state machine

Urgency: Standard

General Description:

Specifying the encoding scheme as user-defined in
Foundation 1.x State Editor and then trying to synthesize the
state machine gives an error message resembling this:

Syntax Error 1031: Undefined identifier name 'SREG0'

as well as several other error messages.

The cause of this error is that state register declarations
are left out in the ABEL code generated for the user-defined
encoding scheme.

One can observe this behavior by comparing the ABEL code
generated for a binary encoded state machine to that
generated for a user-defined encoded state machine. In the
declaration section of an 8-state state machine one should
observe the following lines:


Declarations

"******** BINARY ENCODED state machine: Sreg0 ******
Sreg0_0 NODE istype 'reg';
xilinx property 'save Sreg0_0';
Sreg0_1 NODE istype 'reg';
xilinx property 'save Sreg0_1';
Sreg0_2 NODE istype 'reg';
xilinx property 'save Sreg0_2';

Sreg0 = [Sreg0_2, Sreg0_1, Sreg0_0];

S1 = 0;
S2 = 1;
S3 = 2;
S4 = 3;
S5 = 4;
S6 = 5;
S7 = 6;
S8 = 7;


As can be seen S1..S7 are assigned states in alpha-numerical
order. If one were to use user-defined encoding for the
same state assignments the code generated would look like:

"******** USER DEFINED ENCODED state machine: Sreg0 ******
"********
"******** !!!! USER have to declare: STATE REGISTER & ALL STATES CODES !!!!

S1 = 0;
S2 = 1;
S3 = 2;
S4 = 3;
S5 = 4;
S6 = 5;
S7 = 6;
S8 = 7;

Very obvious from the above code is that the state register
definitions are missing. The error results from the missing
state register definitions.




解决方案

1

As shown in the general description just cut & paste the
state register declarations from the code generated for a
binary encoded state machine into the code for the
user-defined code. From state machine editor:
Synthesis -> HDL Code Generation

When modifying the code in HDL editor make sure that the
Edit -> Read Only option is unchecked so that the necessary
modifications can be made. One can also modify the user
defined encoded states in the generated code file using HDL
editor. Save this file and synthesize directly from HDL
editor (Synthesis -> Synthesize). Now a macro for the state machine can also be created directly from the HDL editor.

Note: If one goes back to state editor and re-generates
HDL code for the state machine the previous version will
be overwritten. Hence one has to make sure to make the
necessary modifications again whenever any changes are made
to the state machine. This may turn out to be a hassle over
a longer period of time. A simpler alternative is resolution 2.

2

In state machine editor label the states in alphabetical
order the way one would have labeled the user-defined
numerical order. For example for a 4-state state machine:

S1 = 3;
S2 = 2;
S3 = 0;
S4 = 1;

This would classify under the user-defined encoding scheme.
One could implement this same sheme using binary encoding
just by renaming the state names in state editor as follows:

S3 is A, S4 is B, S2 is C and S1 is D OR
S3 is aardvark, S4 is acrobat, S2 is architect, S1 is burglar
and so on...

Since the state editor assigns state-number assignments
in aplhabetical order the above renaming would pass
as binary encoding and will also implement the desired
user-defined encoding.

The code generated will look like:

A = 0;
B = 1;
C = 2;
D = 3;
AR# 3497
创建日期 02/20/1998
Last Updated 04/04/2000
状态 Archive
Type 综合文章