Skip to content

Commit

Permalink
Add unratified B extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ved-rivos committed Jan 7, 2024
1 parent d7a3d80 commit d154ad6
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 84 deletions.
32 changes: 16 additions & 16 deletions model/riscv_insts_zba.sail
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
/* ****************************************************************** */
union clause ast = RISCV_SLLIUW : (bits(6), regidx, regidx)

mapping clause encdec = RISCV_SLLIUW(shamt, rs1, rd) if haveZba() & sizeof(xlen) == 64
<-> 0b000010 @ shamt @ rs1 @ 0b001 @ rd @ 0b0011011 if haveZba() & sizeof(xlen) == 64
mapping clause encdec = RISCV_SLLIUW(shamt, rs1, rd) if (haveZba() | haveBExt()) & sizeof(xlen) == 64
<-> 0b000010 @ shamt @ rs1 @ 0b001 @ rd @ 0b0011011 if (haveZba() | haveBExt()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_SLLIUW(shamt, rs1, rd)
<-> "slli.uw" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1) ^ sep() ^ hex_bits_6(shamt)
Expand All @@ -87,17 +87,17 @@ function clause execute (RISCV_SLLIUW(shamt, rs1, rd)) = {
/* ****************************************************************** */
union clause ast = ZBA_RTYPEUW : (regidx, regidx, regidx, bropw_zba)

mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_ADDUW) if haveZba() & sizeof(xlen) == 64
<-> 0b0000100 @ rs2 @ rs1 @ 0b000 @ rd @ 0b0111011 if haveZba() & sizeof(xlen) == 64
mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_ADDUW) if (haveZba() | haveBExt()) & sizeof(xlen) == 64
<-> 0b0000100 @ rs2 @ rs1 @ 0b000 @ rd @ 0b0111011 if (haveZba() | haveBExt()) & sizeof(xlen) == 64

mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH1ADDUW) if haveZba() & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b010 @ rd @ 0b0111011 if haveZba() & sizeof(xlen) == 64
mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH1ADDUW) if (haveZba() | haveBExt()) & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b010 @ rd @ 0b0111011 if (haveZba() | haveBExt()) & sizeof(xlen) == 64

mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH2ADDUW) if haveZba() & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0111011 if haveZba() & sizeof(xlen) == 64
mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH2ADDUW) if (haveZba() | haveBExt()) & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0111011 if (haveZba() | haveBExt()) & sizeof(xlen) == 64

mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH3ADDUW) if haveZba() & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0111011 if haveZba() & sizeof(xlen) == 64
mapping clause encdec = ZBA_RTYPEUW(rs2, rs1, rd, RISCV_SH3ADDUW) if (haveZba() | haveBExt()) & sizeof(xlen) == 64
<-> 0b0010000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0111011 if (haveZba() | haveBExt()) & sizeof(xlen) == 64

mapping zba_rtypeuw_mnemonic : bropw_zba <-> string = {
RISCV_ADDUW <-> "add.uw",
Expand Down Expand Up @@ -126,12 +126,12 @@ function clause execute (ZBA_RTYPEUW(rs2, rs1, rd, op)) = {
/* ****************************************************************** */
union clause ast = ZBA_RTYPE : (regidx, regidx, regidx, brop_zba)

mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH1ADD) if haveZba()
<-> 0b0010000 @ rs2 @ rs1 @ 0b010 @ rd @ 0b0110011 if haveZba()
mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH2ADD) if haveZba()
<-> 0b0010000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZba()
mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH3ADD) if haveZba()
<-> 0b0010000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZba()
mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH1ADD) if haveZba() | haveBExt()
<-> 0b0010000 @ rs2 @ rs1 @ 0b010 @ rd @ 0b0110011 if haveZba() | haveBExt()
mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH2ADD) if haveZba() | haveBExt()
<-> 0b0010000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZba() | haveBExt()
mapping clause encdec = ZBA_RTYPE(rs2, rs1, rd, RISCV_SH3ADD) if haveZba() | haveBExt()
<-> 0b0010000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZba() | haveBExt()

mapping zba_rtype_mnemonic : brop_zba <-> string = {
RISCV_SH1ADD <-> "sh1add",
Expand Down
104 changes: 52 additions & 52 deletions model/riscv_insts_zbb.sail
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
/* ****************************************************************** */
union clause ast = RISCV_RORIW : (bits(5), regidx, regidx)

mapping clause encdec = RISCV_RORIW(shamt, rs1, rd) if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ shamt @ rs1 @ 0b101 @ rd @ 0b0011011 if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
mapping clause encdec = RISCV_RORIW(shamt, rs1, rd) if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ shamt @ rs1 @ 0b101 @ rd @ 0b0011011 if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_RORIW(shamt, rs1, rd)
<-> "roriw" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1) ^ sep() ^ hex_bits_5(shamt)
Expand All @@ -87,8 +87,8 @@ function clause execute (RISCV_RORIW(shamt, rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_RORI : (bits(6), regidx, regidx)

mapping clause encdec = RISCV_RORI(shamt, rs1, rd) if (haveZbb() | haveZbkb()) & (sizeof(xlen) == 64 | shamt[5] == bitzero)
<-> 0b011000 @ shamt @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveZbkb()) & (sizeof(xlen) == 64 | shamt[5] == bitzero)
mapping clause encdec = RISCV_RORI(shamt, rs1, rd) if (haveZbb() | haveBExt() | haveZbkb()) & (sizeof(xlen) == 64 | shamt[5] == bitzero)
<-> 0b011000 @ shamt @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveBExt() | haveZbkb()) & (sizeof(xlen) == 64 | shamt[5] == bitzero)

mapping clause assembly = RISCV_RORI(shamt, rs1, rd)
<-> "rori" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1) ^ sep() ^ hex_bits_6(shamt)
Expand All @@ -105,11 +105,11 @@ function clause execute (RISCV_RORI(shamt, rs1, rd)) = {
/* ****************************************************************** */
union clause ast = ZBB_RTYPEW : (regidx, regidx, regidx, bropw_zbb)

mapping clause encdec = ZBB_RTYPEW(rs2, rs1, rd, RISCV_ROLW) if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ rs2 @ rs1 @ 0b001 @ rd @ 0b0111011 if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
mapping clause encdec = ZBB_RTYPEW(rs2, rs1, rd, RISCV_ROLW) if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ rs2 @ rs1 @ 0b001 @ rd @ 0b0111011 if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64

mapping clause encdec = ZBB_RTYPEW(rs2, rs1, rd, RISCV_RORW) if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0111011 if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
mapping clause encdec = ZBB_RTYPEW(rs2, rs1, rd, RISCV_RORW) if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b0110000 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0111011 if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64

mapping zbb_rtypew_mnemonic : bropw_zbb <-> string = {
RISCV_ROLW <-> "rolw",
Expand All @@ -133,32 +133,32 @@ function clause execute (ZBB_RTYPEW(rs2, rs1, rd, op)) = {
/* ****************************************************************** */
union clause ast = ZBB_RTYPE : (regidx, regidx, regidx, brop_zbb)

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ANDN) if haveZbb() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b111 @ rd @ 0b0110011 if haveZbb() | haveZbkb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ANDN) if haveZbb() | haveBExt() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b111 @ rd @ 0b0110011 if haveZbb() | haveBExt() | haveZbkb()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ORN) if haveZbb() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZbb() | haveZbkb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ORN) if haveZbb() | haveBExt() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZbb() | haveBExt() | haveZbkb()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_XNOR) if haveZbb() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZbb() | haveZbkb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_XNOR) if haveZbb() | haveBExt() | haveZbkb()
<-> 0b0100000 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZbb() | haveBExt() | haveZbkb()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MAX) if haveZbb()
<-> 0b0000101 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZbb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MAX) if haveZbb() | haveBExt()
<-> 0b0000101 @ rs2 @ rs1 @ 0b110 @ rd @ 0b0110011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MAXU) if haveZbb()
<-> 0b0000101 @ rs2 @ rs1 @ 0b111 @ rd @ 0b0110011 if haveZbb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MAXU) if haveZbb() | haveBExt()
<-> 0b0000101 @ rs2 @ rs1 @ 0b111 @ rd @ 0b0110011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MIN) if haveZbb()
<-> 0b0000101 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZbb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MIN) if haveZbb() | haveBExt()
<-> 0b0000101 @ rs2 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MINU) if haveZbb()
<-> 0b0000101 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0110011 if haveZbb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_MINU) if haveZbb() | haveBExt()
<-> 0b0000101 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0110011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ROL) if haveZbb() | haveZbkb()
<-> 0b0110000 @ rs2 @ rs1 @ 0b001 @ rd @ 0b0110011 if haveZbb() | haveZbkb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ROL) if haveZbb() | haveBExt() | haveZbkb()
<-> 0b0110000 @ rs2 @ rs1 @ 0b001 @ rd @ 0b0110011 if haveZbb() | haveBExt() | haveZbkb()

mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ROR) if haveZbb() | haveZbkb()
<-> 0b0110000 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0110011 if haveZbb() | haveZbkb()
mapping clause encdec = ZBB_RTYPE(rs2, rs1, rd, RISCV_ROR) if haveZbb() | haveBExt() | haveZbkb()
<-> 0b0110000 @ rs2 @ rs1 @ 0b101 @ rd @ 0b0110011 if haveZbb() | haveBExt() | haveZbkb()

mapping zbb_rtype_mnemonic : brop_zbb <-> string = {
RISCV_ANDN <-> "andn",
Expand Down Expand Up @@ -200,17 +200,17 @@ function clause execute (ZBB_RTYPE(rs2, rs1, rd, op)) = {
/* ****************************************************************** */
union clause ast = ZBB_EXTOP : (regidx, regidx, extop_zbb)

mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_SEXTB) if haveZbb()
<-> 0b0110000 @ 0b00100 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_SEXTB) if haveZbb() | haveBExt()
<-> 0b0110000 @ 0b00100 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_SEXTH) if haveZbb()
<-> 0b0110000 @ 0b00101 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_SEXTH) if haveZbb() | haveBExt()
<-> 0b0110000 @ 0b00101 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_ZEXTH) if haveZbb() & sizeof(xlen) == 32
<-> 0b0000100 @ 0b00000 @ rs1 @ 0b100 @ rd @ 0b0110011 if haveZbb() & sizeof(xlen) == 32
mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_ZEXTH) if (haveZbb() | haveBExt()) & sizeof(xlen) == 32
<-> 0b0000100 @ 0b00000 @ rs1 @ 0b100 @ rd @ 0b0110011 if (haveZbb() | haveBExt()) & sizeof(xlen) == 32

mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_ZEXTH) if haveZbb() & sizeof(xlen) == 64
<-> 0b0000100 @ 0b00000 @ rs1 @ 0b100 @ rd @ 0b0111011 if haveZbb() & sizeof(xlen) == 64
mapping clause encdec = ZBB_EXTOP(rs1, rd, RISCV_ZEXTH) if (haveZbb() | haveBExt()) & sizeof(xlen) == 64
<-> 0b0000100 @ 0b00000 @ rs1 @ 0b100 @ rd @ 0b0111011 if (haveZbb() | haveBExt()) & sizeof(xlen) == 64

mapping zbb_extop_mnemonic : extop_zbb <-> string = {
RISCV_SEXTB <-> "sext.b",
Expand All @@ -235,11 +235,11 @@ function clause execute (ZBB_EXTOP(rs1, rd, op)) = {
/* ****************************************************************** */
union clause ast = RISCV_REV8 : (regidx, regidx)

mapping clause encdec = RISCV_REV8(rs1, rd) if (haveZbb() | haveZbkb()) & sizeof(xlen) == 32
<-> 0b011010011000 @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveZbkb()) & sizeof(xlen) == 32
mapping clause encdec = RISCV_REV8(rs1, rd) if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 32
<-> 0b011010011000 @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 32

mapping clause encdec = RISCV_REV8(rs1, rd) if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b011010111000 @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveZbkb()) & sizeof(xlen) == 64
mapping clause encdec = RISCV_REV8(rs1, rd) if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64
<-> 0b011010111000 @ rs1 @ 0b101 @ rd @ 0b0010011 if (haveZbb() | haveBExt() | haveZbkb()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_REV8(rs1, rd)
<-> "rev8" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -256,8 +256,8 @@ function clause execute (RISCV_REV8(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_ORCB : (regidx, regidx)

mapping clause encdec = RISCV_ORCB(rs1, rd) if haveZbb()
<-> 0b001010000111 @ rs1 @ 0b101 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = RISCV_ORCB(rs1, rd) if haveZbb() | haveBExt()
<-> 0b001010000111 @ rs1 @ 0b101 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause assembly = RISCV_ORCB(rs1, rd)
<-> "orc.b" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -276,8 +276,8 @@ function clause execute (RISCV_ORCB(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CPOP : (regidx, regidx)

mapping clause encdec = RISCV_CPOP(rs1, rd) if haveZbb()
<-> 0b011000000010 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = RISCV_CPOP(rs1, rd) if haveZbb() | haveBExt()
<-> 0b011000000010 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause assembly = RISCV_CPOP(rs1, rd)
<-> "cpop" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -294,8 +294,8 @@ function clause execute (RISCV_CPOP(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CPOPW : (regidx, regidx)

mapping clause encdec = RISCV_CPOPW(rs1, rd) if haveZbb() & sizeof(xlen) == 64
<-> 0b011000000010 @ rs1 @ 0b001 @ rd @ 0b0011011 if haveZbb() & sizeof(xlen) == 64
mapping clause encdec = RISCV_CPOPW(rs1, rd) if (haveZbb() | haveBExt()) & sizeof(xlen) == 64
<-> 0b011000000010 @ rs1 @ 0b001 @ rd @ 0b0011011 if (haveZbb() | haveBExt()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_CPOPW(rs1, rd)
<-> "cpopw" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -312,8 +312,8 @@ function clause execute (RISCV_CPOPW(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CLZ : (regidx, regidx)

mapping clause encdec = RISCV_CLZ(rs1, rd) if haveZbb()
<-> 0b011000000000 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = RISCV_CLZ(rs1, rd) if haveZbb() | haveBExt()
<-> 0b011000000000 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause assembly = RISCV_CLZ(rs1, rd)
<-> "clz" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -333,8 +333,8 @@ function clause execute (RISCV_CLZ(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CLZW : (regidx, regidx)

mapping clause encdec = RISCV_CLZW(rs1, rd) if haveZbb() & sizeof(xlen) == 64
<-> 0b011000000000 @ rs1 @ 0b001 @ rd @ 0b0011011 if haveZbb() & sizeof(xlen) == 64
mapping clause encdec = RISCV_CLZW(rs1, rd) if (haveZbb() | haveBExt()) & sizeof(xlen) == 64
<-> 0b011000000000 @ rs1 @ 0b001 @ rd @ 0b0011011 if (haveZbb() | haveBExt()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_CLZW(rs1, rd)
<-> "clzw" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -354,8 +354,8 @@ function clause execute (RISCV_CLZW(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CTZ : (regidx, regidx)

mapping clause encdec = RISCV_CTZ(rs1, rd) if haveZbb()
<-> 0b011000000001 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb()
mapping clause encdec = RISCV_CTZ(rs1, rd) if haveZbb() | haveBExt()
<-> 0b011000000001 @ rs1 @ 0b001 @ rd @ 0b0010011 if haveZbb() | haveBExt()

mapping clause assembly = RISCV_CTZ(rs1, rd)
<-> "ctz" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand All @@ -375,8 +375,8 @@ function clause execute (RISCV_CTZ(rs1, rd)) = {
/* ****************************************************************** */
union clause ast = RISCV_CTZW : (regidx, regidx)

mapping clause encdec = RISCV_CTZW(rs1, rd) if haveZbb() & sizeof(xlen) == 64
<-> 0b011000000001 @ rs1 @ 0b001 @ rd @ 0b0011011 if haveZbb() & sizeof(xlen) == 64
mapping clause encdec = RISCV_CTZW(rs1, rd) if (haveZbb() | haveBExt()) & sizeof(xlen) == 64
<-> 0b011000000001 @ rs1 @ 0b001 @ rd @ 0b0011011 if (haveZbb() | haveBExt()) & sizeof(xlen) == 64

mapping clause assembly = RISCV_CTZW(rs1, rd)
<-> "ctzw" ^ spc() ^ reg_name(rd) ^ sep() ^ reg_name(rs1)
Expand Down
Loading

0 comments on commit d154ad6

Please sign in to comment.