Skip to content

Latest commit

 

History

History
50 lines (41 loc) · 975 Bytes

ff1.adoc

File metadata and controls

50 lines (41 loc) · 975 Bytes

th.ff1

Synopsis

Find first '1'-bit

Mnemonic

th.ff1 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: 0x3 },
    { bits:  5, name: 0x10 },
]}
Description

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

Operation
for i=xlen..0:
  if reg[rs1][i] == 1:
    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])