This week, we had a lab assignment in my computer engineering class that required us to perform arithmetic operations on float variables. I quickly learned that the standard add, addi, sub, mov, ... instructions do NOT work properly on float variables. This was not explained in ANY of the literature I had prior to 15 minutes ago. Also, you apparently cannot use the standard $s0 - $s8, $t0 - $t3, ... registers for storing float or double type variables. There are special floating point registers that are used for this but are also not often discussed in the usual MIPs tutorials. So I went to Google and searched terms such as SPIM+"float variables", and SPIM+"float registers". Only then did this other information suddenly appear.
The following link should prove quite useful for anyone trying to do this:
A much more complete listing of MIPS Instructions - Including those using Float Registers
http://www.dsi.unive.it/~arcb/LAB/spim.htm
Look at pages 21 - 23 and note the instructions such as add.s, sub.s, mov.s for manipulating single precision float variables. If you are working with double precision variables, use add.d, sub.d, mov.d, ... MIPS uses a floating point coprocessor - it has special registers numbered $f0 - $f31. So, what I get from this is instead of using the $s0, $s2, and $t0 registers my professor told me to use on integers, I will have to use registers $f2, $f3, $f4, for example. Registers $f0 and $f12 are reserved in QtSPIM for reading and printing floats, respectively - so don't use them for storing/manipulating your arithmetic variables. After you perform an arithmetic operation, you will have to move that result to $f12 before you can print the answer to the console. Likewise, if your program reads a float variable from the console, you will have to fetch that number from f.p. register $f0 and place it into another - such as $f3, or wherever, before manipulating it.
If you are doing this you should get thoroughly acquainted with this document, save a copy to your hard drive, and perhaps print out your own hard copy as I have just done.
The links below show a couple short snippets of code detailing how to use these instructions.
http://stackoverflow.com/questions/2589233/mips-or-spim-loading-floating-point-numbers
http://stackoverflow.com/questions/6515799/use-the-floating-point-instructions-to-get-results-in-decimal
I'll post more information on this site as it becomes available. I sincerely hope my posts on SPIM and MIPS are helping some folks. THESE posts especially have gotten a ton of hits lately - from all over the world at that!
See them at:
http://inkarlslab.blogspot.com/2011/09/mips-32-example-program-using-qtspim.html
http://inkarlslab.blogspot.com/2011/09/spim-in-linux-environment.html
http://inkarlslab.blogspot.com/2011/09/spim-mips-32-bit-simulator.html
Thursday, November 3, 2011
Tuesday, November 1, 2011
A "real-world" Indicator Of The American Economy - My Observations
We have heard quite a bit lately about how college kids are graduating with mountains of student loan debt and can't find jobs. Case in point: Three days ago I was at a local retail store picking up a "lay-away" purchase. The lady at the lay-away counter was well spoken, middle aged, well-mannered, intelligent, and well educated as it turned out. She explained that she had earned her Bachelor's degree in Geology about a year and a half ago - and hadn't yet found a job in her field. "Welcome to the recession", she said with a grim laugh.
IT Work:
We have all heard about how great a source of employment the IT industry is, and what a huge and growing demand there is for IT workers. In fact, there is supposedly such a high demand for IT workers that, according to industry sources, we must outsource our IT work to India. If so, then how is it that a friend of a friend with a Master's degree in Computer Science can only wrangle a $10/hour (yes, you read correctly) job in his field? He is an intelligent, hard-working, educated, experienced guy with a good work ethic. This does NOT bode well for guys like me who are working on their graduate degrees in related fields.
Granted, these are only two data points. However, they DO conflate with what I have personally observed in my daily interactions and read about online.
Looking around I find MANY examples of industry outsourcing jobs (and 'justifying' it with half-truths and questionable statistics) while millions of qualified Americans who WANT the work go without.
Why, as a society, as we putting up with this? Where is the outrage?
Declining Quality On All Levels:
Generally, during a recession, employees are fearful for their jobs and therefore tend to be on their best behavior. Under such conditions they will tolerate all sorts of things at work they never would in normal times. But this time there is yet another unprecedented change I and others close to me have noticed: MANY people in businesses of all types with whom I come in contact are rude, surly, and don't want to even minimally do the work they are paid to do. And/or they are often just plain incompetent. I've noticed a general coarsening of the business culture in America during the last three years in particular.
We always hear, especially from the 'conservative' side of the political aisle, that recessions "weed out the dead wood", allow the best to rise to the top, provide businesses with the opportunity to make improvements in efficiency, ... If anything, I think the opposite has happened during this latest downturn. Even the IT guy I mentioned earlier has noticed the same thing. We ask ourselves "with all the GOOD employees out there who WANT to work and cannot get jobs, WHY does business continue to keep ones that mistreat paying customers or who don't really want to work?" We hear about how businesses which cater to the middle and lower classes are being hurt by the recession, yet these same businesses keep employees that could be driving away valuable clientele.
I don't get it. It flies in the face of what we are taught in business degree programs and in normal, real-world commerce.
Readers - have you noticed the same thing?? If so, why do you think it is? What is behind it?
I'd love to hear from anyone who can shed light on this!
IT Work:
We have all heard about how great a source of employment the IT industry is, and what a huge and growing demand there is for IT workers. In fact, there is supposedly such a high demand for IT workers that, according to industry sources, we must outsource our IT work to India. If so, then how is it that a friend of a friend with a Master's degree in Computer Science can only wrangle a $10/hour (yes, you read correctly) job in his field? He is an intelligent, hard-working, educated, experienced guy with a good work ethic. This does NOT bode well for guys like me who are working on their graduate degrees in related fields.
Granted, these are only two data points. However, they DO conflate with what I have personally observed in my daily interactions and read about online.
Looking around I find MANY examples of industry outsourcing jobs (and 'justifying' it with half-truths and questionable statistics) while millions of qualified Americans who WANT the work go without.
Why, as a society, as we putting up with this? Where is the outrage?
Declining Quality On All Levels:
Generally, during a recession, employees are fearful for their jobs and therefore tend to be on their best behavior. Under such conditions they will tolerate all sorts of things at work they never would in normal times. But this time there is yet another unprecedented change I and others close to me have noticed: MANY people in businesses of all types with whom I come in contact are rude, surly, and don't want to even minimally do the work they are paid to do. And/or they are often just plain incompetent. I've noticed a general coarsening of the business culture in America during the last three years in particular.
We always hear, especially from the 'conservative' side of the political aisle, that recessions "weed out the dead wood", allow the best to rise to the top, provide businesses with the opportunity to make improvements in efficiency, ... If anything, I think the opposite has happened during this latest downturn. Even the IT guy I mentioned earlier has noticed the same thing. We ask ourselves "with all the GOOD employees out there who WANT to work and cannot get jobs, WHY does business continue to keep ones that mistreat paying customers or who don't really want to work?" We hear about how businesses which cater to the middle and lower classes are being hurt by the recession, yet these same businesses keep employees that could be driving away valuable clientele.
I don't get it. It flies in the face of what we are taught in business degree programs and in normal, real-world commerce.
Readers - have you noticed the same thing?? If so, why do you think it is? What is behind it?
I'd love to hear from anyone who can shed light on this!
Labels:
college,
decline of America,
Great Recession,
IT,
outsourcing,
recession,
student loan debt
Subscribe to:
Posts (Atom)