mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Fixed bug in basic gshare implementation. Should be a better comparison to the speculative versions now.
This commit is contained in:
parent
c18ac35332
commit
1ab2d0d19b
@ -48,8 +48,8 @@ module gshare #(parameter k = 10) (
|
|||||||
logic [k-1:0] GHRNext;
|
logic [k-1:0] GHRNext;
|
||||||
logic PCSrcM;
|
logic PCSrcM;
|
||||||
|
|
||||||
assign IndexNextF = GHR & {PCNextF[k+1] ^ PCNextF[1], PCNextF[k:2]};
|
assign IndexNextF = GHR ^ {PCNextF[k+1] ^ PCNextF[1], PCNextF[k:2]};
|
||||||
assign IndexE = GHRE & {PCE[k+1] ^ PCE[1], PCE[k:2]};
|
assign IndexE = GHRE ^ {PCE[k+1] ^ PCE[1], PCE[k:2]};
|
||||||
|
|
||||||
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
||||||
.ce1(~StallF), .ce2(~StallM & ~FlushM),
|
.ce1(~StallF), .ce2(~StallM & ~FlushM),
|
||||||
|
@ -31,16 +31,16 @@
|
|||||||
module gshare_copy #(parameter k = 10) (
|
module gshare_copy #(parameter k = 10) (
|
||||||
input logic clk,
|
input logic clk,
|
||||||
input logic reset,
|
input logic reset,
|
||||||
input logic StallF, StallD, StallE, StallM,
|
input logic StallF, StallD, StallE, StallM, StallW,
|
||||||
input logic FlushD, FlushE, FlushM,
|
input logic FlushD, FlushE, FlushM, FlushW,
|
||||||
output logic [1:0] DirPredictionF,
|
output logic [1:0] DirPredictionF,
|
||||||
output logic DirPredictionWrongE,
|
output logic DirPredictionWrongE,
|
||||||
// update
|
// update
|
||||||
input logic [`XLEN-1:0] PCNextF, PCE,
|
input logic [`XLEN-1:0] PCNextF, PCM,
|
||||||
input logic BranchInstrE, BranchInstrM, PCSrcE
|
input logic BranchInstrE, BranchInstrM, PCSrcE
|
||||||
);
|
);
|
||||||
|
|
||||||
logic [k-1:0] IndexNextF, IndexE;
|
logic [k-1:0] IndexNextF, IndexM;
|
||||||
logic [1:0] DirPredictionD, DirPredictionE;
|
logic [1:0] DirPredictionD, DirPredictionE;
|
||||||
logic [1:0] NewDirPredictionE, NewDirPredictionM;
|
logic [1:0] NewDirPredictionE, NewDirPredictionM;
|
||||||
|
|
||||||
@ -48,16 +48,16 @@ module gshare_copy #(parameter k = 10) (
|
|||||||
logic [k-1:0] GHRNext;
|
logic [k-1:0] GHRNext;
|
||||||
logic PCSrcM;
|
logic PCSrcM;
|
||||||
|
|
||||||
assign IndexNextF = GHR & {PCNextF[k+1] ^ PCNextF[1], PCNextF[k:2]};
|
assign IndexNextF = GHRNext ^ {PCNextF[k+1] ^ PCNextF[1], PCNextF[k:2]};
|
||||||
assign IndexE = GHRE & {PCE[k+1] ^ PCE[1], PCE[k:2]};
|
assign IndexM = GHR ^ {PCM[k+1] ^ PCM[1], PCM[k:2]};
|
||||||
|
|
||||||
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
ram2p1r1wbe #(2**k, 2) PHT(.clk(clk),
|
||||||
.ce1(~StallF), .ce2(~StallM & ~FlushM),
|
.ce1(~StallF), .ce2(~StallM & ~FlushM),
|
||||||
.ra1(IndexNextF),
|
.ra1(IndexNextF),
|
||||||
.rd1(DirPredictionF),
|
.rd1(DirPredictionF),
|
||||||
.wa2(IndexE),
|
.wa2(IndexM),
|
||||||
.wd2(NewDirPredictionE),
|
.wd2(NewDirPredictionM),
|
||||||
.we2(BranchInstrE & ~StallM & ~FlushM),
|
.we2(BranchInstrM & ~StallW & ~FlushW),
|
||||||
.bwe2(1'b1));
|
.bwe2(1'b1));
|
||||||
|
|
||||||
flopenrc #(2) PredictionRegD(clk, reset, FlushD, ~StallD, DirPredictionF, DirPredictionD);
|
flopenrc #(2) PredictionRegD(clk, reset, FlushD, ~StallD, DirPredictionF, DirPredictionD);
|
||||||
@ -72,9 +72,11 @@ module gshare_copy #(parameter k = 10) (
|
|||||||
flopenr #(k) GHRReg(clk, reset, ~StallM & ~FlushM & BranchInstrM, GHRNext, GHR);
|
flopenr #(k) GHRReg(clk, reset, ~StallM & ~FlushM & BranchInstrM, GHRNext, GHR);
|
||||||
flopenrc #(1) PCSrcMReg(clk, reset, FlushM, ~StallM, PCSrcE, PCSrcM);
|
flopenrc #(1) PCSrcMReg(clk, reset, FlushM, ~StallM, PCSrcE, PCSrcM);
|
||||||
|
|
||||||
|
/* -----\/----- EXCLUDED -----\/-----
|
||||||
flopenrc #(k) GHRFReg(clk, reset, FlushD, ~StallF, GHR, GHRF);
|
flopenrc #(k) GHRFReg(clk, reset, FlushD, ~StallF, GHR, GHRF);
|
||||||
flopenrc #(k) GHRDReg(clk, reset, FlushD, ~StallD, GHRF, GHRD);
|
flopenrc #(k) GHRDReg(clk, reset, FlushD, ~StallD, GHRF, GHRD);
|
||||||
flopenrc #(k) GHREReg(clk, reset, FlushE, ~StallE, GHRD, GHRE);
|
flopenrc #(k) GHREReg(clk, reset, FlushE, ~StallE, GHRD, GHRE);
|
||||||
|
-----/\----- EXCLUDED -----/\----- */
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user