From 8713ee0532cd1ff0e06737763712c5dd0cfd2dcb Mon Sep 17 00:00:00 2001 From: bacon Date: Fri, 7 Feb 2025 12:58:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=9A=E4=B8=8D=E6=98=8E=E5=8E=9F=E5=9B=A0?= =?UTF-8?q?=E7=9A=84=E9=80=A0=E6=88=90=E4=BA=86cpu=E7=9A=84CoreID=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E9=94=99=E4=B9=B1=EF=BC=8C=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E4=BA=86=E6=97=A5=E5=BF=97=E6=96=87=E4=BB=B6=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E5=88=86=E7=A6=BB=EF=BC=9B=E7=AE=80=E5=8D=95?= =?UTF-8?q?=E7=B2=97=E6=9A=B4=E5=9C=B0=E5=88=A0=E9=99=A4=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E4=B8=8D=E6=83=B3=E8=A6=81=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=EF=BC=8C=E7=94=A8=E4=BB=A5=E8=A7=A3=E5=86=B3?= =?UTF-8?q?CoreID=E7=9A=84=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 4 +++- rocket-chip | 2 +- tb/sw/src/mstSvr.S | 17 ++++++----------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 6c44975..85177f1 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ compile: mkdir -p ./generated/Rtpp cd ./rocket-chip/ && rm -f rocketchip.jar cd ./rocket-chip/vsim && make verilog CONFIG=freechips.rocketchip.system.RtppConfig - cp ./rocket-chip/vsim/generated-src/freechips.rocketchip.system.RtppConfig.v ./generated/Rtpp/RtppConfig.v + sed -e "s/CoreID = _RAND/\/\/CoreID = _RAND/g" ./rocket-chip/vsim/generated-src/freechips.rocketchip.system.RtppConfig.v > ./generated/Rtpp/RtppConfig.v +# cp ./rocket-chip/vsim/generated-src/freechips.rocketchip.system.RtppConfig.v ./generated/Rtpp/RtppConfig.v cp ./rocket-chip/vsim/generated-src/freechips.rocketchip.system.RtppConfig.behav_srams.v ./generated/Rtpp/behav_srams.v # sbt "test:runMain test.testModule" @@ -54,6 +55,7 @@ VSimTop: +define+RANDOMIZE_INVALID_ASSIGN \ +define+RANDOMIZE_REG_INIT \ +define+RANDOMIZE_DELAY=0 \ + +define+VERILATOR \ --exe --build \ ${PWD}/tb/verilator/sim_main.cpp \ -Mdir ./tb/build/ \ diff --git a/rocket-chip b/rocket-chip index 4543a40..917ac65 160000 --- a/rocket-chip +++ b/rocket-chip @@ -1 +1 @@ -Subproject commit 4543a408ca691a3ba277d0c3a01611f3ceb92957 +Subproject commit 917ac659f02a9a0c9bfe736e7fa965d7692664cb diff --git a/tb/sw/src/mstSvr.S b/tb/sw/src/mstSvr.S index e40276e..d033f60 100644 --- a/tb/sw/src/mstSvr.S +++ b/tb/sw/src/mstSvr.S @@ -42,12 +42,6 @@ _prog_start: .balign 32 _rv32i_plic_handle: -#if 0 /*RV32的核心自动禁用中断,无需手动禁用*/ - csrr x16, mstatus # 读取 mstatus 寄存器 - andi x16, x16, ~(1 << 3) # 清除 MIE 位 (全局中断禁用) - csrw mstatus, x16 # 写回 mstatus 寄存器 -#endif - lw x23, 0(x17) # x23 = *plic_claim sw x23, 0(x17) # *plic_claim = x23 @@ -75,6 +69,9 @@ _rv32i_plic_handle: bne x23, x24, 4f #_if (x23 != x24) goto 4f sw x25, 0(x21) #_else #else + + + bne x23, x28, 1f #_if (x23 != x24) goto 1f sw x25, 0(x18) #_else j 4f @@ -92,11 +89,9 @@ _rv32i_plic_handle: 3: bne x23, x31, 4f #_if (x23 != x24) goto 4f sw x25, 0(x21) #_else + + #endif + 4: -#if 0 /*RV32的核心自动启动中断,无需手动启用*/ - csrr x16, mstatus - ori x16, x16, 1<<3 - csrw mstatus, x16 -#endif mret