From c5cb8b714f2cf37447fc8b910898aebbbb419584 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 11 Apr 2017 09:26:33 -0700 Subject: [PATCH 01/11] debug: Bump version and location of OpenOCD to pick up fix for off-by-1 in hartsel --- regression/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/regression/Makefile b/regression/Makefile index 4d4e7abf..2c01ab9f 100644 --- a/regression/Makefile +++ b/regression/Makefile @@ -216,19 +216,19 @@ stamps/%/emulator-torture-$(TORTURE_CONFIG).stamp: stamps/%/emulator-debug.stamp # Targets for JTAG DTM full-chain simulation #OPENOCD_HEAD ?= riscv -OPENOCD_INSTALL ?= $(abspath $(TOP))/openocd-install -#OPENOCD_VERSION = $(shell git ls-remote http://github.com/sifive/openocd.git $(OPENOCD_HEAD) | awk '{print $$1}') -OPENOCD_VERSION = 02c83d1ef348ce237b72e157fa6df6c4e791feb3 +OPENOCD_INSTALL ?= $(abspath $(TOP))/riscv-openocd-install +#OPENOCD_VERSION = $(shell git ls-remote git@github.com/riscv/riscv-openocd.git $(OPENOCD_HEAD) | awk '{print $$1}') +OPENOCD_VERSION = 0e54044ac7d5f884e2be9f678e505613a4b3ce78 OPENOCD_DIR = $(OPENOCD_INSTALL)_$(OPENOCD_VERSION)/ $(OPENOCD_DIR)/bin/openocd: - rm -rf openocd - git clone http://github.com/sifive/openocd.git - cd openocd ; \ + rm -rf riscv-openocd + git clone git@github.com:riscv/riscv-openocd.git + cd riscv-openocd ; \ git checkout $(OPENOCD_VERSION) ; \ ./bootstrap ; \ - ./configure --enable-jtag-vpi --prefix=$(OPENOCD_INSTALL)_$(OPENOCD_VERSION) ; \ + ./configure --enable-jtag-vpi --prefix=$(OPENOCD_INSTALL)_$(OPENOCD_VERSION) --disable-werror; \ make ; \ make install From 2dc4be629400d3082ba0d576bbba1846d4dad4dd Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 11 Apr 2017 09:27:02 -0700 Subject: [PATCH 02/11] debug: remove preexec. Simplify the state machine since you can always just 'execute' once. --- .../scala/uncore/devices/debug/Debug.scala | 129 +++++------------- .../devices/debug/abstract_commands.scala | 5 +- 2 files changed, 34 insertions(+), 100 deletions(-) diff --git a/src/main/scala/uncore/devices/debug/Debug.scala b/src/main/scala/uncore/devices/debug/Debug.scala index f3c2431a..841fcc6c 100644 --- a/src/main/scala/uncore/devices/debug/Debug.scala +++ b/src/main/scala/uncore/devices/debug/Debug.scala @@ -52,19 +52,14 @@ object DsbRegAddrs{ def RESUMING = 0x108 def EXCEPTION = 0x10C - def FLAGS = 0x400 - - def ROMBASE = 0x800 - def RESUME = 0x804 - def WHERETO = 0x300 - def ABSTRACT = 0x340 - 8 - def PROGBUF = 0x340 - + def ABSTRACT = 0x304 + def PROGBUF = 0x304 + 8 // This shows up in HartInfo - def DATA = 0x380 + def DATA(cfg: DebugModuleConfig) = {PROGBUF + (cfg.nProgramBufferWords * 4)} - //Not implemented: Serial. + def FLAGS = 0x400 + def ROMBASE = 0x800 } @@ -226,8 +221,8 @@ class DebugCtrlBundle (nComponents: Int)(implicit val p: Parameters) extends Par * provide the default MTVEC since it is mapped * to address 0x0. * - * DebugModule is responsible for control registers and RAM. The Debug ROM is in a - * seperate module. It runs partially off of the dmiClk (e.g. TCK) and + * DebugModule is responsible for control registers and RAM, and + * Debug ROM. It runs partially off of the dmiClk (e.g. TCK) and * the TL clock. Therefore, it is divided into "Outer" portion (running * of off dmiClock and dmiReset) and "Inner" (running off tlClock and tlReset). * This allows DMCONTROL.haltreq, hartsel, dmactive, and ndreset to be @@ -354,8 +349,7 @@ class TLDebugModuleOuter(device: Device)(implicit p: Parameters) extends LazyMod io.debugInterrupts(component)(0) := debugIntRegs(component) } - // Halt request registers are written by write to DMCONTROL.haltreq - // and cleared by writes to DMCONTROL.resumereq. + // Halt request registers are set & cleared by writes to DMCONTROL.haltreq // resumereq also causes the core to execute a 'dret', // so resumereq is passed through to Inner. // hartsel must also be used by the DebugModule state machine, @@ -367,11 +361,8 @@ class TLDebugModuleOuter(device: Device)(implicit p: Parameters) extends LazyMod when (~dmactive) { debugIntNxt(component) := false.B }. otherwise { - when (DMCONTROLWrEn) { - when (DMCONTROLWrData.hartsel === component.U) { - debugIntNxt(component) := (debugIntRegs(component) | DMCONTROLWrData.haltreq) & - ~(DMCONTROLWrData.resumereq) - } + when (DMCONTROLWrEn && DMCONTROLWrData.hartsel === component.U) { + debugIntNxt(component) := DMCONTROLWrData.haltreq } } } @@ -549,7 +540,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: val HARTINFORdData = Wire (init = (new HARTINFOFields()).fromBits(0.U)) HARTINFORdData.dataaccess := true.B HARTINFORdData.datasize := cfg.nAbstractDataWords.U - HARTINFORdData.dataaddr := DsbRegAddrs.DATA.U + HARTINFORdData.dataaddr := DsbRegAddrs.DATA(cfg).U HARTINFORdData.nscratch := cfg.nScratch.U //----HALTSUM (and halted registers) @@ -597,8 +588,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: }.elsewhen (errorHaltResume) { ABSTRACTCSReg.cmderr := DebugAbstractCommandError.ErrHaltResume.id.U }.otherwise { - //TODO: Should be write-1-to-clear & ~ABSTRACTCSWrData.cmderr - when (ABSTRACTCSWrEn /* && ABSTRACTCSWrData.cmderr === 0.U*/){ + when (ABSTRACTCSWrEn){ ABSTRACTCSReg.cmderr := ABSTRACTCSReg.cmderr & ~(ABSTRACTCSWrData.cmderr); } } @@ -741,35 +731,15 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: // "Variable" ROM Generation //-------------------------------------------------------------- - val goProgramBuffer = Wire(init = false.B) - val goAbstract = Wire(init = false.B) - - val whereToReg = Reg(UInt(32.W)) - - val jalProgBuf = Wire(init = (new GeneratedUJ()).fromBits(rocket.Instructions.JAL.value.U)) - jalProgBuf.setImm(PROGBUF - WHERETO) - jalProgBuf.rd := 0.U - + val goReg = Reg(Bool()) + val goAbstract = Wire(init = false.B) val jalAbstract = Wire(init = (new GeneratedUJ()).fromBits(rocket.Instructions.JAL.value.U)) jalAbstract.setImm(ABSTRACT - WHERETO) - jalProgBuf.rd := 0.U - - when (~io.dmactive) { - whereToReg := 0.U - }.otherwise{ - when (goProgramBuffer) { - whereToReg := jalProgBuf.asUInt() - }.elsewhen (goAbstract) { - whereToReg := jalAbstract.asUInt() - } - } - - val goReg = Reg(Bool()) when (~io.dmactive){ goReg := false.B }.otherwise { - when (goProgramBuffer | goAbstract) { + when (goAbstract) { goReg := true.B }.elsewhen (hartGoingWrEn){ assert(hartGoingId === 0.U, "Unexpected 'GOING' hart.")//Chisel3 #540 %x, expected %x", hartGoingId, 0.U) @@ -849,14 +819,14 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: abstractGeneratedI.rd := (accessRegisterCommandReg.regno & 0x1F.U) abstractGeneratedI.funct3 := accessRegisterCommandReg.size abstractGeneratedI.rs1 := 0.U - abstractGeneratedI.imm := DATA.U + abstractGeneratedI.imm := DATA(cfg).U abstractGeneratedS.opcode := ((new GeneratedS()).fromBits(rocket.Instructions.SW.value.U)).opcode - abstractGeneratedS.immlo := (DATA & 0x1F).U + abstractGeneratedS.immlo := (DATA(cfg) & 0x1F).U abstractGeneratedS.funct3 := accessRegisterCommandReg.size abstractGeneratedS.rs1 := 0.U abstractGeneratedS.rs2 := (accessRegisterCommandReg.regno & 0x1F.U) - abstractGeneratedS.immhi := (DATA >> 5).U + abstractGeneratedS.immhi := (DATA(cfg) >> 5).U nop := ((new GeneratedI()).fromBits(rocket.Instructions.ADDI.value.U)) nop.rd := 0.U @@ -872,7 +842,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: abstractGeneratedS.asUInt()), nop.asUInt() ) - abstractGeneratedMem(1) := Mux(/*TODO accessRegisterCommandReg.postexec*/ false.B, + abstractGeneratedMem(1) := Mux(accessRegisterCommandReg.postexec, nop.asUInt(), rocket.Instructions.EBREAK.value.U) } @@ -887,15 +857,16 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: GOING -> Seq(WNotify(sbIdWidth, hartGoingId, hartGoingWrEn)), RESUMING -> Seq(WNotify(sbIdWidth, hartResumingId, hartResumingWrEn)), EXCEPTION -> Seq(WNotify(sbIdWidth, hartExceptionId, hartExceptionWrEn)), - DATA -> abstractDataMem.map(x => RegField(8, x)), + DATA(cfg) -> abstractDataMem.map(x => RegField(8, x)), PROGBUF -> programBufferMem.map(x => RegField(8, x)), // These sections are read-only. - ROMBASE -> DebugRomContents().map(x => RegField.r(8, (x & 0xFF).U(8.W))), + WHERETO -> Seq(RegField.r(32, jalAbstract.asUInt)), + ABSTRACT -> abstractGeneratedMem.map{x => RegField.r(32, x)}, FLAGS -> flags.map{x => RegField.r(8, x.asUInt())}, - WHERETO -> Seq(RegField.r(32, whereToReg)), - ABSTRACT -> abstractGeneratedMem.map(x => RegField.r(32, x)) - ) + ROMBASE -> DebugRomContents().map(x => RegField.r(8, (x & 0xFF).U(8.W))) + + ) // Override System Bus accesses with dmactive reset. when (~io.dmactive){ @@ -909,7 +880,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: object CtrlState extends scala.Enumeration { type CtrlState = Value - val Waiting, CheckGenerate, PreExec, Abstract, PostExec = Value + val Waiting, CheckGenerate, Exec = Value def apply( t : Value) : UInt = { t.id.U(log2Up(values.size).W) @@ -957,13 +928,12 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: //------------------------ // Variable ROM STATE MACHINE // ----------------------- - + when (ctrlStateReg === CtrlState(Waiting)){ when (wrAccessRegisterCommand || regAccessRegisterCommand) { ctrlStateNxt := CtrlState(CheckGenerate) } - }.elsewhen (ctrlStateReg === CtrlState(CheckGenerate)){ // We use this state to ensure that the COMMAND has been @@ -977,47 +947,11 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: errorHaltResume := true.B ctrlStateNxt := CtrlState(Waiting) }.otherwise { - when (accessRegisterCommandReg.preexec) { - ctrlStateNxt := CtrlState(PreExec) - goProgramBuffer := true.B - }.otherwise { - ctrlStateNxt := CtrlState(Abstract) - goAbstract := true.B - } - } - }.elsewhen (ctrlStateReg === CtrlState(PreExec)) { - - // We can't just look at 'hartHalted' here, because - // hartHaltedWrEn is overloaded to mean 'got an ebreak' - // which may have happened when we were already halted. - when(goReg === false.B && hartHaltedWrEn && (cfg.hartIdToHartSel(hartHaltedId) === selectedHartReg)){ - ctrlStateNxt := CtrlState(Abstract) + ctrlStateNxt := CtrlState(Exec) goAbstract := true.B } - when(hartExceptionWrEn) { - assert(hartExceptionId === 0.U, "Unexpected 'EXCEPTION' hart")// Chisel3 #540, %x, expected %x", hartExceptionId, 0.U) - ctrlStateNxt := CtrlState(Waiting) - errorException := true.B - } - }.elsewhen (ctrlStateReg === CtrlState(Abstract)) { - - // We can't just look at 'hartHalted' here, because - // hartHaltedWrEn is overloaded to mean 'got an ebreak' - // which may have happened when we were already halted. - when(goReg === false.B && hartHaltedWrEn && (cfg.hartIdToHartSel(hartHaltedId) === selectedHartReg)){ - when (accessRegisterCommandReg.postexec) { - ctrlStateNxt := CtrlState(PostExec) - goProgramBuffer := true.B - }.otherwise { - ctrlStateNxt := CtrlState(Waiting) - } - } - when(hartExceptionWrEn) { - assert(hartExceptionId === 0.U, "Unexpected 'EXCEPTION' hart")//Chisel3 #540 %x, expected %x", hartExceptionId, selectedHartReg) - ctrlStateNxt := CtrlState(Waiting) - errorUnsupported := true.B - } - }.elsewhen (ctrlStateReg === CtrlState(PostExec)) { + + }.elsewhen (ctrlStateReg === CtrlState(Exec)) { // We can't just look at 'hartHalted' here, because // hartHaltedWrEn is overloaded to mean 'got an ebreak' @@ -1027,7 +961,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: } when(hartExceptionWrEn) { assert(hartExceptionId === 0.U, "Unexpected 'EXCEPTION' hart")//Chisel3 #540, %x, expected %x", hartExceptionId, 0.U) - ctrlStateNxt := CtrlState(Waiting) + ctrlStateNxt := CtrlState(Waiting) errorException := true.B } } @@ -1040,6 +974,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: } } + // Wrapper around TL Debug Module Inner and an Async DMI Sink interface. // Handles the synchronization of dmactive, which is used as a synchronous reset // inside the Inner block. diff --git a/src/main/scala/uncore/devices/debug/abstract_commands.scala b/src/main/scala/uncore/devices/debug/abstract_commands.scala index f772af23..da720282 100644 --- a/src/main/scala/uncore/devices/debug/abstract_commands.scala +++ b/src/main/scala/uncore/devices/debug/abstract_commands.scala @@ -28,9 +28,8 @@ class ACCESS_REGISTERFields extends Bundle { */ val size = UInt(3.W) - // HACK -- for now I have not yet deleted preexecval reserved1 = UInt(1.W) - val preexec = Bool() - + val reserved1 = UInt(1.W) + /* When 1, execute the program in the Program Buffer exactly once after performing the transfer, if any. */ From 79477fbea63625e2c5c289733f253b162ac2924e Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Tue, 11 Apr 2017 15:50:32 -0700 Subject: [PATCH 03/11] debug: Properly consider 'transfer' bit --- src/main/scala/uncore/devices/debug/Debug.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/uncore/devices/debug/Debug.scala b/src/main/scala/uncore/devices/debug/Debug.scala index 841fcc6c..b3eb2348 100644 --- a/src/main/scala/uncore/devices/debug/Debug.scala +++ b/src/main/scala/uncore/devices/debug/Debug.scala @@ -834,7 +834,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: nop.imm := 0.U when (goAbstract) { - abstractGeneratedMem(0) := Mux(/*TODO: accessRegisterCommandReg.transfer*/true.B, + abstractGeneratedMem(0) := Mux(accessRegisterCommandReg.transfer, Mux(accessRegisterCommandReg.write, // To write a register, we need to do LW. abstractGeneratedI.asUInt(), @@ -915,7 +915,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: val commandRegIsUnsupported = Wire(init = true.B) val commandRegBadHaltResume = Wire(init = false.B) - when (commandRegIsAccessRegister) { + when (commandRegIsAccessRegister && accessRegisterCommandReg.transfer) { when ((accessRegisterCommandReg.regno >= 0x1000.U && accessRegisterCommandReg.regno <= 0x101F.U)){ commandRegIsUnsupported := false.B commandRegBadHaltResume := ~hartHalted From b44d5f9386bd4fe72a29c5bd643557871ed217f8 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Wed, 12 Apr 2017 21:18:01 -0700 Subject: [PATCH 04/11] debug: correctly consider .transfer bit in COMMAND --- src/main/scala/uncore/devices/debug/Debug.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/uncore/devices/debug/Debug.scala b/src/main/scala/uncore/devices/debug/Debug.scala index b3eb2348..33e9a617 100644 --- a/src/main/scala/uncore/devices/debug/Debug.scala +++ b/src/main/scala/uncore/devices/debug/Debug.scala @@ -915,8 +915,8 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: val commandRegIsUnsupported = Wire(init = true.B) val commandRegBadHaltResume = Wire(init = false.B) - when (commandRegIsAccessRegister && accessRegisterCommandReg.transfer) { - when ((accessRegisterCommandReg.regno >= 0x1000.U && accessRegisterCommandReg.regno <= 0x101F.U)){ + when (commandRegIsAccessRegister) { + when (!accessRegisterCommandReg.transfer || (accessRegisterCommandReg.regno >= 0x1000.U && accessRegisterCommandReg.regno <= 0x101F.U)){ commandRegIsUnsupported := false.B commandRegBadHaltResume := ~hartHalted } From af6b2d8051474bf7729165219ffc463847a0dbb6 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Thu, 13 Apr 2017 12:27:32 -0700 Subject: [PATCH 05/11] debug: DATA Region has to be aligned for ld/sd to correctly detect 64-bit cores. --- .../scala/uncore/devices/debug/Debug.scala | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/src/main/scala/uncore/devices/debug/Debug.scala b/src/main/scala/uncore/devices/debug/Debug.scala index 33e9a617..100649f4 100644 --- a/src/main/scala/uncore/devices/debug/Debug.scala +++ b/src/main/scala/uncore/devices/debug/Debug.scala @@ -53,10 +53,20 @@ object DsbRegAddrs{ def EXCEPTION = 0x10C def WHERETO = 0x300 - def ABSTRACT = 0x304 - def PROGBUF = 0x304 + 8 - // This shows up in HartInfo - def DATA(cfg: DebugModuleConfig) = {PROGBUF + (cfg.nProgramBufferWords * 4)} + // This needs to be aligned for up to lq/sq + + + // This shows up in HartInfo, and needs to be aligned + // to enable up to LQ/SQ instructions. + def DATA = 0x380 + + // We want DATA to immediately follow PROGBUF so that we can + // use them interchangeably. + def PROGBUF(cfg:DebugModuleConfig) = {DATA - (cfg.nProgramBufferWords * 4)} + + // We want abstract to be immediately before PROGBUF + // because we auto-generate 2 instructions. + def ABSTRACT(cfg:DebugModuleConfig) = PROGBUF(cfg) - 8 def FLAGS = 0x400 def ROMBASE = 0x800 @@ -540,7 +550,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: val HARTINFORdData = Wire (init = (new HARTINFOFields()).fromBits(0.U)) HARTINFORdData.dataaccess := true.B HARTINFORdData.datasize := cfg.nAbstractDataWords.U - HARTINFORdData.dataaddr := DsbRegAddrs.DATA(cfg).U + HARTINFORdData.dataaddr := DsbRegAddrs.DATA.U HARTINFORdData.nscratch := cfg.nScratch.U //----HALTSUM (and halted registers) @@ -734,7 +744,7 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: val goReg = Reg(Bool()) val goAbstract = Wire(init = false.B) val jalAbstract = Wire(init = (new GeneratedUJ()).fromBits(rocket.Instructions.JAL.value.U)) - jalAbstract.setImm(ABSTRACT - WHERETO) + jalAbstract.setImm(ABSTRACT(cfg) - WHERETO) when (~io.dmactive){ goReg := false.B @@ -819,14 +829,14 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: abstractGeneratedI.rd := (accessRegisterCommandReg.regno & 0x1F.U) abstractGeneratedI.funct3 := accessRegisterCommandReg.size abstractGeneratedI.rs1 := 0.U - abstractGeneratedI.imm := DATA(cfg).U + abstractGeneratedI.imm := DATA.U abstractGeneratedS.opcode := ((new GeneratedS()).fromBits(rocket.Instructions.SW.value.U)).opcode - abstractGeneratedS.immlo := (DATA(cfg) & 0x1F).U + abstractGeneratedS.immlo := (DATA & 0x1F).U abstractGeneratedS.funct3 := accessRegisterCommandReg.size abstractGeneratedS.rs1 := 0.U abstractGeneratedS.rs2 := (accessRegisterCommandReg.regno & 0x1F.U) - abstractGeneratedS.immhi := (DATA(cfg) >> 5).U + abstractGeneratedS.immhi := (DATA >> 5).U nop := ((new GeneratedI()).fromBits(rocket.Instructions.ADDI.value.U)) nop.rd := 0.U @@ -857,14 +867,14 @@ class TLDebugModuleInner(device: Device, getNComponents: () => Int)(implicit p: GOING -> Seq(WNotify(sbIdWidth, hartGoingId, hartGoingWrEn)), RESUMING -> Seq(WNotify(sbIdWidth, hartResumingId, hartResumingWrEn)), EXCEPTION -> Seq(WNotify(sbIdWidth, hartExceptionId, hartExceptionWrEn)), - DATA(cfg) -> abstractDataMem.map(x => RegField(8, x)), - PROGBUF -> programBufferMem.map(x => RegField(8, x)), + DATA -> abstractDataMem.map(x => RegField(8, x)), + PROGBUF(cfg)-> programBufferMem.map(x => RegField(8, x)), // These sections are read-only. - WHERETO -> Seq(RegField.r(32, jalAbstract.asUInt)), - ABSTRACT -> abstractGeneratedMem.map{x => RegField.r(32, x)}, - FLAGS -> flags.map{x => RegField.r(8, x.asUInt())}, - ROMBASE -> DebugRomContents().map(x => RegField.r(8, (x & 0xFF).U(8.W))) + WHERETO -> Seq(RegField.r(32, jalAbstract.asUInt)), + ABSTRACT(cfg)-> abstractGeneratedMem.map{x => RegField.r(32, x)}, + FLAGS -> flags.map{x => RegField.r(8, x.asUInt())}, + ROMBASE -> DebugRomContents().map(x => RegField.r(8, (x & 0xFF).U(8.W))) ) From 9a6e7afc933a4a6aaf2971f8cb507847d088c37b Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Fri, 14 Apr 2017 10:32:06 -0700 Subject: [PATCH 06/11] debug: bump OpenOCD to latest version of newprogram (with Examined RISC-V core message) --- regression/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression/Makefile b/regression/Makefile index 2c01ab9f..aab870d9 100644 --- a/regression/Makefile +++ b/regression/Makefile @@ -218,7 +218,7 @@ stamps/%/emulator-torture-$(TORTURE_CONFIG).stamp: stamps/%/emulator-debug.stamp #OPENOCD_HEAD ?= riscv OPENOCD_INSTALL ?= $(abspath $(TOP))/riscv-openocd-install #OPENOCD_VERSION = $(shell git ls-remote git@github.com/riscv/riscv-openocd.git $(OPENOCD_HEAD) | awk '{print $$1}') -OPENOCD_VERSION = 0e54044ac7d5f884e2be9f678e505613a4b3ce78 +OPENOCD_VERSION = 0e66b07550de9076620e45d1f90e38ac6ef8f9d1 OPENOCD_DIR = $(OPENOCD_INSTALL)_$(OPENOCD_VERSION)/ From 9cf86fa10534fa8683ac0d0cfed83d781641a088 Mon Sep 17 00:00:00 2001 From: Megan Wachs Date: Fri, 14 Apr 2017 10:33:05 -0700 Subject: [PATCH 07/11] debug: checkpoint pointing to riscv-tools that picks up some tweaks in the debug riscv-tests --- riscv-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv-tools b/riscv-tools index cd8bc479..792ef0d3 160000 --- a/riscv-tools +++ b/riscv-tools @@ -1 +1 @@ -Subproject commit cd8bc4798c38ba11118492474e96baf717c7af36 +Subproject commit 792ef0d30034a9bcd60dd5bcc4653fd482e97922 From a454edaaf72a0bcee73ddee0dfec1217fb479a12 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Fri, 14 Apr 2017 15:12:17 -0700 Subject: [PATCH 08/11] Treat exceptions as steps for the purposes of single-stepping --- src/main/scala/rocket/CSR.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/rocket/CSR.scala b/src/main/scala/rocket/CSR.scala index a975a1ea..1ec4db24 100644 --- a/src/main/scala/rocket/CSR.scala +++ b/src/main/scala/rocket/CSR.scala @@ -503,7 +503,7 @@ class CSRFile(perfEventSets: EventSets = new EventSets(Seq()))(implicit p: Param when (pending_interrupts.orR || exception) { reg_wfi := false } assert(!reg_wfi || io.retire === UInt(0)) - when (io.retire(0)) { reg_singleStepped := true } + when (io.retire(0) || exception) { reg_singleStepped := true } when (!io.singleStep) { reg_singleStepped := false } assert(!io.singleStep || io.retire <= UInt(1)) assert(!reg_singleStepped || io.retire === UInt(0)) From aad4f350bf5903767ec624dd27619ec287a669a3 Mon Sep 17 00:00:00 2001 From: Yunsup Lee Date: Fri, 14 Apr 2017 23:42:57 -0700 Subject: [PATCH 09/11] bump tools --- riscv-tools | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/riscv-tools b/riscv-tools index 792ef0d3..1bf2c200 160000 --- a/riscv-tools +++ b/riscv-tools @@ -1 +1 @@ -Subproject commit 792ef0d30034a9bcd60dd5bcc4653fd482e97922 +Subproject commit 1bf2c200443a20291b4f35d565c54eb96dcdf40d From debcbca7ded48b7aee928cb46f03ca1525fdc4b6 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Sat, 15 Apr 2017 00:54:49 -0700 Subject: [PATCH 10/11] Make PMP tolerant to PA size << VA size --- src/main/scala/rocket/PMP.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/rocket/PMP.scala b/src/main/scala/rocket/PMP.scala index fb19755f..cec4f25e 100644 --- a/src/main/scala/rocket/PMP.scala +++ b/src/main/scala/rocket/PMP.scala @@ -80,7 +80,7 @@ class PMP(implicit p: Parameters) extends PMPReg { prev.lowerBoundMatch(x, lgSize, lgMaxSize) && upperBoundMatch(x, lgMaxSize) private def pow2Homogeneous(x: UInt, pgLevel: UInt) = { - val maskHomogeneous = pgLevelMap { idxBits => mask(idxBits - 1) } (pgLevel) + val maskHomogeneous = pgLevelMap { idxBits => if (idxBits > paddrBits) false.B else mask(idxBits - 1) } (pgLevel) maskHomogeneous || (pgLevelMap { idxBits => ((x ^ comparand) >> idxBits) =/= 0 } (pgLevel)) } @@ -92,7 +92,7 @@ class PMP(implicit p: Parameters) extends PMPReg { val beginsAfterLower = !(x < prev.comparand) val beginsAfterUpper = !(x < comparand) - val pgMask = pgLevelMap { idxBits => ((BigInt(1) << paddrBits) - (BigInt(1) << idxBits)).U } (pgLevel) + val pgMask = pgLevelMap { idxBits => (((BigInt(1) << paddrBits) - (BigInt(1) << idxBits)) max 0).U } (pgLevel) val endsBeforeLower = (x & pgMask) < (prev.comparand & pgMask) val endsBeforeUpper = (x & pgMask) < (comparand & pgMask) From 1ad5ef7aa2c9cac5ea234136dd98a1c97a5f6d42 Mon Sep 17 00:00:00 2001 From: Yunsup Lee Date: Mon, 17 Apr 2017 00:24:09 -0700 Subject: [PATCH 11/11] bump chisel --- chisel3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chisel3 b/chisel3 index 00796dfc..bb12fe7f 160000 --- a/chisel3 +++ b/chisel3 @@ -1 +1 @@ -Subproject commit 00796dfce1ec3eba739467571cdfc52df2aa62de +Subproject commit bb12fe7f61d12f51cf5d56b2a66aca0a1234abb3