ObjectiveTo learnhow touse loops ifstatement to representvar
Objective:To learnhow touse loops, if-statement, to representvariables and array in the stack, to load and store data from and into the stack and to use gdb.
Requirements:
1.Translate the following C code into SPARC assembly language program. All variablesare to be allocated space on the stack without using macros. In the program you aretouse only registers %o0 and %o1. All variables are to be accessed from the stacksuch that at any time during program execution the latest values of the variables are located on the stack. You are toexecute the statements in the order given. Donot try to optimize your code(i.e. do not remove nops).
char ca;
short sb;
int ic;
char cd;
short se;
int ig;
ca = 17;
cd = ca + 23
ic = -63 + ca
ig = ic + cd
sb = ic / ca
se = cd *sb + ic
Note: -Run your programs using gdb to verify value of updated variables after each calculation-Use correct versions of load and store commands for data of different sizes.-Use correct versions of examine command of gdb to verify results: (ex: x/db for printing a byte memory variable in signed decimal form)
Solution
char ca;
short sb;
int ic;
char cd;
short se;
int ig;
ca = 17;
cd = ca + 23
ic = -63 + ca
ig = ic + cd
sb = ic / ca
se = cd *sb + ic
