Assigning present state to output.

Discussion in 'VHDL' started by Mohammed A.khader, Sep 6, 2004.

  1. 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
     
    Mohammed A.khader, Sep 6, 2004
    #1
    1. Advertising

  2. "Mohammed A.khader" <> schreef in bericht
    news:...
    > 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
     
    Egbert Molenkamp, Sep 6, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simone Winkler

    assigning output to input

    Simone Winkler, Aug 28, 2003, in forum: VHDL
    Replies:
    1
    Views:
    1,855
    Jonathan Bromley
    Aug 28, 2003
  2. Helixpoint
    Replies:
    8
    Views:
    548
    Marina
    Jun 26, 2003
  3. Ralf Wahner
    Replies:
    5
    Views:
    635
    Bob Foster
    Dec 24, 2003
  4. sams
    Replies:
    1
    Views:
    205
    Martin Honnen
    Oct 12, 2003
  5. weston
    Replies:
    1
    Views:
    256
    Richard Cornford
    Sep 22, 2006
Loading...

Share This Page