shall I reuse a variable/signal or not?

Discussion in 'VHDL' started by walala, Sep 12, 2003.

  1. walala

    walala Guest

    Dear all,

    Here is a fragment of my code... t1, t2, t3, t4, temp1, temp2, temp3,
    temp4 are my temporary variables... Y0, Y7, Y1, Y6 are the actual
    result I want to output...

    I want to know if I can re-use t1, t2 and temp1 and temp2, that's to
    say, don't use t3, t4, temp3 and temp4? What will be the impact of
    that change to my circuit?

    Less storage memory? Less adders?

    Can anybody tell me?

    Thanks a lot,

    -Walala
    ----------------------------------------------------------------------------


    t1:=91*ZZ(0)(count2)+118*ZZ(2)(count2)+91*ZZ(4)(count2)+49*ZZ(6)(count2);

    t2:=126*ZZ(1)(count2)+106*ZZ(3)(count2)+71*ZZ(5)(count2)+25*ZZ(7)(count2);
    temp1:=t1+t2;
    temp2:=t1-t2;
    Y0<=temp1(23 downto 16);
    Y7<=temp2(23 downto 16);


    t3:=91*ZZ(0)(count2)+49*ZZ(2)(count2)-91*ZZ(4)(count2)-118*ZZ(6)(count2);

    t4:=106*ZZ(1)(count2)-25*ZZ(3)(count2)-126*ZZ(5)(count2)-71*ZZ(7)(count2);
    temp3:=t3+t4;
    temp4:=t3-t4;
    Y1<=temp1(23 downto 16);
    Y6<=temp2(23 downto 16);
     
    walala, Sep 12, 2003
    #1
    1. Advertising

  2. walala

    Jon Guest

    Hi Walala,
    There really is no hardware impact of reusing the variables but for
    clarity and ease of debug keep them seperate.

    Jon

    (walala) wrote in message news:<>...
    > Dear all,
    >
    > Here is a fragment of my code... t1, t2, t3, t4, temp1, temp2, temp3,
    > temp4 are my temporary variables... Y0, Y7, Y1, Y6 are the actual
    > result I want to output...
    >
    > I want to know if I can re-use t1, t2 and temp1 and temp2, that's to
    > say, don't use t3, t4, temp3 and temp4? What will be the impact of
    > that change to my circuit?
    >
    > Less storage memory? Less adders?
    >
    > Can anybody tell me?
    >
    > Thanks a lot,
    >
    > -Walala
    > ----------------------------------------------------------------------------
    >
    >
    > t1:=91*ZZ(0)(count2)+118*ZZ(2)(count2)+91*ZZ(4)(count2)+49*ZZ(6)(count2);
    >
    > t2:=126*ZZ(1)(count2)+106*ZZ(3)(count2)+71*ZZ(5)(count2)+25*ZZ(7)(count2);
    > temp1:=t1+t2;
    > temp2:=t1-t2;
    > Y0<=temp1(23 downto 16);
    > Y7<=temp2(23 downto 16);
    >
    >
    > t3:=91*ZZ(0)(count2)+49*ZZ(2)(count2)-91*ZZ(4)(count2)-118*ZZ(6)(count2);
    >
    > t4:=106*ZZ(1)(count2)-25*ZZ(3)(count2)-126*ZZ(5)(count2)-71*ZZ(7)(count2);
    > temp3:=t3+t4;
    > temp4:=t3-t4;
    > Y1<=temp1(23 downto 16);
    > Y6<=temp2(23 downto 16);
     
    Jon, Sep 14, 2003
    #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. tshad
    Replies:
    5
    Views:
    562
    Steve C. Orr [MVP, MCSD]
    May 17, 2005
  2. Hylander

    To reuse or not to reuse....

    Hylander, Feb 26, 2004, in forum: Java
    Replies:
    0
    Views:
    442
    Hylander
    Feb 26, 2004
  3. code reuse and design reuse

    , Feb 7, 2006, in forum: C Programming
    Replies:
    16
    Views:
    1,066
    Malcolm
    Feb 12, 2006
  4. Replies:
    5
    Views:
    553
    Richard Bos
    Mar 31, 2006
  5. jacob navia

    To reuse or not to reuse

    jacob navia, Nov 5, 2006, in forum: C Programming
    Replies:
    19
    Views:
    570
    Dave Thompson
    Dec 18, 2006
Loading...

Share This Page