refractoring/cleaning

This commit is contained in:
Charles Papon 2017-03-28 01:53:37 +02:00
parent 62a55c4cf4
commit 2cb0e90077
3 changed files with 12 additions and 13 deletions

View file

@ -11,7 +11,7 @@ object STATIC extends BranchPrediction
object DYNAMIC extends BranchPrediction
class BranchPlugin(earlyBranch : Boolean,
catchUnalignedException : Boolean,
catchAddressMisaligned : Boolean,
prediction : BranchPrediction,
historyRamSizeLog2 : Int = 10,
historyWidth : Int = 2) extends Plugin[VexRiscv]{
@ -71,7 +71,7 @@ class BranchPlugin(earlyBranch : Boolean,
if (prediction != NONE)
predictionJumpInterface = pcManagerService.createJumpInterface(pipeline.decode)
if (catchUnalignedException) {
if (catchAddressMisaligned) {
val exceptionService = pipeline.service(classOf[ExceptionService])
branchExceptionPort = exceptionService.newExceptionPort(if (earlyBranch) pipeline.execute else pipeline.memory)
if (prediction != NONE) {
@ -130,7 +130,7 @@ class BranchPlugin(earlyBranch : Boolean,
stages(indexOf(branchStage) - 1).arbitration.flushAll := True
}
if(catchUnalignedException) {
if(catchAddressMisaligned) {
branchExceptionPort.valid := arbitration.isValid && input(BRANCH_DO) && jumpInterface.payload(1 downto 0) =/= 0
branchExceptionPort.code := 0
branchExceptionPort.badAddr := jumpInterface.payload
@ -181,7 +181,7 @@ class BranchPlugin(earlyBranch : Boolean,
fetch.arbitration.flushAll := True
}
if(catchUnalignedException) {
if(catchAddressMisaligned) {
predictionExceptionPort.valid := input(PREDICTION_HAD_BRANCHED) && arbitration.isValid && predictionJumpInterface.payload(1 downto 0) =/= 0
predictionExceptionPort.code := 0
predictionExceptionPort.badAddr := predictionJumpInterface.payload
@ -237,7 +237,7 @@ class BranchPlugin(earlyBranch : Boolean,
stages(indexOf(branchStage) - 1).arbitration.flushAll := True
}
if(catchUnalignedException) {
if(catchAddressMisaligned) {
branchExceptionPort.valid := arbitration.isValid && input(BRANCH_DO) && jumpInterface.payload(1 downto 0) =/= 0
branchExceptionPort.code := 0
branchExceptionPort.badAddr := jumpInterface.payload

View file

@ -18,7 +18,7 @@ case class DBusSimpleRsp() extends Bundle{
val data = Bits(32 bit)
}
class DBusSimplePlugin(catchUnalignedException : Boolean, catchAccessFault : Boolean) extends Plugin[VexRiscv]{
class DBusSimplePlugin(catchAddressMisaligned : Boolean, catchAccessFault : Boolean) extends Plugin[VexRiscv]{
var dCmd : Stream[DBusSimpleCmd] = null
var dRsp : DBusSimpleRsp = null
@ -45,9 +45,8 @@ class DBusSimplePlugin(catchUnalignedException : Boolean, catchAccessFault : Boo
SRC1_CTRL -> Src1CtrlEnum.RS,
SRC_USE_SUB_LESS -> False,
MEMORY_ENABLE -> True,
REG1_USE -> True,
IntAluPlugin.ALU_CTRL -> IntAluPlugin.AluCtrlEnum.ADD_SUB //Used for assess fault bad address in memory stage
)
REG1_USE -> True
) ++ (if(catchAccessFault) List(IntAluPlugin.ALU_CTRL -> IntAluPlugin.AluCtrlEnum.ADD_SUB) else Nil) //Used for access fault bad address in memory stage
val loadActions = stdActions ++ List(
SRC2_CTRL -> Src2CtrlEnum.IMI,
@ -74,7 +73,7 @@ class DBusSimplePlugin(catchUnalignedException : Boolean, catchAccessFault : Boo
SW -> (storeActions)
))
if(catchUnalignedException) {
if(catchAddressMisaligned) {
val exceptionService = pipeline.service(classOf[ExceptionService])
executeExceptionPort = exceptionService.newExceptionPort(pipeline.execute)
}
@ -109,7 +108,7 @@ class DBusSimplePlugin(catchUnalignedException : Boolean, catchAccessFault : Boo
insert(MEMORY_ADDRESS_LOW) := dCmd.address(1 downto 0)
if(catchUnalignedException){
if(catchAddressMisaligned){
executeExceptionPort.code := (dCmd.wr ? U(6) | U(4)).resized
executeExceptionPort.badAddr := dCmd.address
executeExceptionPort.valid := (arbitration.isValid && input(MEMORY_ENABLE)

View file

@ -85,7 +85,7 @@ object TopLevel {
new FullBarrielShifterPlugin,
// new LightShifterPlugin,
new DBusSimplePlugin(
catchUnalignedException = true,
catchAddressMisaligned = true,
catchAccessFault = true
),
new HazardSimplePlugin(true, true, true, true),
@ -96,7 +96,7 @@ object TopLevel {
new MachineCsr(csrConfig),
new BranchPlugin(
earlyBranch = false,
catchUnalignedException = true,
catchAddressMisaligned = true,
prediction = DYNAMIC
)
)