Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need answers for these questions question1: question 2: Convert following code in Listing into its equivalent RISC-V assembly 1. int a = 5 ; 2.

need answers for these questions

image text in transcribed

question1:

image text in transcribed

question 2: Convert following code in Listing into its equivalent RISC-V assembly 1. int a = 5 ; 2. int b = 33; 3. int c = 55; 4. int d = 6 5. int e = ( ( ( ad )+(ba ) )+d )c ;

The following example will help us to understand the basics of registers and Risc V It is the compiler's job to associate program variables with registers. Take, for instance, the assignment statement from our earlier example: f=(g+h)(i+j); word A natural unit of access in a computer, usually a group of 32 bits. doubleword Another natural unit of access in a computer, usually a group of 64 bits; corresponds to the size of a register in the RISC-V architecture. EXAMPLE 68 Chapter 2 Instructions: Language of the Computer The variables f,g,h,i, and j are assigned to the registers x19,x20,x21,x22, and x23, respectively. What is the compiled RISC-V code? The compiled program is very similar to the prior example, except we replace the variables with the register names mentioned above plus two temporary registers, x5 and x6, which correspond to the temporary variables above: add 5,20,x21// register x5 contains g+h add x6,x22,x23// register x6 contains i+j sub x19,x5,x6//f gets x5x6, which is (g+h)(i+j) Convert the following statement to RISC V . You can use the same registers as given in Example 1 - b=0+0; - a=b+32; - c=a+b; - d=c5; e=a+b+c+d

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

Step: 3

blur-text-image

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

5. Identify three characteristics of the dialectical approach.

Answered: 1 week ago