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

Commit

Permalink
add versioning info
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed May 1, 2024
1 parent 99e28a1 commit 04b5c86
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 3 deletions.
45 changes: 42 additions & 3 deletions src/main/scala/hwdbg/communication/interpreter/interpreter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ class DebuggerPacketInterpreter(
val beginSendingBuffer = WireInit(false.B)
val noNewDataSender = WireInit(false.B)
val dataValidOutput = WireInit(false.B)
val requestedActionOfThePacketOutput = WireInit(0.U(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))
val sendingData = WireInit(0.U(bramDataWidth.W))

val regRequestedActionOfThePacketOutput = RegInit(0.U(new DebuggerRemotePacket().RequestedActionOfThePacket.getWidth.W))

//
// Apply the chip enable signal
//
Expand Down Expand Up @@ -121,8 +122,46 @@ class DebuggerPacketInterpreter(
when(inputAction === HwdbgActionEnums.hwdbgActionSendVersion.id.U) {

//
// Send version
// *** Send version ***
//

//
// Set the packet type
//
regRequestedActionOfThePacketOutput := 9999.U

//
// Start sending the buffer
//
beginSendingBuffer := true.B

//
// Wait until
//
when(io.sendWaitForBuffer === true.B) {

//
// The sender is ready to send next buffer
//
sendingData := 1.U

//
// Data is valid to send
//
dataValidOutput := true.B

//
// Sending is finished at the next cycle
//
state := sDone

}.otherwise {

//
// Stay at the same state
//
state := sNewActionReceived
}

}.elsewhen(inputAction === HwdbgActionEnums.hwdbgActionSendPinInformation.id.U) {

Expand Down Expand Up @@ -170,7 +209,7 @@ class DebuggerPacketInterpreter(
io.beginSendingBuffer := beginSendingBuffer
io.noNewDataSender := noNewDataSender
io.dataValidOutput := dataValidOutput
io.requestedActionOfThePacketOutput := requestedActionOfThePacketOutput
io.requestedActionOfThePacketOutput := regRequestedActionOfThePacketOutput
io.sendingData := sendingData

}
Expand Down
51 changes: 51 additions & 0 deletions src/main/scala/hwdbg/configs/version.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @file
* version.scala
* @author
* Sina Karvandi ([email protected])
* @brief
* Versioning details
* @details
* @version 0.1
* @date
* 2024-05-01
*
* @copyright
* This project is released under the GNU Public License v3.
*/
package hwdbg.version

import chisel3._
import chisel3.util._

/**
* @brief
* Version of hwdbg
* @warning
* will be checked with HyperDbg
*/
object Version {

//
// Constant version info
//
val VERSION_MAJOR: Int = 0
val VERSION_MINOR: Int = 1
val VERSION_PATCH: Int = 0

def getEncodedVersion: Int = {
(VERSION_MAJOR << 16) | (VERSION_MINOR << 8) | VERSION_PATCH
}

def extractMajor(encodedVersion: Int): Int = {
encodedVersion >> 16
}

def extractMinor(encodedVersion: Int): Int = {
(encodedVersion >> 8) & 0xff // Masking to get only the 8 bits
}

def extractPatch(encodedVersion: Int): Int = {
encodedVersion & 0xff // Masking to get only the 8 bits
}
}
13 changes: 13 additions & 0 deletions src/main/scala/hwdbg/main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ package hwdbg
import chisel3._
import circt.stage.ChiselStage

import hwdbg.version._
import hwdbg.configs._
import hwdbg.types._
import hwdbg.utils._
import hwdbg.communication._
import hwdbg.communication.interpreter._

Expand Down Expand Up @@ -78,6 +80,17 @@ class DebuggerMain(

})

//
// Printing the versioning info
//
val encodedVersion = Version.getEncodedVersion
LogInfo(true)("=======================================================================")
LogInfo(true)(s"Generating code for hwdbg v${Version.extractMajor(encodedVersion)}.${Version.extractMinor(encodedVersion)}.${Version
.extractPatch(encodedVersion)} ($encodedVersion)")
LogInfo(true)("Please visit https://hwdbg.hyperdbg.org/docs for more information...")
LogInfo(true)("hwdbg is released under the GNU Public License v3 (GPLv3).")
LogInfo(true)("=======================================================================")

//
// Wire signals for the synchronizer
//
Expand Down

0 comments on commit 04b5c86

Please sign in to comment.