Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 975 Bytes

ff0.adoc

File metadata and controls

50 lines (41 loc) · 975 Bytes

th.ff0

Synopsis

Find first '0'-bit

Mnemonic

th.ff0 rd, rs1

Encoding
{reg:[
    { bits:  7, name: 0xb, attr: ['custom-0, 32 bit'] },
    { bits:  5, name: 'rd' },
    { bits:  3, name: 0x1 },
    { bits:  5, name: 'rs1' },
    { bits:  5, name: 0x0 },
    { bits:  2, name: 0x2 },
    { bits:  5, name: 0x10 },
]}
Description

Finds the first bit with the value of '0' from the highest bit of rs1 and writes the index back into register rd. If the highest bit of rs1 is '0', the result '0' is returned. If all the bits in rs1 are '1', XLEN is returned.

Operation
for i=xlen..0:
  if reg[rs1][i] == 0:
    break;
reg[rd] = (xlen - 1) - i
Permission

This instruction can be executed in all privilege levels.

Exceptions

This instruction does not trigger any exceptions.

Included in
Extension

XTheadBb ([xtheadbb])