Commit ae46be8b authored by jinbao chen's avatar jinbao chen
Browse files

fix bugs

parent c77e650b
......@@ -67,7 +67,9 @@ module EXSegReg(
input wire [11:0] CSRRdD,
output reg [11:0] CSRRdE,
input wire [31:0] CSROutD,
output reg [31:0] CSROutE
output reg [31:0] CSROutE,
input wire CSRRead,
output reg CSRReadE
);
initial begin
PCE = 32'b0;
......@@ -94,6 +96,7 @@ module EXSegReg(
CSRAluCtlE = 2'b0;
CSRRdE = 12'b0;
CSROutE = 32'b0;
CSRReadE = 1'b0;
end
//
always@(posedge clk) begin
......@@ -106,6 +109,7 @@ module EXSegReg(
CSRAluCtlE <= 2'b0;
CSRRdE <= 12'b0;
CSROutE <= 32'b0;
CSRReadE <= 1'b0;
PCE<=32'b0;
BrNPC<=32'b0;
ImmE<=32'b0;
......@@ -131,6 +135,7 @@ module EXSegReg(
CSRAluCtlE <= CSRAluCtlD;
CSRRdE <= CSRRdD;
CSROutE <= CSROutD;
CSRReadE <= CSRRead;
PCE<=PCD;
BrNPC<=JalNPC;
ImmE<=ImmD;
......
......@@ -39,7 +39,7 @@ module HarzardUnit(
input wire [11:0] CSRRs2E,
input wire [11:0] CSRRdM,
input wire [11:0] CSRRdW,
input wire CSRWriteE,CSRWriteM,CSRWriteW,
input wire CSRReadE,CSRWriteE,CSRWriteM,CSRWriteW,
output reg [1:0] CSRForwardE
);
wire rs1hitm ;
......@@ -51,8 +51,8 @@ assign regwew = |RegWriteW;
wire csrrs2hitm;
wire csrrs2hitw;
assign csrrs2hitm = (CSRWriteM)&&(CSRRs2E==CSRRdM)&&(CSRRdM[11:10]!=2'b11)&&(CSRWriteE);
assign csrrs2hitw = (CSRWriteW)&&(CSRRs2E==CSRRdW)&&(CSRRdW[11:10]!=2'b11)&&(CSRWriteE);
assign csrrs2hitm = (CSRWriteM)&&(CSRRs2E==CSRRdM)&&(CSRRdM[11:10]!=2'b11)&&(CSRReadE);
assign csrrs2hitw = (CSRWriteW)&&(CSRRs2E==CSRRdW)&&(CSRRdW[11:10]!=2'b11)&&(CSRReadE);
always@(*) begin //checking jump and hazard
if(CpuRst)begin
......
......@@ -163,6 +163,7 @@ module RV32Core(
);
wire CSRRead;
wire CSRReadE;
ControlUnit ControlUnit1(
.Op(OpCodeD),
.Fn3(Funct3D),
......@@ -265,6 +266,8 @@ module RV32Core(
.AluOutSrcE(AluOutSrcE),
.CSRWriteD(CSRWriteD),
.CSRWriteE(CSRWriteE),
.CSRRead(CSRRead),
.CSRReadE(CSRReadE),
.CSRAluCtlD(CSRAluCtlD),
.CSRAluCtlE(CSRAluCtlE),
.CSRRdD(CSRRdD),
......@@ -405,7 +408,8 @@ module RV32Core(
.CSRWriteE(CSRWriteE),
.CSRWriteM(CSRWriteM),
.CSRWriteW(CSRWriteW),
.CSRForwardE(CSRForwardE)
.CSRForwardE(CSRForwardE),
.CSRReadE(CSRReadE)
);
endmodule
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment