Final answer:
To convert the high-level code into RISC-V assembly language, you need to translate each line of code into RISC-V instructions.
Step-by-step explanation:
To convert the high-level code into RISC-V assembly language, you need to translate each line of code into RISC-V instructions. The conversion involves using various RISC-V instructions such as addi, fmv, flw, beq, j, and more. In summary, the code has been successfully converted to RISC-V assembly language.
Here is the conversion:
a)
slt t2, t0, t1
beq t2, zero, else1
addi t0, t0, 7
fmv.s ft0, t0
flw ft1, FloatConstantAddress
fmul.s ft0, ft0, ft1
fmv.w t0, ft0
j endif1
else1:
addi t1, t1, -6
mv t2, t1
addi t3, zero, 16
mdiv t2, t3
mflo t1
j endif1
endif1:
b)
slt t2, t0, t1
beq t2, zero, else2
sub t3, zero, t1
sub t0, t0, t3
li t3, 32
rem t0, t0, t3
j endif2
else2:
mul t3, t1, 3
add t0, t0, t3
li t3, 14
mul t0, t0, t3
j endif2
endif2: