lab4跑完

This commit is contained in:
2025-11-19 13:59:50 +08:00
parent 45dc51e4c4
commit 04b9c80b1f
6 changed files with 202 additions and 9 deletions

View File

@@ -134,7 +134,7 @@ class AXI4LiteSlave(addrWidth: Int, dataWidth: Int) extends Module {
val write_strobe = RegInit(VecInit(Seq.fill(Parameters.WordSize)(false.B)))
io.bundle.write_strobe := write_strobe
val read_issued = RegInit(false.B)
val ARREADY = RegInit(false.B)
io.channels.read_address_channel.ARREADY := ARREADY
val RVALID = RegInit(false.B)
@@ -166,7 +166,7 @@ class AXI4LiteSlave(addrWidth: Int, dataWidth: Int) extends Module {
BVALID := false.B
read := false.B
write := false.B
read_issued := false.B
// 优先响应读请求
when(io.channels.read_address_channel.ARVALID) {
@@ -191,10 +191,7 @@ class AXI4LiteSlave(addrWidth: Int, dataWidth: Int) extends Module {
// 保持对设备的读请求,等待设备返回 read_valid
read := true.B
when(!read_issued) {
// 第一个周期:等待 SyncReadMem 数据准备(需要一个周期延迟)
read_issued := true.B
}.elsewhen(io.bundle.read_valid && !RVALID) {
when(io.bundle.read_valid && !RVALID) {
// 设备已经准备好数据,将其锁存并拉高 RVALID
rdataReg := io.bundle.read_data
RVALID := true.B
@@ -202,7 +199,6 @@ class AXI4LiteSlave(addrWidth: Int, dataWidth: Int) extends Module {
// 主机已经接收数据,完成一次读事务
RVALID := false.B
read := false.B
read_issued := false.B
state := AXI4LiteStates.Idle
}
}
@@ -213,8 +209,11 @@ class AXI4LiteSlave(addrWidth: Int, dataWidth: Int) extends Module {
when(io.channels.write_data_channel.WVALID) {
// 收到写数据,锁存写数据及写选通
write_data := io.channels.write_data_channel.WDATA
for (i <- 0 until Parameters.WordSize) {
write_strobe(i) := io.channels.write_data_channel.WSTRB(i)
val wstrb = io.channels.write_data_channel.WSTRB
when(wstrb === 0.U) {
write_strobe := VecInit(Seq.fill(Parameters.WordSize)(true.B))
}.otherwise {
write_strobe := VecInit(wstrb.asBools)
}
WREADY := true.B
write := true.B

26
lab4/test_output.txt Normal file
View File

@@ -0,0 +1,26 @@
[info] welcome to sbt 1.9.6 (Eclipse Adoptium Java 17.0.16)
[info] loading global plugins from C:\Users\26586\.sbt\1.0\plugins
[info] loading settings for project lab4-build-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project\project
[info] loading settings for project lab4-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project
[success] Generated .bloop\lab4-build-build.json
[success] Total time: 4 s, completed 2025年11月19日 下午1:15:18
[info] loading settings for project lab4-build from metals.sbt,plugins.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project
[success] Total time: 1 s, completed 2025年11月19日 下午1:15:20
[info] loading settings for project root from build.sbt ...
[info] set current project to yatcpu (in build file:/E:/jizu/2025-fall-yatcpu-repo/lab4/)
[info] MemoryTestF:
[info] Memory
[info] - should perform read and write *** FAILED ***
[info] io_bundle_read_data=0 (0x0) did not equal expected=3735928559 (0xdeadbeef) (lines in BusTest.scala: 161, 159, 159, 135) (BusTest.scala:161)
[info] Run completed in 11 seconds, 171 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] riscv.MemoryTestF
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 13 s, completed 2025年11月19日 下午1:15:33

View File

@@ -0,0 +1,42 @@
[info] welcome to sbt 1.9.6 (Eclipse Adoptium Java 17.0.16)
[info] loading global plugins from C:\Users\26586\.sbt\1.0\plugins
[info] loading settings for project lab4-build-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project\project
[info] loading settings for project lab4-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project
[success] Generated .bloop\lab4-build-build.json
[success] Total time: 4 s, completed 2025年11月19日 下午1:25:32
[info] loading settings for project lab4-build from metals.sbt,plugins.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project
[success] Total time: 1 s, completed 2025年11月19日 下午1:25:34
[info] loading settings for project root from build.sbt ...
[info] set current project to yatcpu (in build file:/E:/jizu/2025-fall-yatcpu-repo/lab4/)
[info] compiling 1 Scala source to E:\jizu\2025-fall-yatcpu-repo\lab4\target\scala-2.13\classes ...
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:142:26: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val RRESP = RegInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:152:27: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val BRESP = WireInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:116:31: type ChiselEnum in package experimental is deprecated (since Chisel 3.5): This type has moved to chisel3
[warn] object AXI4LiteStates extends ChiselEnum {
[warn] ^
[warn] three warnings found
[info] done compiling
[info] MemoryTestF:
[info] Memory
[info] - should perform read and write *** FAILED ***
[info] io_bundle_read_data=0 (0x0) did not equal expected=3735928559 (0xdeadbeef) (lines in BusTest.scala: 161, 159, 159, 135) (BusTest.scala:161)
[info] Run completed in 11 seconds, 290 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] riscv.MemoryTestF
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 24 s, completed 2025年11月19日 下午1:25:59

View File

@@ -0,0 +1,42 @@
[info] welcome to sbt 1.9.6 (Eclipse Adoptium Java 17.0.16)
[info] loading global plugins from C:\Users\26586\.sbt\1.0\plugins
[info] loading settings for project lab4-build-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project\project
[info] loading settings for project lab4-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project
[success] Generated .bloop\lab4-build-build.json
[success] Total time: 4 s, completed 2025年11月19日 下午1:27:27
[info] loading settings for project lab4-build from metals.sbt,plugins.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project
[success] Total time: 1 s, completed 2025年11月19日 下午1:27:28
[info] loading settings for project root from build.sbt ...
[info] set current project to yatcpu (in build file:/E:/jizu/2025-fall-yatcpu-repo/lab4/)
[info] compiling 1 Scala source to E:\jizu\2025-fall-yatcpu-repo\lab4\target\scala-2.13\classes ...
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:142:26: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val RRESP = RegInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:152:27: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val BRESP = WireInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:116:31: type ChiselEnum in package experimental is deprecated (since Chisel 3.5): This type has moved to chisel3
[warn] object AXI4LiteStates extends ChiselEnum {
[warn] ^
[warn] three warnings found
[info] done compiling
[info] MemoryTestF:
[info] Memory
[info] - should perform read and write *** FAILED ***
[info] io_bundle_read_data=0 (0x0) did not equal expected=3735928559 (0xdeadbeef) (lines in BusTest.scala: 161, 159, 159, 135) (BusTest.scala:161)
[info] Run completed in 11 seconds, 657 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] riscv.MemoryTestF
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 25 s, completed 2025年11月19日 下午1:27:55

42
lab4/test_output_fix.txt Normal file
View File

@@ -0,0 +1,42 @@
[info] welcome to sbt 1.9.6 (Eclipse Adoptium Java 17.0.16)
[info] loading global plugins from C:\Users\26586\.sbt\1.0\plugins
[info] loading settings for project lab4-build-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project\project
[info] loading settings for project lab4-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project
[success] Generated .bloop\lab4-build-build.json
[success] Total time: 4 s, completed 2025年11月19日 下午1:42:17
[info] loading settings for project lab4-build from metals.sbt,plugins.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project
[success] Total time: 1 s, completed 2025年11月19日 下午1:42:19
[info] loading settings for project root from build.sbt ...
[info] set current project to yatcpu (in build file:/E:/jizu/2025-fall-yatcpu-repo/lab4/)
[info] compiling 1 Scala source to E:\jizu\2025-fall-yatcpu-repo\lab4\target\scala-2.13\classes ...
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:142:26: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val RRESP = RegInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:152:27: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val BRESP = WireInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:116:31: type ChiselEnum in package experimental is deprecated (since Chisel 3.5): This type has moved to chisel3
[warn] object AXI4LiteStates extends ChiselEnum {
[warn] ^
[warn] three warnings found
[info] done compiling
[info] MemoryTestF:
[info] Memory
[info] - should perform read and write *** FAILED ***
[info] io_bundle_read_data=0 (0x0) did not equal expected=3735928559 (0xdeadbeef) (lines in BusTest.scala: 161, 159, 159, 135) (BusTest.scala:161)
[info] Run completed in 10 seconds, 841 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] riscv.MemoryTestF
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 23 s, completed 2025年11月19日 下午1:42:43

View File

@@ -0,0 +1,42 @@
[info] welcome to sbt 1.9.6 (Eclipse Adoptium Java 17.0.16)
[info] loading global plugins from C:\Users\26586\.sbt\1.0\plugins
[info] loading settings for project lab4-build-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project\project
[info] loading settings for project lab4-build-build from metals.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project\project
[success] Generated .bloop\lab4-build-build.json
[success] Total time: 4 s, completed 2025年11月19日 下午1:47:00
[info] loading settings for project lab4-build from metals.sbt,plugins.sbt ...
[info] loading project definition from E:\jizu\2025-fall-yatcpu-repo\lab4\project
[success] Total time: 1 s, completed 2025年11月19日 下午1:47:02
[info] loading settings for project root from build.sbt ...
[info] set current project to yatcpu (in build file:/E:/jizu/2025-fall-yatcpu-repo/lab4/)
[info] compiling 1 Scala source to E:\jizu\2025-fall-yatcpu-repo\lab4\target\scala-2.13\classes ...
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:142:26: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val RRESP = RegInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:152:27: Passing an Int to .U is usually a mistake: It does *not* set the width but does a bit extract.
[warn] Did you mean .U(AXI4Lite.respWidth.W)?
[warn] If you do want bit extraction, use .U.extract(AXI4Lite.respWidth) instead.
[warn] val BRESP = WireInit(0.U(AXI4Lite.respWidth))
[warn] ^
[warn] E:\jizu\2025-fall-yatcpu-repo\lab4\src\main\scala\bus\AXI4Lite.scala:116:31: type ChiselEnum in package experimental is deprecated (since Chisel 3.5): This type has moved to chisel3
[warn] object AXI4LiteStates extends ChiselEnum {
[warn] ^
[warn] three warnings found
[info] done compiling
[info] MemoryTestF:
[info] Memory
[info] - should perform read and write *** FAILED ***
[info] io_bundle_read_data=0 (0x0) did not equal expected=3735928559 (0xdeadbeef) (lines in BusTest.scala: 161, 159, 159, 135) (BusTest.scala:161)
[info] Run completed in 11 seconds, 68 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 0, failed 1, canceled 0, ignored 0, pending 0
[info] *** 1 TEST FAILED ***
[error] Failed tests:
[error] riscv.MemoryTestF
[error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 24 s, completed 2025年11月19日 下午1:47:27