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

Commit

Permalink
add target stage registers
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed May 17, 2024
1 parent b3863d4 commit d7095c1
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/main/scala/hwdbg/configs/configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ object DebuggerConfigurations {
// Data width of the Block RAM (BRAM)
//
val BLOCK_RAM_DATA_WIDTH: Int = 32

//
// Single stage script symbol size (equal to sizeof(SYMBOL))
//
val SINGLE_STAGE_SCRIPT_SYMBOL_SIZE: Int = 32
}

/**
Expand Down
32 changes: 16 additions & 16 deletions src/main/scala/hwdbg/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ class DebuggerMain(
val receivingData = Wire(UInt(bramDataWidth.W))
val sendWaitForBuffer = Wire(Bool())

// -----------------------------------------------------------------------
// Create instance from script execution engine
//
val (outputPin) =
ScriptExecutionEngine(
debug,
numberOfPins,
maximumNumberOfStages,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)(
io.en,
io.inputPin
)

// -----------------------------------------------------------------------
// Create instance from interpreter
//
Expand Down Expand Up @@ -157,22 +173,6 @@ class DebuggerMain(
receivingData := outReceivingData
sendWaitForBuffer := outSendWaitForBuffer

// -----------------------------------------------------------------------
// Create instance from script execution engine
//
val (outputPin) =
ScriptExecutionEngine(
debug,
numberOfPins,
maximumNumberOfStages,
bramAddrWidth,
bramDataWidth,
portsConfiguration
)(
io.en,
io.inputPin
)

// -----------------------------------------------------------------------
// Configure the output signals
//
Expand Down
12 changes: 12 additions & 0 deletions src/main/scala/hwdbg/script/exec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ class ScriptExecutionEngine(
//
stageRegs.pinValues(i) := io.inputPin.asUInt

//
// Each pin start initially start from 0th target stage
//
// stageRegs.targetStage(i) := 0.U

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

//
// At the last stage, the state registers should be passed to the output
// Note: At this stage script symbol is useless
//
for (j <- 0 until numberOfPins) {
outputPin(j) := stageRegs.pinValues(i)(j)
Expand All @@ -84,6 +90,12 @@ class ScriptExecutionEngine(
// the next level of stage registers
//
stageRegs.pinValues(i + 1) := stageRegs.pinValues(i)

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

}
}

Expand Down
10 changes: 8 additions & 2 deletions src/main/scala/hwdbg/types/stage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,19 @@
package hwdbg.stage

import chisel3._
import chisel3.util.log2Ceil

import hwdbg.configs._

class StageRegisters(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = DebuggerConfigurations.MAXIMUM_NUMBER_OF_STAGES
maximumNumberOfStages: Int = DebuggerConfigurations.MAXIMUM_NUMBER_OF_STAGES,
singleStageScriptSymbolSize: Int = DebuggerConfigurations.SINGLE_STAGE_SCRIPT_SYMBOL_SIZE
) extends Bundle {
val pinValues = Vec(maximumNumberOfStages, UInt(numberOfPins.W))
val pinValues = Vec(maximumNumberOfStages, UInt(numberOfPins.W)) // The value of each pin in each stage (should be passed to the next stage)
val scriptSymbol = UInt(singleStageScriptSymbolSize.W) // Interpreted script symbol for the target stage (should NOT be passed to the next stage)
val targetStage = UInt(
log2Ceil(maximumNumberOfStages).W
) // Target stage that needs to be executed for the current pin values (should be passed to the next stage)
}

0 comments on commit d7095c1

Please sign in to comment.