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
32ab8b2
commit 5601046
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
103 changes: 103 additions & 0 deletions
103
src/main/scala/hwdbg/communication/send_receive_synchronizer.scala
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,103 @@ | ||
/** | ||
* @file | ||
* send_receive_synchronizer.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* Send and receive synchronizer module | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-17 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg.communication | ||
|
||
import chisel3._ | ||
import circt.stage.ChiselStage | ||
|
||
import hwdbg.configs._ | ||
|
||
class SendReceiveSynchronizer( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
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 | ||
|
||
// | ||
// Interrupt signals (lines) | ||
// | ||
val plInSignal = Input(Bool()) // PS to PL signal | ||
val psOutInterrupt = Output(Bool()) // PL to PS interrupt | ||
|
||
// | ||
// BRAM (Block RAM) ports | ||
// | ||
val rdWrAddr = Output(UInt(bramAddrWidth.W)) // read/write address | ||
val rdData = Input(UInt(bramDataWidth.W)) // read data | ||
val wrEna = Output(Bool()) // enable writing | ||
val wrData = Output(UInt(bramDataWidth.W)) // write data | ||
|
||
}) | ||
|
||
// | ||
// To be implemented | ||
// | ||
|
||
} | ||
|
||
object SendReceiveSynchronizer { | ||
|
||
def apply( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
bramAddrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
bramDataWidth: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH | ||
)( | ||
en: Bool, | ||
plInSignal: Bool, | ||
rdData: UInt | ||
): (Bool, UInt, Bool, UInt) = { | ||
|
||
val sendReceiveSynchronizerModule = Module( | ||
new SendReceiveSynchronizer( | ||
debug, | ||
bramAddrWidth, | ||
bramDataWidth | ||
) | ||
) | ||
|
||
val psOutInterrupt = Wire(Bool()) | ||
val rdWrAddr = Wire(UInt(bramAddrWidth.W)) | ||
val wrEna = Wire(Bool()) | ||
val wrData = Wire(UInt(bramDataWidth.W)) | ||
|
||
// | ||
// Configure the input signals | ||
// | ||
debuggerMainModule.io.en := en | ||
debuggerMainModule.io.plInSignal := plInSignal | ||
debuggerMainModule.io.rdData := rdData | ||
|
||
// | ||
// Configure the output signals | ||
// | ||
psOutInterrupt := debuggerMainModule.io.psOutInterrupt | ||
rdWrAddr := debuggerMainModule.io.rdWrAddr | ||
wrEna := debuggerMainModule.io.wrEna | ||
wrData := debuggerMainModule.io.wrData | ||
|
||
// | ||
// Return the output result | ||
// | ||
(psOutInterrupt, rdWrAddr, wrEna, wrData) | ||
} | ||
} |