Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1-(2 points) For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables x, y, h, and i are

image

1-(2 points) For the following C statement, what is the corresponding RISC-V assembly code? Assume that the variables x, y, h, and i are given and could be considered integers as declared in a C program. Use a minimal number of assembly instructions. Also, use the variables as opposed to register values. Hint: keep in mind we don't have a "subi" instruction. h = (x - y) + (i-1) 2-(2 points) For the following RISC-V assembly instructions below, what is a single corresponding C statement? Assume f, g, h, i are in x18, x19, x20 and x21. Your answer must be one single C statement for all assembly instructions as opposed to one C statement for each assembly instruction. add x18, x19, x20 sub x18, x18, x21 3-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 0xBBBBBBBB 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 4- Consider the following RISC-V assembly instructions: addi x11, x0, 11 addi x2, x0, 1 addi x3, x0, 2 Loop: mul x2, x2, x3 addi x11, x11, -1 bne x11, x0, Loop (2 points) - How many iterations of the loop are performed? (2 points) - What is the value in x2 when this program terminates? 5-(3 points) - Provide the format and assembly language instruction for the following hex values: Address 1000: 13 Address 1001:03 Address 1002: C5 Address 1003: 00 Hint: first consider big-endian vs. little-endian as you convert to binary. Then, divide the bits up into the appropriate fields, decipher the opcode, and so on.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linear Algebra

Authors: Jim Hefferon

1st Edition

978-0982406212, 0982406215

More Books

Students also viewed these Algorithms questions

Question

Find the dy/dx for the following 3 2x+1.2x+1 (x +1)4 1- y=-

Answered: 1 week ago

Question

List and briefly define four application areas of WLANs.

Answered: 1 week ago

Question

explain the reasons for using PERT charts and draw an illustrative

Answered: 1 week ago

Question

Define induction and what are its objectives ?

Answered: 1 week ago

Question

Discuss the techniques of job analysis.

Answered: 1 week ago

Question

How do we do subnetting in IPv6?Explain with a suitable example.

Answered: 1 week ago

Question

Explain the guideline for job description.

Answered: 1 week ago

Question

What is job description ? State the uses of job description.

Answered: 1 week ago