[libre-riscv-dev] [Bug 311] countzero function for Logic Pipeline

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri May 15 12:34:29 BST 2020


--- Comment #1 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
hm i don't think the count_right functionality is working correctly.  it
appears to count from the left up to the last 1, i.e. it returns

this is count leading zeros:

* cntlzd.  RA,RS (Rc=1)

    n <- 0
    do while n < 64
      if (RS)[n]  = 1 then
      n <- n + 1
    RA <- n

and this is count trailing zeros:

* cnttzd.  RA,RS (Rc=1)

    n  <- 0
    do while n < 64
       if (RS)[63-n] = 0b1 then
       n  <- n + 1
    RA <- EXTZ64(n)

i am inclined to suggest that the entire input be inverted via a mux and
that encoder *not* try to do inversion.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-riscv-dev mailing list