Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Assigning present state to output.

Reply
Thread Tools

Assigning present state to output.

 
 
Mohammed A.khader
Guest
Posts: n/a
 
      09-06-2004
Hi all,

I have a State Machine with 6 states (binary encoded).
TYPE state_vector IS (s0,s1,s2,s3,s4,s5);
SIGNAL pstate,nstate : state_vector;

In order to avoid combinational logic after Filp Flops in a moore
model , I want to assign specific binary values so that I could take
o/ps directly from Flip Flops.

what should I do to achieve it ? I know about the Pragma
ENUM_ENCODING, but it is only for sythesis.I want to check design by
simulation. Is there any particular keyword or other means to assign
particular value to states in VHDL.

Later I have the PORT MAP the o/p from Filp Flop (Present state) to
the next module(which is of type std_logic). Hence I need to convert
the SIGNAL pstate (see above signal declaratoin) to type std_logic.
what could be the better way to do this ?

Thanks in Advance.

IDEA always invited !
Mohammed A. Khader
 
Reply With Quote
 
 
 
 
Egbert Molenkamp
Guest
Posts: n/a
 
      09-06-2004
"Mohammed A.khader" <> schreef in bericht
news: om...
> Hi all,
>
> I have a State Machine with 6 states (binary encoded).
> TYPE state_vector IS (s0,s1,s2,s3,s4,s5);
> SIGNAL pstate,nstate : state_vector;
>
> In order to avoid combinational logic after Filp Flops in a moore
> model , I want to assign specific binary values so that I could take
> o/ps directly from Flip Flops.


If you want the output to be an output of a flipflop you can also assign to
that output signal in the"synchronous part" of the process.
The you will get then automatically a flipflop. Maybe more flipflops then
minimal required for the system.

>
> what should I do to achieve it ? I know about the Pragma
> ENUM_ENCODING, but it is only for sythesis.I want to check design by
> simulation. Is there any particular keyword or other means to assign
> particular value to states in VHDL.


During simulation your type state_vector is not mapped on any code. During
simulation you will see the states s0 .. s5.
If you want to simulate also the coding you could use the following approach

constant s0 : std_logic_vector(2 downto 0):="000";
...
constant s5 : std_logic_vector(2 downto 0):="101";
signal (or variable) state : std_logic_vector(2 downto 0);]
and then the code you have.

Now you have a combination "logical namens (the constants)" and the binary
code.
>
> Later I have the PORT MAP the o/p from Filp Flop (Present state) to
> the next module(which is of type std_logic). Hence I need to convert
> the SIGNAL pstate (see above signal declaratoin) to type std_logic.
> what could be the better way to do this ?


If the next module requires type std_logic(_vector) you have to make the
conversion. You can write a function.
However if the type state is globaly known you can still use s0 .. s5.

Egbert Molenkamp


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OS present but not present. XPD NZ Computing 4 04-11-2007 11:22 PM
Assigning methods to objects, and assigning onreadystatechange to an XMLHttpRequest -- an inconsistency? weston Javascript 1 09-22-2006 09:33 AM
Unable to serialize the session state. Please note that non-serializable objects or MarshalByRef objects are not permitted when session state mode is 'StateServer' or 'SQLServer'. Mike Larkin ASP .Net 1 05-23-2005 12:33 PM
Schema: express that "@a present if and only if @b present", where @a, @b are attributes Ralf Wahner XML 5 12-24-2003 11:37 AM
State machine: how to stay in a state? David Lamb VHDL 1 09-15-2003 05:24 PM



Advertisments