updated so svmode actually causes the right state tranitions. fsm now stuck in idle loop

This commit is contained in:
Kip Macsai-Goren 2021-06-22 11:21:11 -04:00
parent 9b27cd6fb7
commit 3e19eba20d

View File

@ -225,49 +225,51 @@ module pagetablewalker (
always_comb begin always_comb begin
case (WalkerState) case (WalkerState)
IDLE: if (MMUTranslate) NextWalkerState = LEVEL3; IDLE: if (MMUTranslate && SvMode == `SV48) NextWalkerState = LEVEL3;
else NextWalkerState = IDLE; else if (MMUTranslate && SvMode == `SV39) NextWalkerState = LEVEL2;
LEVEL3: if (SvMode != `SV48) NextWalkerState = LEVEL2; else NextWalkerState = IDLE;
// 3rd level used if SV48 is enabled.
else begin LEVEL3: if (~MMUReady) NextWalkerState = LEVEL3;
if (~MMUReady) NextWalkerState = LEVEL3; // *** <FUTURE WORK> According to the architecture, we should
// *** <FUTURE WORK> According to the architecture, we should // fault upon finding a superpage that is misaligned or has 0
// fault upon finding a superpage that is misaligned or has 0 // access bit. The following commented line of code is
// access bit. The following commented line of code is // supposed to perform that check. However, it is untested.
// supposed to perform that check. However, it is untested. else if (ValidPTE && LeafPTE && ~BadTerapage) NextWalkerState = LEAF;
else if (ValidPTE && LeafPTE && ~BadTerapage) NextWalkerState = LEAF; // else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line.
// else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line. else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL2;
else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL2; else NextWalkerState = FAULT;
else NextWalkerState = FAULT;
end LEVEL2: if (~MMUReady) NextWalkerState = LEVEL2;
LEVEL2: if (~MMUReady) NextWalkerState = LEVEL2;
// *** <FUTURE WORK> According to the architecture, we should // *** <FUTURE WORK> According to the architecture, we should
// fault upon finding a superpage that is misaligned or has 0 // fault upon finding a superpage that is misaligned or has 0
// access bit. The following commented line of code is // access bit. The following commented line of code is
// supposed to perform that check. However, it is untested. // supposed to perform that check. However, it is untested.
else if (ValidPTE && LeafPTE && ~BadGigapage) NextWalkerState = LEAF; else if (ValidPTE && LeafPTE && ~BadGigapage) NextWalkerState = LEAF;
// else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line. // else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line.
else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL1; else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL1;
else NextWalkerState = FAULT; else NextWalkerState = FAULT;
LEVEL1: if (~MMUReady) NextWalkerState = LEVEL1;
LEVEL1: if (~MMUReady) NextWalkerState = LEVEL1;
// *** <FUTURE WORK> According to the architecture, we should // *** <FUTURE WORK> According to the architecture, we should
// fault upon finding a superpage that is misaligned or has 0 // fault upon finding a superpage that is misaligned or has 0
// access bit. The following commented line of code is // access bit. The following commented line of code is
// supposed to perform that check. However, it is untested. // supposed to perform that check. However, it is untested.
else if (ValidPTE && LeafPTE && ~BadMegapage) NextWalkerState = LEAF; else if (ValidPTE && LeafPTE && ~BadMegapage) NextWalkerState = LEAF;
// else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line. // else if (ValidPTE && LeafPTE) NextWalkerState = LEAF; // *** Once the above line is properly tested, delete this line.
else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL0; else if (ValidPTE && ~LeafPTE) NextWalkerState = LEVEL0;
else NextWalkerState = FAULT; else NextWalkerState = FAULT;
LEVEL0: if (~MMUReady) NextWalkerState = LEVEL0;
else if (ValidPTE && LeafPTE && ~AccessAlert) LEVEL0: if (~MMUReady) NextWalkerState = LEVEL0;
NextWalkerState = LEAF; else if (ValidPTE && LeafPTE && ~AccessAlert) NextWalkerState = LEAF;
else NextWalkerState = FAULT; else NextWalkerState = FAULT;
LEAF: if (MMUTranslate) NextWalkerState = LEVEL3;
else NextWalkerState = IDLE; LEAF: if (MMUTranslate) NextWalkerState = LEVEL3;
FAULT: if (MMUTranslate) NextWalkerState = LEVEL3; else NextWalkerState = IDLE;
else NextWalkerState = IDLE;
FAULT: if (MMUTranslate) NextWalkerState = LEVEL3;
else NextWalkerState = IDLE;
// Default case should never happen, but is included for linter. // Default case should never happen, but is included for linter.
default: NextWalkerState = IDLE; default: NextWalkerState = IDLE;
endcase endcase
end end