Forum Discussion

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

Verilog

in verilog, how to do like q <= d[count:0]?

reg [3:0] count;

thanks

14 Replies

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

    I didn't understand your intention yet. Do you mean to select a single bit? [count:0] is a range rather than a bit. Please clarify also the type of the other involved signals.

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

    Fvm,

    i have tried on iteration but all fails. do you any simple example on iteration for my case?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You might get a registered mux out of that. Really though I would re-write that as a mux if that was your intent since someone picking up your source file might struggle to figure out what it's supposed to do.

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

    The expression can't result in a valid syntax, I think. The right-hand-side has a variable length, it can't be assigned to a target with (obviously) fixed length. Furthermore variable ranges are not supported. You should think about an iteration, that copies individual bits.