A certain ISA has a 32-bit word size, uses single word instructions, has 120 opc
ID: 3537569 • Letter: A
Question
A certain ISA has a 32-bit word size, uses single word instructions, has 120 opcodes, 32
registers, and 4Gbyte of byte-addressable memory.
One group of instructions in this ISA takes the form:
OPCODE | DESTINATION REGISTER | SOURCE REGISTER | FLAG | IMMEDIATE VALUE
Or
OPCODE | DESTINATION REGISTER | SOURCE REGISTER 1 | FLAG | SOURCE REGISTER 2
A one-bit flag distinguishes between these two addressing modes.
Another group of instructions takes the form
OPCODE | SOURCE/DESTINATION REGISTER | PC OFFSET
Where PC Offset is the 2%u2019s complement "distance" from the current PC to the labelled location.
1.What is the range of values that can be stored in the %u201CImmediate%u201D field (as a 2%u2019s
complement value, to within +/- 1)?
2. How far (in memory locations) can a labelled location be from an instruction using the PCrelative
addressing mode? (to within +/- 1)
please show equations
Thanks :)
Explanation / Answer
1)
total = 32 bits (word sized instruction)
120 opcodes, so requires 2^8 combinations at least, so 8 bits taken.
32 registers, which is 2^5, so 5 bits taken for register
Equation:
Thus,IMMEDIATE Length = total - opcode length - 2*(register lengths) -flag =32 - 8 - 2*5 -1 = 13 bits.
Answer:
So in 2's complement can represent : -2^13 - 1 to + 2^13 which is -8193 to +8192 in decimal values.
which is roughly +/- 8K (8000)
2)
total =32 bits
120 opcodes, so requires 2^8 combinations at least, so 8 bits taken.
32 registers, which is 2^5, so 5 bits taken for register
Equation:
Thus, PC OFFSET Length = total - opcode length -register length = 32-8-5 = 19 bits.
ANswer:
So in 2's complement can represent : -2^19 - 1 to + 2^19 which is -524289 to +524288 in decimal values (bytes in memory)
which is roughly +/- 512K
Thats the memory range length which can be reached from current PC.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.