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
27df52b
commit 0d6d727
Showing
8 changed files
with
76 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
version = "3.5.9" | ||
version = "3.8.1" | ||
runner.dialect = scala213 |
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
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 |
---|---|---|
@@ -1,9 +1,22 @@ | ||
/** @file | ||
* configs.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* Configuration files | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-03 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg.configs | ||
|
||
import chisel3._ | ||
import chisel3.util._ | ||
|
||
|
||
/** @brief | ||
* The constants for min-max tree | ||
*/ | ||
|
@@ -45,4 +58,4 @@ object GeneralConfigurations { | |
// Default number of bytes used in initialized SRAM memory | ||
// | ||
val DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE: Int = 8192 // 8 KB | ||
} | ||
} |
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 |
---|---|---|
@@ -1,15 +1,32 @@ | ||
/** @file | ||
* init_mem.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* Initialize SRAM memory from a file | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-03 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg.libs.mem | ||
|
||
import chisel3._ | ||
import chisel3.util.experimental.loadMemoryFromFileInline | ||
|
||
import hwdbg.configs._ | ||
|
||
class InitMemInline( | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
memoryFile: String = "", | ||
addrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
width: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH, | ||
size: Int = GeneralConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE | ||
) extends Module { | ||
debug: Boolean = DebuggerConfigurations.ENABLE_DEBUG, | ||
memoryFile: String = "", | ||
addrWidth: Int = DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
width: Int = DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH, | ||
size: Int = | ||
GeneralConfigurations.DEFAULT_CONFIGURATION_INITIALIZED_MEMORY_SIZE | ||
) extends Module { | ||
|
||
val io = IO(new Bundle { | ||
val enable = Input(Bool()) | ||
|
@@ -19,7 +36,7 @@ class InitMemInline( | |
val dataOut = Output(UInt(width.W)) | ||
}) | ||
|
||
val mem = SyncReadMem(size / width, UInt(width.W)) | ||
val mem = SyncReadMem(size / width, UInt(width.W)) | ||
|
||
// | ||
// Initialize memory | ||
|
@@ -32,7 +49,7 @@ class InitMemInline( | |
|
||
when(io.enable) { | ||
val rdwrPort = mem(io.addr) | ||
when (io.write) { rdwrPort := io.dataIn } | ||
.otherwise { io.dataOut := rdwrPort } | ||
when(io.write) { rdwrPort := io.dataIn } | ||
.otherwise { io.dataOut := rdwrPort } | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
/** @file | ||
* top.scala | ||
* @author | ||
* Sina Karvandi ([email protected]) | ||
* @brief | ||
* hwdbg's top module | ||
* @details | ||
* @version 0.1 | ||
* @date | ||
* 2024-04-03 | ||
* | ||
* @copyright | ||
* This project is released under the GNU Public License v3. | ||
*/ | ||
package hwdbg | ||
|
||
import chisel3._ | ||
|
@@ -28,7 +42,7 @@ class DebuggerModule( | |
|
||
// | ||
// Interrupt signals (lines) | ||
// | ||
// | ||
val plInSignal = Input(Bool()) // PS to PL signal | ||
val psOutInterrupt = Output(Bool()) // PL to PS interrupt | ||
|
||
|
@@ -38,12 +52,11 @@ class DebuggerModule( | |
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 wrEna = Input(Bool()) // enable writing | ||
val wrData = Input(UInt(bramDataWidth.W)) // write data | ||
|
||
}) | ||
|
||
|
||
} | ||
|
||
object Main extends App { | ||
|
@@ -54,18 +67,18 @@ object Main extends App { | |
println( | ||
ChiselStage.emitSystemVerilog( | ||
new DebuggerModule( | ||
DebuggerConfigurations.ENABLE_DEBUG, | ||
DebuggerConfigurations.ENABLE_DEBUG, | ||
DebuggerConfigurations.NUMBER_OF_INPUT_PINS, | ||
DebuggerConfigurations.NUMBER_OF_OUTPUT_PINS, | ||
DebuggerConfigurations.BLOCK_RAM_ADDR_WIDTH, | ||
DebuggerConfigurations.BLOCK_RAM_DATA_WIDTH | ||
), | ||
firtoolOpts = Array( | ||
"-disable-all-randomization", | ||
"-strip-debug-info", | ||
"--split-verilog", // The intention for this argument (and next argument) is to separate generated files. | ||
"-o", | ||
"generated/", | ||
"-disable-all-randomization", | ||
"-strip-debug-info", | ||
"--split-verilog", // The intention for this argument (and next argument) is to separate generated files. | ||
"-o", | ||
"generated/" | ||
) | ||
) | ||
) | ||
|