This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7095c1
commit 59c8bb6
Showing
9 changed files
with
204 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* @file | ||
* eval.scala | ||
* @author | ||
* Sina Karvandi (sina@hyperdbg.org) | ||
* @brief | ||
* Script execution engine | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-05-17 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg.script | ||
|
||
import chisel3._ | ||
import chisel3.util._ | ||
|
||
import hwdbg.configs._ | ||
import hwdbg.stage._ | ||
|
||
class ScriptEngineEval( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS, | ||
maximumNumberOfStages: Int = DebuggerConfigurations.MAXIMUM_NUMBER_OF_STAGES, | ||
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP | ||
) extends Module { | ||
|
||
val io = IO(new Bundle { | ||
|
||
// | ||
// Chip signals | ||
// | ||
val en = Input(Bool()) // chip enable signal | ||
|
||
// | ||
// Evaluation symbol | ||
// | ||
val symbol = Input(new SYMBOL) | ||
val nextStage = Output(UInt(log2Ceil(maximumNumberOfStages).W)) | ||
|
||
// | ||
// Input/Output signals | ||
// | ||
val inputPin = Input(Vec(numberOfPins, UInt(1.W))) // input pins | ||
val outputPin = Output(Vec(numberOfPins, UInt(1.W))) // output pins | ||
}) | ||
|
||
// | ||
// Output pins | ||
// | ||
// val outputPin = Wire(Vec(numberOfPins, UInt(1.W))) | ||
// val nextStage = Wire(UInt(log2Ceil(maximumNumberOfStages).W)) | ||
|
||
// | ||
// Connect the output signals | ||
// | ||
// io.nextStage := nextStage | ||
// io.outputPin := outputPin | ||
io.nextStage := 0.U | ||
io.outputPin := io.inputPin | ||
|
||
} | ||
|
||
object ScriptEngineEval { | ||
|
||
def apply( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
numberOfPins: Int = DebuggerConfigurations.NUMBER_OF_PINS, | ||
maximumNumberOfStages: Int = DebuggerConfigurations.MAXIMUM_NUMBER_OF_STAGES, | ||
portsConfiguration: Map[Int, Int] = DebuggerPorts.PORT_PINS_MAP | ||
)( | ||
en: Bool, | ||
symbol: SYMBOL, | ||
inputPin: Vec[UInt] | ||
): (UInt, Vec[UInt]) = { | ||
|
||
val scriptEngineEvalModule = Module( | ||
new ScriptEngineEval( | ||
debug, | ||
numberOfPins, | ||
maximumNumberOfStages, | ||
portsConfiguration | ||
) | ||
) | ||
|
||
val outputPin = Wire(Vec(numberOfPins, UInt(1.W))) | ||
val nextStage = Wire(UInt(log2Ceil(maximumNumberOfStages).W)) | ||
|
||
// | ||
// Configure the input signals | ||
// | ||
scriptEngineEvalModule.io.en := en | ||
scriptEngineEvalModule.io.symbol := symbol | ||
scriptEngineEvalModule.io.inputPin := inputPin | ||
|
||
// | ||
// Configure the output signals | ||
// | ||
nextStage := scriptEngineEvalModule.io.nextStage | ||
outputPin := scriptEngineEvalModule.io.outputPin | ||
|
||
// | ||
// Return the output result | ||
// | ||
(nextStage, outputPin) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters