Computer Architecture I ShanghaiTech University
In this homework, you need to write a RISC-V program to implement a simple algorithm. You need to find the longest palindromic substring of a given string. The tempalte can be found here
Here is a simple example:
String : abbsdcds
The longest palindromic substring should be sdcds
, the
length is 5
.
The program has to use at least 1 function call which follows the standard RISC-V conventions.
A reference input is already provided to you in the
input.S
file. Input is provided to you in binary format to
alleviate the burden of parsing and dealing with Venus's expermintal
file system.
.data
.globl str
str:
.string "abbbbb"
# the answer should be 5
You should write a function called LPS
in
func.S
, which returns the length of the longest palindromic
substring. Our auto-grader will call this function to get answer.
# DO NOT REMOVE THIS LINE WHEN SUBMITTING
.globl LPS
LPS:
# YOUR CODE HERE
Make sure that main.S
,func.S
and
input.S
reside in the same directory. To run your program
locally
java -jar venus-jvm-latest.jar main.S
To debug your program, you can modify the content of
input.S
to change the test case.
The command that we use to test your program's correctness is
diff <your_output> <reference_output>
You can also test your result using this command. Be sure to
calculate your reference_output
correctly!
Make sure that you strictly follow the calling convention defined in RISC-V Green Card. We will check this in EVERY test case.
We will test your program using RISC-V emulator venus. You probably want to read this before you started.
.S
to
distinguish from compiler generated assembly .s
space
, I suggest you indent using tab
s. Set
your editor's tabwidth to 8 for best visual experience.ecall
can be found here#
.func.S
. Any other file found will result in a score of
zero.Last Modified: 2023/3/2