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

Commit

Permalink
pass multiple operators to the eval engine
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed May 28, 2024
1 parent bbd87ce commit e42452c
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 43 deletions.
38 changes: 0 additions & 38 deletions src/main/scala/hwdbg/globals/global_stages.scala

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/scala/hwdbg/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DebuggerMain(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand Down Expand Up @@ -100,6 +101,7 @@ class DebuggerMain(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
bramAddrWidth,
bramDataWidth,
portsConfiguration
Expand Down Expand Up @@ -192,6 +194,7 @@ object DebuggerMain {
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand All @@ -207,6 +210,7 @@ object DebuggerMain {
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
bramAddrWidth,
bramDataWidth,
portsConfiguration
Expand Down
11 changes: 7 additions & 4 deletions src/main/scala/hwdbg/script/eval.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ScriptEngineEval(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
) extends Module {

Expand All @@ -51,7 +52,7 @@ class ScriptEngineEval(
//
// Evaluation operator symbol
//
val operator = Input(new SYMBOL)
val operator = Input(Vec(maximumNumberOfSupportedScriptOperators, new SYMBOL))

val currentStage = Input(UInt(log2Ceil(maximumNumberOfStages).W))
val nextStage = Output(UInt(log2Ceil(maximumNumberOfStages).W))
Expand All @@ -73,7 +74,7 @@ class ScriptEngineEval(
// Assign operator value (split the signal into only usable part)
//
LogInfo(debug)("Usable size of Value in the SYMBOL: " + ScriptOperators().getWidth)
val operatorValue = io.operator.Value(ScriptOperators().getWidth - 1, 0).asTypeOf(ScriptOperators())
val mainOperatorValue = io.operator(0).Value(ScriptOperators().getWidth - 1, 0).asTypeOf(ScriptOperators())

//
// *** Implementing the evaluation engine ***
Expand All @@ -84,7 +85,7 @@ class ScriptEngineEval(
//
when(io.en === true.B) {

switch(operatorValue) {
switch(mainOperatorValue) {

is(sFuncInc) {
nextStage := io.currentStage + 1.U
Expand Down Expand Up @@ -117,10 +118,11 @@ object ScriptEngineEval {
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
)(
en: Bool,
operator: SYMBOL,
operator: Vec[SYMBOL],
currentStage: UInt,
inputPin: Vec[UInt]
): (UInt, Vec[UInt]) = {
Expand All @@ -130,6 +132,7 @@ object ScriptEngineEval {
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
portsConfiguration
)
)
Expand Down
15 changes: 14 additions & 1 deletion src/main/scala/hwdbg/script/exec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ScriptExecutionEngine(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand Down Expand Up @@ -92,6 +93,15 @@ class ScriptExecutionEngine(
// *** Based on target stage, this stage needs evaluation ***
//

//
// Create a Vec containing script symbol elements
//
val scriptSymbols = Wire(Vec(maximumNumberOfSupportedScriptOperators, new SYMBOL))

for (j <- 0 until maximumNumberOfSupportedScriptOperators) {
scriptSymbols(j) := stageRegs(i + j).scriptSymbol
}

//
// Instantiate an eval engine for this stage
//
Expand All @@ -102,10 +112,11 @@ class ScriptExecutionEngine(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
portsConfiguration
)(
io.en,
stageRegs(i).scriptSymbol,
scriptSymbols,
stageRegs(i).targetStage,
stageRegs(i).pinValues
)
Expand Down Expand Up @@ -152,6 +163,7 @@ object ScriptExecutionEngine {
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand All @@ -165,6 +177,7 @@ object ScriptExecutionEngine {
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
bramAddrWidth,
bramDataWidth,
portsConfiguration
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class DebuggerModule(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand Down Expand Up @@ -66,6 +67,7 @@ class DebuggerModule(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
bramAddrWidth,
bramDataWidth,
portsConfiguration
Expand Down Expand Up @@ -95,6 +97,7 @@ object Main extends App {
DebuggerConfigurations.ENABLE_DEBUG,
DebuggerConfigurations.NUMBER_OF_PINS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
DebuggerPorts.PORT_PINS_MAP
Expand Down
3 changes: 3 additions & 0 deletions src/main/scala/top_test.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class DebuggerModuleTestingBRAM(
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG,
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS,
maximumNumberOfStages: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
maximumNumberOfSupportedScriptOperators: Int = ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP
Expand Down Expand Up @@ -90,6 +91,7 @@ class DebuggerModuleTestingBRAM(
debug,
numberOfPins,
maximumNumberOfStages,
maximumNumberOfSupportedScriptOperators,
bramAddrWidth,
bramDataWidth,
portsConfiguration
Expand Down Expand Up @@ -127,6 +129,7 @@ object MainWithInitializedBRAM extends App {
DebuggerConfigurations.ENABLE_DEBUG,
DebuggerConfigurations.NUMBER_OF_PINS,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_STAGES,
ScriptEngineConfigurations.MAXIMUM_NUMBER_OF_SUPPORTED_OPERATORS,
DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH,
DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH,
DebuggerPorts.PORT_PINS_MAP
Expand Down

0 comments on commit e42452c

Please sign in to comment.