bly Programs
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter3: Working With Large Worksheets, Charting, And What-if Analysis
Section: Chapter Questions
Problem 2AYK
Related questions
Question
![1. RISC-V Assembly Programs
Write the following RISC-V assembly programs:
Program 1: Divisible by 9?
Write a RISC-V assembly program that determines if the value in register a0 is divisible by 9. If
it is, the register a0 should be 1 at the end of the program, otherwise a0 should be 0. Run, test,
and debug your program using the Venus simulator. Test enough different values of a0 to
convince yourself that your assembly code works. Be sure to comment each line of code (using
# ). You may use only the following subset of instructions: add, addi, sub, beq, blt, bge, bne,
and j. Be sure to comment each line of code (using #). Note: assume that a0 contains only
positive numbers. Name your text file div9.s.
Hint: think of the method of repeated subtraction to determine if a number is divisible by 9. Try
your algorithm out by hand (with several non-trivial but simple examples) before coding it.
Program 2: Big-endian to little-endian conversion
Write a RISC-V assembly language code snippet that converts 8 words of memory starting at
address 0x300 from big-endian to little-endian. Name your text file big2little.s.
Some hints: Start by doing an example by hand for a word starting at memory address 0. Be
sure to write out the byte addresses below each byte (for both big- and little-endian). For
example, the word Ox1234ABCD stored in big-endian at memory address 0 would have the
following byte addresses and data:
Address 0 holds 0x12
Address 1 holds 0x34
Address 2 holds OxAB
Address 3 holds 0xCD
To convert this to little-endian, you would move the bytes to the following addresses (i.e., by
first loading the bytes into registers using load byte: lb, and then storing them into different
address locations using store byte: sb):
Address 3 holds 0x12
Address 2 holds 0x34
Address 1 holds OxAB
Address 0 holds 0xCD](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F305fc7ad-7709-41dd-8aa9-116916a708ff%2Ff8941191-10e0-41b5-8fb6-b1a70126b889%2Fymzx6h5_processed.png&w=3840&q=75)
Transcribed Image Text:1. RISC-V Assembly Programs
Write the following RISC-V assembly programs:
Program 1: Divisible by 9?
Write a RISC-V assembly program that determines if the value in register a0 is divisible by 9. If
it is, the register a0 should be 1 at the end of the program, otherwise a0 should be 0. Run, test,
and debug your program using the Venus simulator. Test enough different values of a0 to
convince yourself that your assembly code works. Be sure to comment each line of code (using
# ). You may use only the following subset of instructions: add, addi, sub, beq, blt, bge, bne,
and j. Be sure to comment each line of code (using #). Note: assume that a0 contains only
positive numbers. Name your text file div9.s.
Hint: think of the method of repeated subtraction to determine if a number is divisible by 9. Try
your algorithm out by hand (with several non-trivial but simple examples) before coding it.
Program 2: Big-endian to little-endian conversion
Write a RISC-V assembly language code snippet that converts 8 words of memory starting at
address 0x300 from big-endian to little-endian. Name your text file big2little.s.
Some hints: Start by doing an example by hand for a word starting at memory address 0. Be
sure to write out the byte addresses below each byte (for both big- and little-endian). For
example, the word Ox1234ABCD stored in big-endian at memory address 0 would have the
following byte addresses and data:
Address 0 holds 0x12
Address 1 holds 0x34
Address 2 holds OxAB
Address 3 holds 0xCD
To convert this to little-endian, you would move the bytes to the following addresses (i.e., by
first loading the bytes into registers using load byte: lb, and then storing them into different
address locations using store byte: sb):
Address 3 holds 0x12
Address 2 holds 0x34
Address 1 holds OxAB
Address 0 holds 0xCD
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
![Systems Architecture](https://www.bartleby.com/isbn_cover_images/9781305080195/9781305080195_smallCoverImage.gif)
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning