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

Commit

Permalink
pass input registers into the next stage
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed May 17, 2024
1 parent 59c8bb6 commit fd4f259
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 29 deletions.
14 changes: 11 additions & 3 deletions src/main/scala/hwdbg/script/eval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class ScriptEngineEval(
// Evaluation symbol
//
val symbol = Input(new SYMBOL)

val currentStage = Input(UInt(log2Ceil(maximumNumberOfStages).W))
val nextStage = Output(UInt(log2Ceil(maximumNumberOfStages).W))

//
Expand All @@ -52,14 +54,18 @@ class ScriptEngineEval(
// Output pins
//
// val outputPin = Wire(Vec(numberOfPins, UInt(1.W)))
// val nextStage = Wire(UInt(log2Ceil(maximumNumberOfStages).W))
val nextStage = Wire(UInt(log2Ceil(maximumNumberOfStages).W))

//
// Increment the stage
//
nextStage := io.currentStage + 1.U

//
// Connect the output signals
//
// io.nextStage := nextStage
io.nextStage := nextStage
// io.outputPin := outputPin
io.nextStage := 0.U
io.outputPin := io.inputPin

}
Expand All @@ -74,6 +80,7 @@ object ScriptEngineEval {
)(
en: Bool,
symbol: SYMBOL,
currentStage: UInt,
inputPin: Vec[UInt]
): (UInt, Vec[UInt]) = {

Expand All @@ -94,6 +101,7 @@ object ScriptEngineEval {
//
scriptEngineEvalModule.io.en := en
scriptEngineEvalModule.io.symbol := symbol
scriptEngineEvalModule.io.currentStage := currentStage
scriptEngineEvalModule.io.inputPin := inputPin

//
Expand Down
75 changes: 49 additions & 26 deletions src/main/scala/hwdbg/script/exec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,33 +84,56 @@ class ScriptExecutionEngine(
} else {

//
// Instantiate an eval engine for this stage
// Check if this stage should be ignored (passed to the next stage) or be evaluated
//
val (
nextStage,
outputPin
) = ScriptEngineEval(
debug,
numberOfPins,
maximumNumberOfStages,
portsConfiguration
)(
io.en,
stageRegs(i).scriptSymbol,
stageRegs(i).pinValues
)

//
// At the normal (middle) stage, the result of state registers should be passed to
// the next level of stage registers
//
stageRegs(i + 1).pinValues := outputPin

//
// Pass the target stage symbol number to the next stage
//
stageRegs(i + 1).targetStage := nextStage

when(i.U === stageRegs(i).targetStage) {

//
// *** Based on target stage, this stage needs evaluation ***
//

//
// Instantiate an eval engine for this stage
//
val (
nextStage,
outputPin
) = ScriptEngineEval(
debug,
numberOfPins,
maximumNumberOfStages,
portsConfiguration
)(
io.en,
stageRegs(i).scriptSymbol,
stageRegs(i).targetStage,
stageRegs(i).pinValues
)

//
// At the normal (middle) stage, the result of state registers should be passed to
// the next level of stage registers
//
stageRegs(i + 1).pinValues := outputPin

//
// Pass the target stage symbol number to the next stage
//
stageRegs(i + 1).targetStage := nextStage

}.otherwise {

//
// *** Based on target stage, this stage should be ignore ***
//

//
// Just pass all the values to the next stage
//
stageRegs(i + 1).pinValues := stageRegs(i).pinValues
stageRegs(i + 1).targetStage := stageRegs(i).targetStage

}
}
}

Expand Down

0 comments on commit fd4f259

Please sign in to comment.