From 955e70206c646fc1a19f4605dd3363aa8eeee17e Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 26 Apr 2019 18:01:35 +0800 Subject: [PATCH] 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 --- src/main/scala/vexriscv/plugin/MmuPlugin.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/vexriscv/plugin/MmuPlugin.scala b/src/main/scala/vexriscv/plugin/MmuPlugin.scala index ebf46c4..9dedde5 100644 --- a/src/main/scala/vexriscv/plugin/MmuPlugin.scala +++ b/src/main/scala/vexriscv/plugin/MmuPlugin.scala @@ -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 }