need help... VHDL Variable problem...

Discussion in 'VHDL' started by elements_me, Dec 16, 2007.

  1. elements_me

    elements_me

    Joined:
    Dec 16, 2007
    Messages:
    2
    my variable (ADDER) value don't know y change to some others value @@... can everybody help me... my codes is below...

    ENTITY neo IS
    PORT ( I_10 , I_20 , I_50 : IN STD_LOGIC;
    X : IN STD_LOGIC;
    clk : IN STD_LOGIC;
    END neo;

    ARCHITECTURE beha OF neo IS

    TYPE states IS ( SR , S0 );
    SIGNAL state : states;
    SIGNAL CD : STD_LOGIC_VECTOR ( 5 DOWNTO 0 );
    SIGNAL E : STD_LOGIC;
    SIGNAL EX : STD_LOGIC;
    SIGNAL RD1 , RD2 : STD_LOGIC :='0' ;
    SIGNAL S_ADDER : INTEGER range 0 to 140 := 0;
    SIGNAL ID : STD_LOGIC_VECTOR ( 2 DOWNTO 0 );

    BEGIN

    ID <= I_50 & I_20 & I_10;
    CD <= R & E & X & S & EX;

    PROCESS ( clk , state , X , I_10 , I_20 , I_50 )
    VARIABLE A_A , A_B , A_C , A_10 , A_20 , A_50 : INTEGER;
    VARIABLE ADDER : INTEGER := 0;
    BEGIN
    IF rising_edge ( clk ) THEN
    CASE state IS
    WHEN SR =>
    IF ( RD1 = '1' ) THEN
    ADDER := 0;
    T_ADDER := 0;
    A_10 := 100;
    A_20 := 100;
    A_50 := 100;
    E <= '0';
    EX <= '0';
    RD2 <= '1';
    END IF;

    WHEN S0 =>
    IF ( ADDER < 100 ) THEN
    CASE ID IS
    WHEN "001" =>
    ADDER := ADDER + 10;
    WHEN "010" =>
    ADDER := ADDER + 20;
    WHEN "100" =>
    ADDER := ADDER + 50;
    WHEN OTHERS =>
    NULL;
    END CASE;
    END IF;

    state SR will go to state S0 after those value reset ( no show in the code ) ... the problem is the value of ADDER,,, let's said I_50 = '1'... the ID = "100"... and ADDER should be 50... but the face is when i see the timing diagram... the adder value is not 50... it is something else... like 32 like that... how come ??? help... really take me long time to check it le...:-(
    elements_me, Dec 16, 2007
    #1
    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. emy86evil
    Replies:
    1
    Views:
    458
    emy86evil
    Nov 21, 2006
  2. afd
    Replies:
    1
    Views:
    8,232
    Colin Paul Gloster
    Mar 23, 2007
  3. ro888
    Replies:
    1
    Views:
    683
    jcayer
    Apr 30, 2008
  4. omara007
    Replies:
    0
    Views:
    1,455
    omara007
    Jan 6, 2010
  5. Wing Chun
    Replies:
    7
    Views:
    781
Loading...

Share This Page