Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
lab0
  • Loading branch information
rcm19005 committed Jan 24, 2024
1 parent 1b0f4ee commit b4b79b1
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lab0/01-hello.s
@@ -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 added lab0/lab0-numbers.pdf
Binary file not shown.
47 changes: 47 additions & 0 deletions lab0/lab0.md
@@ -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.

0 comments on commit b4b79b1

Please sign in to comment.