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
b1bb83f
commit 11de710
Showing
5 changed files
with
302 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/** @file | ||
* main.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* hwdbg's main debugger module | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-04 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg | ||
|
||
import chisel3._ | ||
import chisel3.util.Counter | ||
import circt.stage.ChiselStage | ||
|
||
import hwdbg.configs._ | ||
|
||
class DebuggerMain( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
numberOfInputPins: Int = DebuggerConfigurations.NUMBER_OF_INPUT_PINS, | ||
numberOfOutputPins: Int = DebuggerConfigurations.NUMBER_OF_OUTPUT_PINS, | ||
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH | ||
) extends Module { | ||
val io = IO(new Bundle { | ||
|
||
// | ||
// Chip signals | ||
// | ||
val en = Input(Bool()) // chip enable signal | ||
|
||
// | ||
// Input/Output signals | ||
// | ||
val inputPin = Input(Vec(numberOfInputPins, UInt((1.W)))) // input pins | ||
val outputPin = Output(Vec(numberOfOutputPins, UInt((1.W)))) // output pins | ||
|
||
// | ||
// Interrupt signals (lines) | ||
// | ||
val plInSignal = Input(Bool()) // PS to PL signal | ||
val psOutInterrupt = Output(Bool()) // PL to PS interrupt | ||
|
||
// | ||
// BRAM (Block RAM) ports | ||
// | ||
val rdAddr = Input(UInt(bramAddrWidth.W)) // read address | ||
val rdData = Output(UInt(bramDataWidth.W)) // read data | ||
val wrAddr = Input(UInt(bramAddrWidth.W)) // write address | ||
val wrEna = Input(Bool()) // enable writing | ||
val wrData = Input(UInt(bramDataWidth.W)) // write data | ||
|
||
}) | ||
|
||
io.outputPin := io.inputPin | ||
|
||
} | ||
|
||
object DebuggerMain { | ||
|
||
def apply( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
numberOfInputPins: Int = DebuggerConfigurations.NUMBER_OF_INPUT_PINS, | ||
numberOfOutputPins: Int = DebuggerConfigurations.NUMBER_OF_OUTPUT_PINS, | ||
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH | ||
)( | ||
en: Bool, | ||
inputPin: Vec[UInt], | ||
psOutInterrupt: Bool, | ||
rdAddr: UInt, | ||
wrAddr: UInt, | ||
wrEna: Bool, | ||
wrData: UInt | ||
): (Vec[UInt], Bool, UInt) = { | ||
|
||
val debuggerMainModule = Module( | ||
new DebuggerMain( | ||
debug, | ||
numberOfInputPins, | ||
numberOfOutputPins, | ||
bramAddrWidth, | ||
bramDataWidth | ||
) | ||
) | ||
|
||
val outputPin = Wire(Vec(numberOfOutputPins, UInt((1.W)))) | ||
val psOutInterrupt = Wire(Bool()) | ||
val rdData = Wire(UInt(bramDataWidth.W)) | ||
|
||
// | ||
// Configure the input signals | ||
// | ||
debuggerMainModule.io.en := en | ||
debuggerMainModule.io.inputPin := inputPin | ||
debuggerMainModule.io.rdAddr := rdAddr | ||
debuggerMainModule.io.wrAddr := wrAddr | ||
debuggerMainModule.io.wrEna := wrEna | ||
debuggerMainModule.io.wrData := wrData | ||
|
||
// | ||
// Configure the input signals | ||
// | ||
outputPin := debuggerMainModule.io.outputPin | ||
psOutInterrupt := debuggerMainModule.io.psOutInterrupt | ||
rdData := debuggerMainModule.io.rdData | ||
|
||
// | ||
// Return the output result | ||
// | ||
(outputPin, psOutInterrupt, rdData) | ||
} | ||
} |
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,101 @@ | ||
/** @file | ||
* top_test.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* hwdbg's top module (with BRAM) for testing | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-04 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
import chisel3._ | ||
import chisel3.util.Counter | ||
import circt.stage.ChiselStage | ||
|
||
import hwdbg._ | ||
import hwdbg.configs._ | ||
import hwdbg.libs.mem._ | ||
|
||
class DebuggerModuleTestingBRAM( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
numberOfInputPins: Int = DebuggerConfigurations.NUMBER_OF_INPUT_PINS, | ||
numberOfOutputPins: Int = DebuggerConfigurations.NUMBER_OF_OUTPUT_PINS, | ||
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH | ||
) extends Module { | ||
val io = IO(new Bundle { | ||
|
||
// | ||
// Chip signals | ||
// | ||
val en = Input(Bool()) // chip enable signal | ||
|
||
// | ||
// Input/Output signals | ||
// | ||
val inputPin = Input(Vec(numberOfInputPins, UInt((1.W)))) // input pins | ||
val outputPin = Output(Vec(numberOfOutputPins, UInt((1.W)))) // output pins | ||
|
||
// | ||
// Interrupt signals (lines) | ||
// | ||
val plInSignal = Input(Bool()) // PS to PL signal | ||
val psOutInterrupt = Output(Bool()) // PL to PS interrupt | ||
|
||
// | ||
// *** BRAM (Block RAM) ports are initialized from an external file *** | ||
// | ||
|
||
}) | ||
|
||
val bramEn = WireInit(false.B) | ||
val bramWrite = WireInit(false.B) | ||
val bramAddr = WireInit(0.U(bramAddrWidth.W)) | ||
val bramDataIn = WireInit(0.U(bramDataWidth.W)) | ||
|
||
// | ||
// Instantiate the BRAM memory initializer module | ||
// | ||
val dataOut = | ||
InitMemInline( | ||
debug, | ||
TestingConfigurations.BRAM_INITIALIZATION_FILE_PATH, | ||
bramAddrWidth, | ||
bramDataWidth, | ||
GeneralConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE | ||
)( | ||
bramEn, | ||
bramWrite, | ||
bramAddr, | ||
bramDataIn | ||
) | ||
|
||
// | ||
// Instantiate the debugger's main module | ||
// | ||
val (outputPin, psOutInterrupt, rdData) = | ||
DebuggerMain( | ||
debug, | ||
numberOfInputPins, | ||
numberOfOutputPins, | ||
bramAddrWidth, | ||
bramDataWidth | ||
)( | ||
io.en, | ||
io.inputPin, | ||
io.plInSignal, | ||
bramAddr, | ||
bramAddr, | ||
bramEn, | ||
dataOut | ||
) | ||
|
||
io.outputPin := outputPin | ||
io.psOutInterrupt := psOutInterrupt | ||
bramDataIn := rdData | ||
|
||
} |