The RISC-V Assembler and Runtime Simulator (RARS) can be downloaded from:
https://github.com/TheThirdOne/rars/releases/tag/v1.5
All information is in pdf file
DOWNLOAD FILES HERE
Laboratory 1 Assembly Language and the RISC-V ISA
Page 1of 6School of EngineeringEEET2261–Computer Architecture and OrganisationLaboratory 1Assembly Language and the RISC-V ISA1Aims(i)To develop an appreciation for the abstraction provided by a microprocessor’s Instruction Set Architecture (ISA).(ii)To use theRISC-V specification to understand thefunctional operation of the RISC-V ISA.(iii)To implement common algorithms typical of those suited to optimisation through direct assembly language programmingusing the RV32I base ISA.(iv)To develop an appreciation for theconstraints imposed on software by the underlying ISA.(v)To utilise the RISC-V assembler and runtime simulatorto implement, assembleand evaluate algorithms in assembly language
IntroductionYou are expected to work individually. Each student must submit asingle .zip archive containing their assembly code files according to the supplied project template.This laboratory project will run for two weeks,withsubmission dueat the end of week 3(electronicsubmission via the subject Canvas website).The so-called Internet of Things (IoT) has given rise to an explosion in the development and deployment of small, cheap, and often resource constrained, embedded systems. To maximise performance, these systems are good candidates for code optimisation through direct assembly language programming. In this laboratory, you will implement in RISC-V assembly language, a number of algorithms typical of those required in such embedded systems. Specifically, you will make use of the RV32I subset of the RISC-V instruction set architecture (ISA)[1,2]. To evaluate your submitted solutions, your code will be assembled and linked to a set of test routines, and its functionality assessed using the RISC-V Assembler and Runtime Simulator (RARS) version 1.5 [3].RARS may be downloaded from the link below (see [3]) as a.jar file. You will need Java8 or later to run it.RARS is comprised of a simple text editor for viewing and writing assembly language code(although you may use any text editor you prefer, outside of RARS), a RISC-Vassembler and a register level runtime simulator that supports single stepping and breakpoints for debugging.
To get started, download the project template from the subject Canvas website.The project template (provided as a single .zip archive) contains code stubs together with example test routinesfor each of the assembly programming tasks described below.You will complete these code stubs and must then archive (.zip) and submit your project directory for assessment.3Loops and conditionals (Linear search)The project template contains twofiles:min.asmand max.asm.Each file contains a code stubdefining a procedureto compute the minimum and maximum, respectively,of an array of signed 32-bit integersofarbitrary length. Your task is to complete eachof these code stubsto return the minimum and maximum value using a linear search of the supplied array. Your implementation of each of these procedures must satisfy the following constraints:1.The array of integers is stored in memory in a contiguous range of addresses. When each procedure(minor max) is called, the starting address of the array will be stored in a0and the number of integers in the array will be stored in a1.2.Each procedureshould return the index of its target (i.e., the minimum or maximumvalue) in a0.3.Eachprocedureshould end with a retpseudo-instruction.
Note:The returned value should be the element index, not an addresses orbyte offset.Do not rename the files (min.asmand max.asm) or change the name of the procedures (minand max) defined in the supplied code stubs.To test your solution in RARS, you may use theexample test routineststmin.asmand tstmax.asm,providedinthe testsdirectory.Discussion questions:Evaluate the computational cost ofyour solution, in terms of the number of instructions executed.How does this vary with the length of the supplied array?Hint: You can use RARS to confirm your estimate of the number of instructions executed using theInstruction Counter, located under the Tools menu or by using the iccommand line argument.4Procedure calls(Quicksort)The cost of many operationsthat involve linear search can besignificantly reduced by first sorting the array to be searched. Consider the case of finding the minimum and maximum: for a sorted arrayno search is required (the minimum and maximum are simplythe first and last elementsin the array). Searching for an arbitrary value in anarray is another example which can benefit significantly from sorting of the array before searching, especially if many searches for different values, are required.The project template contains an additional file: quicksort.asm. This file contains a code stub defining a procedure to sort an array of signed 32-bitintegers of arbitrary length into ascending order.Yourtask is to complete this code stub to sort the supplied array using the Quicksort algorithm [4].Your implementation of the sortprocedure must satisfy the following constraints:1.The array of integers is stored in memory in a contiguous range of addresses. When the sortprocedure is called, the starting address of the array will be stored in a0and the element indices of the start and end of the region to be sorted will be stored in a1and a2, respectively.2.The sort procedure should modify the array in place, and does not need to return any value.3.The sortprocedure should end with a retpseudo-instruction.
References[1]The RISC-V Instruction Set Manual: Volume I: Unprivileged ISA, https://github.com/riscv/riscv-isa-manual/releases/tag/draft-20200717-259025b, [online], Accessed 2020-07-18.[2]Open RISC-V Reference Gard, http://riscbook.com/greencard-20181213.pdf, [online], Accessed 2020-07-18.[3]The RISC-V Assembler and Runtime Simulator (RARS), https://github.com/TheThirdOne/rars/releases/tag/v1.5,[online], Accessed 2020-07-18.[4]Quicksort, https://en.wikipedia.org/wiki/Quicksort, [online], Accessed 2020-07-27.[5]Binary search algorithm, https://en.wikipedia.org/wiki/Binary_search_algorithm, [online], Accessed 2020-07-29.
One thought on “Laboratory 1 Assembly Language and the RISC-V ISA”