Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Would anybody be able to help out please? Our professor didnt explain how to do. Thanks! The goal of this lab is to get familiar
Would anybody be able to help out please?
The goal of this lab is to get familiar with how the program described in high-level language (particularly C) is translated into MIPS assembly language. We will eventually build our own simulator in the next lab assignment. For this lab assignment, we don't have a simulator to run MIPS assembly, so we will use an existing one, called MARS. A basic MARS tutorial will be provided separately Specifically, translate the following C procedure into conventional use for registers such as temporary vs. saved registers, maintaining procedure call stacks, proper parameter passing and returns, etc. Note that this procedure calls another (strchr) which is assumed to also comply with those conventions. MIPS Assembly. You are required to follow the char firstmatch (char *s, char *s2 find the first character in string s1 that is also in s2* char *temp temp sl; do if (strchr( s2, temp)!-0)if this character is there/ return where we found it* else look again return temp temp++; while (temp return 0: 0) *found none of these chars/ char * strchr (register const char *s, int c) do if (sc return (char*)s while (s++) return (0); These are additional instructions to complete this lab assignment. The program should consist of two segments: .data and text segments. Define two strings, str and str2, in the data segment. Use lb (load byte) as you manipulate strings not integers. . The code segment, labeled as "text", should begin with "main" because the MARS simulator begins the execution from there In the main code, you should start with load addresses of the defined strl and str2 You need to write two procedures, firstmatch and strchr, in the code segment, each is labeled as the procedure name After loading string addresses, you pass both strings to firstmatch as in the above C code Within the firstmatch procedure, you need to call the strchr procedure Our professor didnt explain how to do. Thanks!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started