Home

rs1

rs1 is a term used in the RISC-V instruction set architecture to denote the first source register field in an instruction encoding. It is a 5-bit field that selects one of the 32 general-purpose registers, commonly written as x0 through x31 in the machine code, with the usual ABI aliases such as zero, ra, sp, gp, tp, t0–t6, s0–s11, and a0–a7 in assembly.

In the encoding of RISC-V instructions, rs1 appears in several formats, notably R-type and I-type. For R-type

In assembly language, rs1 is the label for the field, but programmers typically refer to the registers

rs1 is a fundamental part of the instruction encoding and is distinct from the destination field rd

instructions
like
add,
sub,
and,
or,
rs1
provides
the
first
operand,
while
rs2
provides
the
second
operand
and
rd
designates
the
destination
register.
In
I-type
instructions
such
as
addi,
lw,
and
jalr,
rs1
supplies
the
base
or
source
register
used
together
with
an
immediate
value
or
offset.
The
rs1
field
is
typically
located
in
bits
15–19
of
the
32-bit
instruction
word.
by
their
concrete
names
(for
example,
x1
or
the
ABI
alias
ra).
An
example
is
“add
x5,
x1,
x2,”
where
x1
is
the
rs1
source
register
and
x2
is
the
rs2
source
register.
and
the
second
source
field
rs2.
It
is
used
across
arithmetic,
logical,
memory-access,
and
control-flow
instructions
to
specify
the
first
operand.