Question
MIPS Assembly Language using qtspim In this lab, all data is to be regarded as bit strings representing subsets of the set {1, 2, 32}.
MIPS Assembly Language using qtspim In this lab, all data is to be regarded as bit strings representing subsets of the set {1, 2, 32}. If the bit string has a 1 in position i, then element i is included in the subset. Therefore, the string: 1000 1001 1100 0000 0000 0010 1000 1110 corresponds to the set: {2, 3, 4, 8, 10, 23, 24, 25, 28, 32}. Write MIPS assembly functions to do the following. Print out a set: I do not care about the format. You can print from smaller to larger or from larger to smaller. I would do a loop that went from 1 to 32 (or from 32 to 1). I would load a masking bit pattern that corresponded to the position number of the loop counter (0x00000001 for 1 or 0x80000000 for 32). Isolate the bit in the operand by using the AND operation. If the result of the AND is not 0 then the loop counter is in the set and should be displayed. Increment (decrement) the counter and shift the masking bit pattern to the left or the right depending on the starting pattern. Determine if an element is a member of a given set. Determine the union of two sets. Determine the intersection of two sets. To test the program, load the value 0xaaaaaaaa into a register as the first set and the value 0x24924924 into a register as the second set. Print out each set; determine whether or not 20 is in each set, print the union of the sets and the intersection of the sets.
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