From f81ea2c5f82c1eaa7bd9aff239ac8397cf994d2d Mon Sep 17 00:00:00 2001 From: 5265325 <541959102@qq.com> Date: Wed, 1 Sep 2021 11:59:19 +0000 Subject: [PATCH] Fix a bug about repeated writing --- projects/cpu_axi_diff/vsrc/cpu.v | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/cpu_axi_diff/vsrc/cpu.v b/projects/cpu_axi_diff/vsrc/cpu.v index c3b4f76..2204820 100755 --- a/projects/cpu_axi_diff/vsrc/cpu.v +++ b/projects/cpu_axi_diff/vsrc/cpu.v @@ -94,12 +94,15 @@ exe_stage Exe_stage( .rd_data (rd_data) ); + +wire w_ena = rd_w_ena & fetched; + regfile Regfile( .clk (clock), .rst (reset), .w_addr (rd_w_addr), .w_data (rd_data), - .w_ena (rd_w_ena), + .w_ena (w_ena), .r_addr1 (rs1_r_addr), .r_data1 (r_data1),