turn newAddrBits in incOffsetFat into a Bit#(MW) as pointed out by

Dapeng Gao + some comments
This commit is contained in:
Alexandre Joannou
2021-01-22 15:40:31 +00:00
parent 7c4191cfbb
commit bd378bf834

View File

@@ -626,11 +626,13 @@ function VnD#(CapFat) incOffsetFat( CapFat cap
// Get the base and add the offsetAddr. This could be slow, but seems to // Get the base and add the offsetAddr. This could be slow, but seems to
// pass timing. // pass timing.
ret.address = getBotFat(cap,tf) + offsetAddr; ret.address = getBotFat(cap,tf) + offsetAddr;
// TODO write comments on this // Work out the slice of the address we are interested in using MW-bit
Bit#(TAdd#(MW,2)) newAddrBits = zeroExtend(cap.bounds.baseBits) + zeroExtend(offsetBits); // arithmetics.
ret.addrBits = (e == resetExp) ? {2'b0, truncate(newAddrBits)} : Bit#(MW) newAddrBits = cap.bounds.baseBits + offsetBits;
(e == resetExp-1) ? {1'b0, truncate(newAddrBits)} : // Ensure the bits of the address slice past the top of the address space
truncate(newAddrBits); // are zero
Bit#(2) mask = (e == resetExp) ? 2'b00 : (e == resetExp-1) ? 2'b01 : 2'b11;
ret.addrBits = {mask, ~0} & newAddrBits;
end else begin end else begin
// In the incOffset case, the 'pointer' argument already contains the new // In the incOffset case, the 'pointer' argument already contains the new
// address // address