Basics of VHDL. Whats happening here?

Discussion in 'VHDL' started by vikramtheone, Jun 1, 2009.

  1. vikramtheone

    vikramtheone

    Joined:
    Jun 1, 2009
    Messages:
    3
    I just started to learn VHDL so kindly support me
    I'm getting confused between how <= and := symbols actually work? I know that they have a major difference but I cant really make out as I'm from s/w background.

    For example in the following code, when do :=, <= statements execute? Please don't stop at saying one is sequential and other is concurrent, that is where I'm not able to understand please explain more with small examples and other possibilities. I really learn fast with examples.

    Also can you please explain to me whats happening in this code? I'm really lost.

    ******** Code****************
    architecture twoproc of test is
    signal r, rin : std_logic_vector(7 downto 0);
    begin

    combinational : process(load, count, d, r)
    variable tmp : std_logic_vector(7 downto 0);
    begin
    if load = ’1’ then tmp := d;
    elsif count = ’1’ then tmp := r + 1;
    else tmp := r; end if;
    rin <= tmp;
    q <= r;
    end process;

    sequential : process(clk)
    begin
    if rising_edge(clk) then r <= rin; end if;
    end process;
    end;
    *******************************


    Thank you all so very much!!!
    vikramtheone, Jun 1, 2009
    #1
    1. Advertising

  2. vikramtheone

    jeppe

    Joined:
    Mar 10, 2008
    Messages:
    348
    Location:
    Denmark
    Well you found one the "cornerstones" of VHDL - the difference between signals and variables.

    A signal will not get its value before the process ends while the variable gets its value immediate (as in C++, Java, C# etc.)

    I you add "r" to the sensitivity list will your code work nicely. The problem is that "r" must be able to
    trigger the process in order to pass the value to q.
    But I will surgest that you pass rin directly to q in the clk-driven process.

    Please search for the free interactive book on VHDL Evita from aldec. Specially chapter 6 will answer your questions.

    Your welcome
    Jeppe
    Last edited: Jun 1, 2009
    jeppe, Jun 1, 2009
    #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. nin234@yahoo.com

    What is happening here

    nin234@yahoo.com, Feb 21, 2005, in forum: C++
    Replies:
    3
    Views:
    407
    Howard
    Feb 22, 2005
  2. dan miller (moderator, s.p.d)

    what is happening here?

    dan miller (moderator, s.p.d), Apr 6, 2004, in forum: Python
    Replies:
    3
    Views:
    354
  3. parag_paul@hotmail.com

    whats happening here

    parag_paul@hotmail.com, Mar 25, 2008, in forum: C Programming
    Replies:
    4
    Views:
    2,575
    Eric Sosman
    Mar 25, 2008
  4. tschmittldk
    Replies:
    8
    Views:
    377
    Jorgen Grahn
    Dec 29, 2010
  5. George George

    what is happening here

    George George, Apr 8, 2009, in forum: Ruby
    Replies:
    6
    Views:
    133
    George George
    Apr 9, 2009
Loading...

Share This Page