Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Commit

Permalink
make connection to different execution stages
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed May 7, 2024
1 parent 77c136d commit a4b0118
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
1 change: 1 addition & 0 deletions sim/hwdbg/DebuggerModuleTestingBRAM/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ VERILOG_SOURCES += $(shell pwd)/../../../generated/DebuggerPacketInterpreter.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterSendVersion.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterSendError.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/InterpreterPortInformation.sv
VERILOG_SOURCES += $(shell pwd)/../../../generated/ScriptExecutionEngine.sv
TOPLEVEL = DebuggerModuleTestingBRAM
MODULE = test_DebuggerModuleTestingBRAM

Expand Down
24 changes: 20 additions & 4 deletions src/main/scala/hwdbg/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import hwdbg.version._
import hwdbg.configs._
import hwdbg.types._
import hwdbg.utils._
import hwdbg.script._
import hwdbg.communication._
import hwdbg.communication.interpreter._

Expand Down Expand Up @@ -157,15 +158,30 @@ class DebuggerMain(
sendWaitForBuffer := outSendWaitForBuffer

// -----------------------------------------------------------------------
// Configure the output signals
// Create instance from script execution engine
//
for (i <- 0 until numberOfPins) {
io.outputPin(i) := 0.U
}
val (outputPin) =
ScriptExecutionEngine(
debug,
numberOfPins,
maximumNumberOfStages,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)(
io.en,
io.inputPin
)

// -----------------------------------------------------------------------
// Configure the output signals
//
io.wrEna := wrEna
io.wrData := wrData
io.rdWrAddr := rdWrAddr

io.outputPin := outputPin

io.psOutInterrupt := psOutInterrupt

}
Expand Down
25 changes: 14 additions & 11 deletions src/main/scala/hwdbg/script/exec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.exec
package hwdbg.script

import chisel3._
import chisel3.util._

import hwdbg.configs._
import hwdbg.stage._

class ScriptExec(
class ScriptExecutionEngine(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = DebuggerConfigurations.MAXIMUM_NUMBER_OF_STAGES,
Expand Down Expand Up @@ -66,14 +66,16 @@ class ScriptExec(
// At the first stage, the input registers should be passed to the
// first registers set of the stage registers
//
stageRegs.pinValues(i) := io.inputPin
stageRegs.pinValues(i) := io.inputPin.asUInt

} else if (i == (maximumNumberOfStages - 1)) {

//
// At the last stage, the state registers should be passed to the output
//
outputPin := stageRegs.pinValues(i)
for (j <- 0 until numberOfPins) {
outputPin(j) := stageRegs.pinValues(i)(j)
}

} else {

Expand All @@ -84,6 +86,7 @@ class ScriptExec(
stageRegs.pinValues(i + 1) := stageRegs.pinValues(i)
}
}

// -----------------------------------------------------------------------

//
Expand All @@ -93,7 +96,7 @@ class ScriptExec(

}

object ScriptExec {
object ScriptExecutionEngine {

def apply(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
Expand All @@ -107,8 +110,8 @@ object ScriptExec {
inputPin: Vec[UInt]
): (Vec[UInt]) = {

val scriptExecModule = Module(
new ScriptExec(
val scriptExecutionEngineModule = Module(
new ScriptExecutionEngine(
debug,
numberOfPins,
maximumNumberOfStages,
Expand All @@ -123,17 +126,17 @@ object ScriptExec {
//
// Configure the input signals
//
scriptExecModule.io.en := en
scriptExecModule.io.inputPin := inputPin
scriptExecutionEngineModule.io.en := en
scriptExecutionEngineModule.io.inputPin := inputPin

//
// Configure the output signals
//
outputPin := scriptExecModule.io.outputPin
outputPin := scriptExecutionEngineModule.io.outputPin

//
// Return the output result
//
outputPin
(outputPin)
}
}

0 comments on commit a4b0118

Please sign in to comment.