The assignment will be graded out of 100 points. Submit a file called answers.xxx (where you replace xxx with whatever extension is appropriate, depending
on the file format you use), that contains answers for all tasks. Acceptable file formats are plain text, Word document,
OpenOffice document, and PDF. Put your name and UTA ID on the first line of the document.
Submit your answers.xxx file to Blackboard before the deadline. You will be able to revise your answers until the deadline with no penalty.
IMPORTANT: By submitting your answers, you are certifying that you have followed the UTA standards of academic integrity, and that these answers have been exclusively your own work.
All students enrolled in this course are expected to adhere to the UT Arlington Honor Code:
I pledge, on my honor, to uphold UT Arlington's tradition of academic
integrity, a tradition that values hard work and honest effort in the
pursuit of academic excellence.
I promise that I will submit only work that I personally create or
contribute to group collaborations, and I will appropriately reference
any work from other sources. I will follow the highest standards of
integrity and uphold the spirit of the Honor Code.
Task 1 (15 points)
Two programmers, Jane and Mary, are designing a new high-level language for the same machine. For representing positive and negative 32-bit integers, Jane proposes reserving bit 31 to be 1 for positive integers and 0 for negative integers. Mary agrees with the idea of reserving a bit, but proposes using bit 0 instead of bit 31. Their boss says that it doesn't matter, both conventions are equally arbitrary, performance is not affected, and a compiler can be written so as to accommodate either convention.
What is your opinion?
- Can a compiler indeed be written so as to accommodate either convention?
- Would performance be the same either way? If not, what would performance of each approach depend on?
- What solution, or process towards finding a solution, would you suggest?
Justify your answers.
Task 2 (10 points)
For this question, assume that 1 stands for TRUE and 0 stands for FALSE. For each of the following expressions, specify if the result is a 1 (TRUE) or a 0 (FALSE):
- 1 AND (0 OR 1)
- (1 AND 1) AND (0 OR 1)
- (NOT(1 AND 1)) AND (0 OR 1)
- (NOT(1 AND 1)) OR (0 AND 1)
Task 3 (10 points)
For this question, assume that 1 stands for TRUE and 0 stands for FALSE. For each of the following bitwise operations, specify the result as a sequence of eight binary (0 or 1) digits.
- BITWISE-AND(01100110, 11001010)
- BITWISE-OR(01100110, 11001010)
- BITWISE-NOT(01100110)
Task 4 (10 points)
An ISA-level language uses, for each instruction, 7 bits for the opcode. What is the largest possible number of instructions (i.e., largest possible number of different opcodes) that this language can include? Justify your answer.
Task 5 (10 points)
An ISA-level language uses 32 bits to encode each instruction. All opcodes in this language have the same length. Some instructions specify a memory address, and they use 26 bits to specify that address. What is the largest possible number of instructions (i.e., largest possible number of different opcodes) that this language can include? Justify your answer.
Task 6 (15 points)
Propose an ISA-level load instruction that fits the following specifications:
- The instruction is 32 bits long.
- The instruction takes a 32-bit word from a memory address (that is somehow specified in the instruction) and copies that word on a register (that is somehow specified in the instruction).
- The instruction is capable of addressing 16GB of memory.
- Words and registers in this architecture are 32 bits long.
- Memory is word addressable.
- The CPU contains 128 registers.
Specify what goes into every bit of the instruction, and specify how the instruction interprets the information in its addresses.
Task 7 (15 points)
A C structure is defined as follows:
struct record
{
int age;
char initial;
int department;
};
Assume that an int is always 32 bits and a char is always 8 bits. Specify how much memory it takes to store an object of this structure in each of the following cases:
- Byte-addressable memory in a 64-bit machine.
- Byte-addressable memory in a 32-bit machine.
- Word addressable memory in a 64-bit machine.
- Word addressable memory in a 32-bit machine.
Task 8 (15 points)
You are creating a new high-level language, specifically for the ARM-7 architecture. You do not care at all about portability to other architectures, but you do care a lot about fast performance. This language has only one signed integer type (unlike C, for example, that has char, short, int, long, and so on), and no unsigned integer type. You get to decide how many bits to assign to each integer. What would be the best choice? Justify your answer.
Back to the list of assignments.