Last updated 05/04/2004
New and updated entries are highlighted.
StorageObject class does contain a function
void backDoor (long x) that allows you to load a value into
any storage object. You are not allowed to use this function, as it is
a hack that exists for testing. Any use of this function will result in
point loss on the project.
> I discovered a question during testing of my DIPS. It has to do with > the Set instructions. Since we're comparing the full width of the > register, we can't just fill the top half of a word with zeros like we > can with the immediate forms of this instruction. >
You have to do the subtraction, and look at all the outputs from the ALU:
OUT() | the difference | |
CARRY() | carry/borrow flag: 0 = no, 1 = yes | |
OVERFLOW() | arithmetic overflow flag: 0 = no, 1 = yes |
Signed comparisons have these results:
| equal | OUT() == 0 | |
| less | !equal && sign_of_OUT() != OVERFLOW() | |
| greater | !equal && !less |
where sign_of_OUT() is the most significant bit of the result.
Note that equal and greater than are included for completeness.
> I have a doubt, while executing inst. SH do we have to shift the > rd, 16 bits or do we mask the upper order bits? before stoing in MAR. >
Inside the CPU's registers short data should always be kept in the low order bits (so that we can use it correctly in arithmetic operations). In memory short data sits at the address specified. So if you wanted to SH R1 at mem location A with:
R1 = 0000f3f2 mem[A]= 12345678
in the end memory should look like:
mem[A]= f3f25678
i.e. the half word of reg 1 was saved at the memory location A (without destroying any other memory but the 16 bit at mem location A.
So to do this you need to:
temp = R1<<16 MDR = mem[A] MDR = MDR & 0000ffff MDR = MDR | temp mem[A] = MDR
> You were talking about the project tonight and said something about > doing instructions in 'if' statements. If I did something like: > if( ir( 20, 25) - lmm(20,25) < 0 )... > > Thos are just fake values, but it gets my point across. Is this illegal?
You are allowed to use C++ if's to do comparisons with set patterns
(ie comparing the opcode part of the IR with the constant 0x04 to see if
is a BEQ instruction) but you are not allowed to do arbitrary
comparisons between bit ranges (ie comparing A.value() < B.value()) as
doing this requires a complex circuit. In addition, you are not allowed
to use C++ code to manipulate the data (you can't do
ir(20,25) - lmm(20,25)). All manipulation of the data inside the
simulated program should be done through the arch package.
Course Home Page
My Home Page