Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

Assign needed

Hi,

May I why do we need the assign value when we do the looping? Is that because when looping there is no wire assign to it? when I assign to q1 = q [1] the circuit would be different when q1 = q[2].

Any help would be very much appreciated

4 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Hi,

    May I why do we need the assign value when we do the looping? Is that because when looping there is no wire assign to it? when I assign to q1 = q [1] the circuit would be different when q1 = q[2].

    Any help would be very much appreciated

    --- Quote End ---

    Hi,

    do you mean this statement :

    assign q1 = q[2];

    q1 is defined as output and must be driven continously. BTW: you assign a 8-bit (q[2]) vector to an 32-bit vector [q1] . Is that indented ?

    Kind regards

    GPK
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply,

    Yes. that is intended.

    "q1 is defined as output and must be driven continously", can you explain more about this? what does the assign actually do on that? extending the wire for the output?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Thanks for your reply,

    Yes. that is intended.

    "q1 is defined as output and must be driven continously", can you explain more about this? what does the assign actually do on that? extending the wire for the output?

    --- Quote End ---

    Hi,

    yes it is like a wire to the output.

    "when I assign to q1 = q [1] the circuit would be different when q1 = q[2]."

    It looks different, because of logic optimization. You defined the input num_reg as

    a 3-bit vector. That means you can have up to 8 Registers. You never will use q[0],

    because your loop index starts with 2. When you assign the output q1 to e.g. q[1]

    Quartus recognized that all registers with a higher index as "1" are not used und will

    be not implemented.

    Kind regards

    GPK