Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part B (Sorting Students) - 100 points In the second skeleton file attached you will find an array of structures (or student records) stored in

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Part B (Sorting Students) - 100 points In the second skeleton file attached you will find an array of structures (or student records) stored in the memory corresponding to the C declaration: struct student! char name: int final Class[20]: Each record has two fields - The first field is the name of a student 8 characters long (including the null character at the end), and the second field is the final exam score (positive integer less than 100). Your task is to write a RISC-V assembly language program to sort the student records. Your program should be able to sort student records by the first letter of their name or their final exam score. You should be able to sort in ascending or descending order. The output of your program should be the sorted array printed one record per line - with Name and Final separated by a space. What do you have to do? You have to use the BUBBLE SORT algorithm. No other sorting algorithm is allowed. Download the skeleton file called lab1b.skel and add your code to it. Rename your file to lab1b.S where kerkos ID is the ID you use to login to your UC Davis email or MyuS Davis, account. You are permitted to use only the environment calls for the Venus RISC-V simulator and RISC-V instructions. You should test your program for different values number of students, of student names and scores. You must print out the welcome message and data like in the sample outputs Comment your code explaining what the equivalent C operation would be (1.0. addi to, x0,6 #int j=6:) Comment your name and ID# at the top of the file Skeleton Code dala Class: 3 BI. word 87 asciiz "Ant- word 45 si "Peter word 67 asciiz "Miler word 55 asclic Wells word 51 asali Rahim - word 90 asciiz "Thomas word 67 asiz"Garcia word 49 ascii William word 77 8502"Janice word 55 asciiz "Emma word 82 asci Susie word 69 asci Katie word 59 asciiz"Gizelle 1 word 59 350z "Marie- Word asciiz Powell word 87 B iz "Marie word 80 asciiz Hannah word 71 asciiz Kristen" word 80 asciiz"Jones word 50 DumStudents:.word 20 Balmain main: M Your code here done MINExit using environmental calon Output Sample 1 (Ascending Scores) Welcome to the Grade Sorting Program Name Grade Art 45 Garcia 49 Joan 50 Wels_51 Miller 55 Janice 55 i_59 Gizelle 59 Kristen 60 Mare_86 Peter_67 Susie_69 Hannah William 77 Marie80 Emma Powell 87 Bill 87 Babim Output Sample 2 (Descending Names) Welcome to the Grada Sorting Program Name Grade Art 45 BII 87 Emma Gizelle 59 Garcia 49 Hannah long_50 Janice 55 Kristen 60 Katin59 Marie80 Marin66 Powell 87 Peter_67 Rabim S _89 67 Thomas Wiliam77 W251 Output Sample 3 (Descending Scores) Welcome to the Grade Sorting Program Name Grade Powell 87 Ems Marin 80 William77 Hannah Susie_69 Bade87 Thomas Kristen 60 kate_59 Gizella 59 Miller 55 Janice 55 We 51 on 50 Garcia 49 Art 45 General hints Venus allows you to set breakpoints to pause the execution of your program by dicking the line of interest Venus allows you to inspect memory and the registers displayed in different formats (ASCII, hex, decimal als) Use this to trace your sorting. Try writing out the code in C then try to reason out an equivalent assembly program When referencing data in memory think about the number of bytes that needs to be traversed from an initial address to get to some piece of data. Is the data a byte, short, word, or longer? How many bytes is each? Part B (Sorting Students) - 100 points In the second skeleton file attached you will find an array of structures (or student records) stored in the memory corresponding to the C declaration: struct student! char name: int final Class[20]: Each record has two fields - The first field is the name of a student 8 characters long (including the null character at the end), and the second field is the final exam score (positive integer less than 100). Your task is to write a RISC-V assembly language program to sort the student records. Your program should be able to sort student records by the first letter of their name or their final exam score. You should be able to sort in ascending or descending order. The output of your program should be the sorted array printed one record per line - with Name and Final separated by a space. What do you have to do? You have to use the BUBBLE SORT algorithm. No other sorting algorithm is allowed. Download the skeleton file called lab1b.skel and add your code to it. Rename your file to lab1b.S where kerkos ID is the ID you use to login to your UC Davis email or MyuS Davis, account. You are permitted to use only the environment calls for the Venus RISC-V simulator and RISC-V instructions. You should test your program for different values number of students, of student names and scores. You must print out the welcome message and data like in the sample outputs Comment your code explaining what the equivalent C operation would be (1.0. addi to, x0,6 #int j=6:) Comment your name and ID# at the top of the file Skeleton Code dala Class: 3 BI. word 87 asciiz "Ant- word 45 si "Peter word 67 asciiz "Miler word 55 asclic Wells word 51 asali Rahim - word 90 asciiz "Thomas word 67 asiz"Garcia word 49 ascii William word 77 8502"Janice word 55 asciiz "Emma word 82 asci Susie word 69 asci Katie word 59 asciiz"Gizelle 1 word 59 350z "Marie- Word asciiz Powell word 87 B iz "Marie word 80 asciiz Hannah word 71 asciiz Kristen" word 80 asciiz"Jones word 50 DumStudents:.word 20 Balmain main: M Your code here done MINExit using environmental calon Output Sample 1 (Ascending Scores) Welcome to the Grade Sorting Program Name Grade Art 45 Garcia 49 Joan 50 Wels_51 Miller 55 Janice 55 i_59 Gizelle 59 Kristen 60 Mare_86 Peter_67 Susie_69 Hannah William 77 Marie80 Emma Powell 87 Bill 87 Babim Output Sample 2 (Descending Names) Welcome to the Grada Sorting Program Name Grade Art 45 BII 87 Emma Gizelle 59 Garcia 49 Hannah long_50 Janice 55 Kristen 60 Katin59 Marie80 Marin66 Powell 87 Peter_67 Rabim S _89 67 Thomas Wiliam77 W251 Output Sample 3 (Descending Scores) Welcome to the Grade Sorting Program Name Grade Powell 87 Ems Marin 80 William77 Hannah Susie_69 Bade87 Thomas Kristen 60 kate_59 Gizella 59 Miller 55 Janice 55 We 51 on 50 Garcia 49 Art 45 General hints Venus allows you to set breakpoints to pause the execution of your program by dicking the line of interest Venus allows you to inspect memory and the registers displayed in different formats (ASCII, hex, decimal als) Use this to trace your sorting. Try writing out the code in C then try to reason out an equivalent assembly program When referencing data in memory think about the number of bytes that needs to be traversed from an initial address to get to some piece of data. Is the data a byte, short, word, or longer? How many bytes is each

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions