doubt in variable passing in multiple process

Discussion in 'VHDL' started by chaitanyakurmala@gmail.com, Sep 22, 2006.

  1. Guest

    let me say

    i am having two processes
    process(clk1) and process(clk2)


    process(clk1)
    variable x:natural:=0;
    begin
    if clk'event and clk='1' then
    x := x+1;
    end if
    end process;

    process(clk2)
    begin
    ----
    -------
    -----
    end process

    in the 1st process x may be changed to some 10 let me say.
    and i want that variable with changed value to be utilized in 2nd
    process how can i do it.
    if i declare variable x before process1 it is giving error that shared
    variables only should be declared here.
    thank you
     
    , Sep 22, 2006
    #1
    1. Advertising

  2. David Ashley Guest

    wrote:
    > let me say
    >
    > i am having two processes
    > process(clk1) and process(clk2)
    >
    >
    > process(clk1)
    > variable x:natural:=0;
    > begin
    > if clk'event and clk='1' then
    > x := x+1;
    > end if
    > end process;
    >
    > process(clk2)
    > begin
    > ----
    > -------
    > -----
    > end process
    >
    > in the 1st process x may be changed to some 10 let me say.
    > and i want that variable with changed value to be utilized in 2nd
    > process how can i do it.
    > if i declare variable x before process1 it is giving error that shared
    > variables only should be declared here.
    > thank you
    >


    Dude there's gotta be a better way of learning the language. This
    is too much hand holding, these are fundamental things in VHDL.
    Read your book, work the examples. It's all there...

    -Dave

    --
    David Ashley http://www.xdr.com/dash
    Embedded linux, device drivers, system architecture
     
    David Ashley, Sep 22, 2006
    #2
    1. Advertising

  3. Variable declared in a process are only available for that process. I
    think you better study some more basics before approaching any project.

    wrote:
    > let me say
    >
    > i am having two processes
    > process(clk1) and process(clk2)
    >
    >
    > process(clk1)
    > variable x:natural:=0;
    > begin
    > if clk'event and clk='1' then
    > x := x+1;
    > end if
    > end process;
    >
    > process(clk2)
    > begin
    > ----
    > -------
    > -----
    > end process
    >
    > in the 1st process x may be changed to some 10 let me say.
    > and i want that variable with changed value to be utilized in 2nd
    > process how can i do it.
    > if i declare variable x before process1 it is giving error that shared
    > variables only should be declared here.
    > thank you
    >
     
    alessandro basili, Sep 22, 2006
    #3
  4. wrote:

    > let me say
    >
    > i am having two processes
    > process(clk1) and process(clk2)
    >
    >
    > process(clk1)
    > variable x:natural:=0;
    > begin
    > if clk'event and clk='1' then
    > x := x+1;
    > end if
    > end process;
    >
    > process(clk2)
    > begin
    > ----
    > -------
    > -----
    > end process
    >
    > in the 1st process x may be changed to some 10 let me say.
    > and i want that variable with changed value to be utilized in 2nd
    > process how can i do it.


    Use a signal. Signals are the normal way for communication between
    processes.

    > if i declare variable x before process1 it is giving error that
    > shared variables only should be declared here.
    > thank you


    Variables declared outside a process must be declared shared. But stay
    away from shared variables as a beginner. With shared variables it is
    possible to create non-deterministic behavior. So for now stay clear.
    First learn the fundamentals of VHDL.

    --
    Paul.
     
    Paul Uiterlinden, Sep 22, 2006
    #4
  5. Paul Uiterlinden wrote:

    > Use a signal. Signals are the normal way for communication between
    > processes.


    Or do all of the logic using the variable x_v in the same process.
    A process port assignment like
    my_port <= x_v;
    will then do the job without any interposed signals.

    -- Mike Treseler
     
    Mike Treseler, Oct 2, 2006
    #5
    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. Bob Nelson

    doubt about doubt

    Bob Nelson, Jul 28, 2006, in forum: C Programming
    Replies:
    11
    Views:
    627
  2. pereges
    Replies:
    7
    Views:
    438
    pereges
    Jun 1, 2008
  3. Replies:
    0
    Views:
    566
  4. Peter Otten
    Replies:
    2
    Views:
    118
    Cousin Stanley
    Aug 10, 2013
  5. Terry Reedy
    Replies:
    0
    Views:
    120
    Terry Reedy
    Aug 10, 2013
Loading...

Share This Page