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

Commit

Permalink
add debugger input and output pins
Browse files Browse the repository at this point in the history
  • Loading branch information
SinaKarvandi committed Apr 3, 2024
1 parent 0cc7d6d commit f980052
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 9 deletions.
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ project/plugins/project/
hs_err_pid*

# Visual Studio Code
#.vscode/*
#!.vscode/settings.json
#!.vscode/tasks.json
#!.vscode/launch.json
#!.vscode/extensions.json
#!.vscode/*.code-snippets
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/
Expand All @@ -360,4 +360,4 @@ hs_err_pid*
.bloop/

# Temporary disable the generated verilog files
#generated/
generated/
22 changes: 22 additions & 0 deletions src/main/scala/hwdbg/configs/configs.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package hwdbg.configs

import chisel3._
import chisel3.util._


/** @brief
* The constants for min-max tree
*/
object DebuggerConfigurations {

val ENABLE_DEBUG: Boolean = false // whether to enable debug or not

val NUMBER_OF_INPUT_PINS: Int = 16 // Number of input pins

val NUMBER_OF_OUTPUT_PINS: Int = 16 // Number of output pins

val BLOCK_RAM_ADDR_WIDTH: Int = 13 // Address width of the Block RAM (BRAM)

val BLOCK_RAM_DATA_WIDTH: Int = 32 // Data width of the Block RAM (BRAM)

}
39 changes: 37 additions & 2 deletions src/main/scala/top.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,45 @@ import chisel3._
import chisel3.util.Counter
import circt.stage.ChiselStage

class Blinky(freq: Int, startOn: Boolean = false) extends Module {
import hwdbg.configs._

class DebuggerModule(
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 {
val led0 = Output(Bool())

//
// 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))
val rdData = Output(UInt(bramDataWidth.W))
val wrAddr = Input(UInt(bramAddrWidth.W))
val wrEna = Input(Bool())
val wrData = Input(UInt(bramDataWidth.W))

})

// Blink LED every second using Chisel built-in util.Counter
val led = RegInit(startOn.B)
val (_, counterWrap) = Counter(true.B, freq / 2)
Expand Down

0 comments on commit f980052

Please sign in to comment.