MmuPlugin: fix generation without writeBack stage

If there is no writeBack stage, the elaboration step would hit a
NullPointerException when trying to insert into the writeBack stage.

Instead, pull from the most recent stage, which is where MMU access
should reside.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-04-26 18:01:35 +08:00
parent 6fc5406901
commit b2f387ccac
1 changed files with 3 additions and 2 deletions

View File

@ -250,8 +250,9 @@ class MmuPlugin(ioRange : UInt => Bool,
}
}
writeBack plug new Area{
import writeBack._
val fenceStage = stages.last
fenceStage plug new Area{
import fenceStage._
when(arbitration.isValid && input(IS_SFENCE_VMA)){ // || csrService.isWriting(CSR.SATP)
for(port <- core.ports; line <- port.cache) line.valid := False //Assume that the instruction already fetched into the pipeline are ok
}