Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# RISC-V Example in RARS | ||
# Comments. Anything after # is comments. | ||
|
||
# .data starts data segments | ||
.data | ||
# msg is a label in data segment | ||
# .asciz specifies an ASCII string ends with a NUL character | ||
# we can also use ".string", instead of ".asciz" | ||
msg: .asciz "Hello, welcome to CSE 3666.\n" | ||
|
||
# .text starts code segments | ||
.text | ||
.globl main # declare main to be global. Note it is ".globl" | ||
|
||
# define a label, in code segment | ||
main: | ||
la a0, msg # load the address of the string | ||
addi a7, zero, 4 # set the system call number. 4 for printing a string | ||
ecall # system call | ||
|
||
# system call 10: exit with code 0 | ||
addi a7, zero, 10 # set the system call number | ||
ecall # system call |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Getting prepared | ||
|
||
*Deadline:* Sunday, 1/28/2024. | ||
|
||
Check | ||
|
||
*If you work on a lab computer or UConn AnyWare Desktop, save your files to | ||
cloud storage like OneDrive. Otherwise, you may lose your files.* | ||
|
||
## Learning Objectives | ||
|
||
* Run a RISC-V programs in RARS. | ||
|
||
* Conversion of non-negative numbers to a different radix. | ||
|
||
## Description | ||
|
||
### Task 1 | ||
|
||
Follow the instructions on [this page](https://github.com/zhijieshi/cse3666/blob/master/misc/rars.md) | ||
to install RARS and run RISC-V programs in RARS. The page has a link | ||
to [RISC-V examples.](https://github.com/zhijieshi/cse3666/tree/master/rv-examples) | ||
|
||
Copy code in `01-hello.s` to a new file `lab0.s`. Modify the `msg` string so | ||
the program prints the following. There is no space after the ending dot. | ||
|
||
Hello, welcome to CSE 3666. Spring is coming. | ||
|
||
Submit `lab0.s` in Gradescope. There is a link in HuskyCT. | ||
|
||
### Task 2 | ||
|
||
Study the slides in `lab0-numbers.pdf` to learn/review converson of numbers of | ||
different radices. | ||
|
||
* Binary to decimal. | ||
* Decimal to binary. | ||
* Hexadecimal to decimal. | ||
* Decimal to hexadecimal. | ||
|
||
Practice on [this page](https://zhijieshi.github.io/cse3666/binarynumbers/). | ||
For now, you can click the Config button and uncheck "Bits are signed". | ||
|
||
## Deliverables | ||
|
||
Submit `lab0.s` in HuskyCT. | ||
|