1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Elanso [62]
4 years ago
9

7. Implement a function factorial in RISC-V that has a single integer parameter n and returns n!. A stub of this function can be

found in the file factorial.s. You will only need to add instructions under the factorial label, and the argument that is passed into the function is configured to be located at the label n. You may solve this problem using either recursion or iteration
Engineering
1 answer:
ohaa [14]4 years ago
3 0

Answer:

addi x31, x0, 4

addi x30, x0, 2

Explanation:

Recursion in computer sciencs is defined as a method of solving a problem in which the solution to the problem depends on solutions to smaller cases of the same problem. Such problems can generally be solved by iteration, but this needs to identify and index the smaller cases at time of programming.

addi x31, x0, 4

addi x30, x0, 2

addi x2, x0, 1600 // initialize the stack to 1600, x2= stackpointer

ecall x5, x0, 5 // read the input to x5

jal x1, rec_func

ecall x0, x10, 2 // print the result now

beq x0, x0, end

rec_func:

addi x2, x2, -8 // make room in stack

sd x1, 0(x2) // store pointer and result in stack

bge x5, x31, true // if i > 3, then go to true branch

ld x1, 0(x2)

addi x10, x0, 1 // if i <= 3, then return 1

addi x2, x2, 8 // reset stack point

jalr x0, 0(x1)

true:

addi x5, x5, -2 // compute i-2

jal x1, rec_func // call recursive func for i-2

ld x1, 0(x2) // load the return address

addi x2, x2, 8 // reset stack point

mul x10, x10, x30 // multiply by 2

addi x10, x10, 1 // add 1

jalr x0, 0(x1) // return

end:

You might be interested in
Why is concrete on its own not a good material to use
Inga [223]

Answer:

It has poor tensile strength despite having high compressive strength

Explanation:

Concrete exhibits high compressive strength when used. However, it has very low compressive strength. This is the reason why concrete is normally combined with steel to make a composite building material called reinforced concrete. The steel reinforces concrete hence increasing the tensile strength in RC buildings. The end composite is durable and fireproof. Generally, the main reason why concrete is not use on its own is due to its poor tensile strength.

7 0
3 years ago
Project 13.3: Assessing Risk Management According to the FFIEC Information Security InfoBase Handbook ( Appendix A ), the initia
Rashid [163]

Answer:

1. Changes in network topology or system configuration might bring security-related challenges. For example, adopting a new system configuration which is low in cost but also very new in the Industry might be vulnerable to the existing security.

2. New products or Services which are delivered to either the Internal/External users might be prone to security issues.

Let say a product 'A' has been launched by a company 'X' and for testing purpose it has been given to the internal users. Now as this product 'A' is a product of 'X' itself it will be allowed to carry in the official premises and if some user tries to hack this product and can make the product potentially harmful w.r.t security.

3. Consider a scenario where there is a change in management & team, the team members which were thoroughly responsible for Security kinds of stuff are dissolved into different teams. Also new members are hired for the team. Now, since the new members will need some time to get adapted to the Business As Usual things there are high chances of a security level not maintained as it was earlier by the old guys. This could be due to undocumented things in the organization or due to lack of Knowledge Transfer to the new joinees.

5 0
3 years ago
The website of a bank that an organization does business with has been reported as untrusted by the organization's web browser.
sweet-ann [11.9K]

Answer:

B. The website's certificate still has the old bank's name

Explanation:

MRK ME BRAINLIEST PLZZZZZZZ

5 0
4 years ago
I need help!!!!!!!!!
katovenus [111]

Answer:

buy a new one

Explanation:

go on newegg and you will most likely find one there

8 0
3 years ago
A discharged battery will have?
lora16 [44]
A think is the correct answer
4 0
2 years ago
Read 2 more answers
Other questions:
  • Can you tell me important facts about Peggy A. Whitson?
    5·1 answer
  • Explain what entropy is in relation to the second law of thermodynamics?
    9·1 answer
  • A three-phase, 318.75kVA, 2300-Volt, alternator has an armature resistance of 0.35/phase and a synchronous reactance of 1.2/phas
    10·1 answer
  • Car crashes in the United States result in high costs. In<br> what areas do these high costs occur?
    8·1 answer
  • An oscilloscope display grid or scale is called?
    13·2 answers
  • 2. What is the original length of the rectangular bar if the deformation is 0.005 in with a force of 1000 lbs and an area of 0.7
    9·1 answer
  • g A 12,000 m3/day treatment plant has a rectangular sedimentation basin with dimensions 12 meters wide, 3 meters deep, and 25 me
    8·1 answer
  • Describe the historical development of building material being used in the construction indsury
    10·1 answer
  • 2=333=3= im single text in comment
    13·2 answers
  • A vehicle is towed into a shop with a thrown serpentine belt.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!