Registers in RISC-V are 64-bit. For the sake of simplicity, consider the following instructions operating on 32-bit registers. Assume that registers x5 and x6 hold the values 0xEEEEEEEE and 0x00000000, respectively.
• (2 points) – What is the value in x6 for the following slli x6, x5, 6
• (2 points) – Using the result from the part above, what is the value in x6 for the following instruction. srli x6, x6, 6
slli: instruction will perform a logical left shift of the contents of register x5 and stores the shifted value in register x6. The shift amount is taken from the 5-bit immediate field,i.e 6. The value 0 is shifted in from the right to replace lost bits
slli x6, x5, 6
x5 will hold the value 0xBBBB BB80
srli: instruction will perform a logical right shift of the contents of register x6 and stores the shifted value in register x6. The shift amount is taken from the 5-bit immediate field,i.e 6. The value 0 is shifted in from the left to replace lost bits .
srli x6, x6, 6
x6 will hold 0x02EEEEEE
Registers in RISC-V are 64-bit. For the sake of simplicity, consider the following instructions operating on...
Consider the following RISC-V loop: (i) LOOP: beq x6, XO, DONE (ii) addi x6, x6, -1 addi x5, x5, 2 (iv) slli x7, x5, 1 (iv) bge x5, XO, DONE (vi) jal x0, LOOP (vii) DONE: some-other-instruction Assume that the register x6 is initialized to the value 5, and x5 and x7 to the value 0. Find... a) Final value of x5 at the end of execution b)Final value of x7 at the end of execution c)Total number of instructions...
Problem 2.4: For the RISC-V assembly instructions below, what is the corresponding C statement? Assume that the variables f, g, h, i, and j are assigned to registers x5, x6, x7, x28, and x29, respectively. Assume that the base address of the arrays A and B are in registers x10 and x11, respectively. х30, х5, 3 add x30, x10, х30 // x30 %3D &A[F] slli x31, х6, 3 add x31, x11, х31 // х31 %3D &B[g] x5, 0(х30) // x30...
Consider the following RISC-V assembly instructions: slt x6, x0, x5 bne x0, x6, ELSE j DONE ELSE: addi x6, x6, 2 DONE: a)For what value(s) of x5 is the addi instruction executed? b)Why?
2.4 For the RISC-V assembly instructions below, what is the corresponding C statement? Assume that the variables f, g, h, i, and j are assigned to registers x5, x6, x7, x28, and x29, respectively. Assume that the base address of the arrays A and B are in registers x10 and x11, respectively. silix30, x5, 3 // x30=f*8 add x30, x10, x30 // x30=&A [f] s111 x31, x6 , 3 // x31 = g.8 add x31, x11, x31 // x31=&B [g]...
2.7 5<S$2.2, 2.3> Translate the following C code to RISC-V. Assume that the variables f, g, h, i, and j are assigned to registers x5, x6. x7. x28, and x29, y. Assume that the base address of the arrays A and B are in registers x10 and x11, respectively. Assume that the elements of the arrays A and B are 8-byte words: 2.7 5 Translate the following C code to RISC-V. Assume that the variables f, g, h, i, and...
The following 32-bit hexadecimal number describes a RISC-V machine instruction. Decode this instruction into a RISC-V assembly language statement (like `add x0, x1, x2`). To receive partial credit, you should show your steps including converting to binary format and identifying opcode, funct3, rs1, etc. 0x00C1F963
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What is the RISC-V instruction format and specific assembly language instruction? 0xfe814113
The following 32-bit binary word written in hexadecimal format represents a single RISC-V assembly instruction. What is the RISC-V instruction format and specific assembly language instruction? 0xfe814113 that is the question
Please do the following problems 1. translate into RISC-V Assembly variable rpt in x19 register. if(rpt>0){ rpt=rpt-1; goto loop } 2. Translate the following Risc-V code into C. variable 'i' in register x5, variable 'result' in x6 ,base address of integer 'memarray' in x10 addi x6,x0,0 addi x29,x0,100 LOOP: ld x7,0(x10) add x5,x5,x7 addi x10,x10,8 addi x6,x6,1 blt x6,x29, LOOP
Assume that 32-bit registers $80 and $1 hold values 80000000nex and D0000000mex respectively, (a) What is the value of $to for the following assembly code? add $t0, $80, $51 (b) is the value in $to the desired result, or has there been overflow?