diff --git a/lab0/lab0-numbers.pdf b/lab0/lab0-numbers.pdf new file mode 100644 index 0000000..288d617 Binary files /dev/null and b/lab0/lab0-numbers.pdf differ diff --git a/lab0/lab0.md b/lab0/lab0.md new file mode 100644 index 0000000..156fbbe --- /dev/null +++ b/lab0/lab0.md @@ -0,0 +1,61 @@ +# Getting prepared + +*Deadline:* Friday, 9/1/2023. + +We will keep the submission open until 9/15/2023 as students may enroll into +the course late. + +*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. + +* Submit code in Gradescope. + +* Conversion of non-negative numbers in one radix to another. + +* Take a quiz in HuskyCT. + +## 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. + +Download `lab0.s`. The RARS instructions page mentioned in the previous +paragraph has a section about "Download files from GitHub". The page also has a +link to more [RISC-V +examples.](https://github.com/zhijieshi/cse3666/tree/master/rv-examples). + +Modify the `msg` string in lab0.s so the program prints the following. There is +a newline, but no space, after the ending dot. + + Hello, welcome to CSE 3666. The best season is here. + +Submit revised `lab0.s` in Gradescope. There is a link in HuskyCT. The +submitted filename must be `lab0.s`. It is case sensitive. The system does NOT +accept names like `Lab0.s`. + +### Task 2 + +Study the slides in `lab0-numbers.pdf` to learn/review conversion of numbers in +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 Gradescope and complete lab0-test in HuskyCT. + +The submission pages will be created in the first week of the semester. + diff --git a/lab0/lab0.s b/lab0/lab0.s new file mode 100644 index 0000000..febb921 --- /dev/null +++ b/lab0/lab0.s @@ -0,0 +1,23 @@ +# CSE 3666 Lab 0 + +# 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 + + # define a label, in code segment +main: + lui a0, 0x10010 # a0 = the address of msg. hard-coded + addi a7, zero, 4 # a7 = 4, the system call number for printing a string + ecall # system call + + # system call 10: exit with code 0 + addi a7, zero, 10 # a7 = 10 + ecall # system call