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

Commit

Permalink
add send receive synchronizer
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed Apr 17, 2024
1 parent 32ab8b2 commit 5601046
Showing 1 changed file with 103 additions and 0 deletions.
103 changes: 103 additions & 0 deletions src/main/scala/hwdbg/communication/send_receive_synchronizer.scala
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)
}
}

0 comments on commit 5601046

Please sign in to comment.