This commit is contained in:
mmasserfrye 2022-05-17 01:11:58 +00:00
commit 43cf4f35cd
10 changed files with 37 additions and 20 deletions

1
.gitignore vendored
View File

@ -103,3 +103,4 @@ pipelined/config/rv64ic_noMulDiv
pipelined/config/rv64ic_noPriv pipelined/config/rv64ic_noPriv
pipelined/config/rv64ic_orig pipelined/config/rv64ic_orig
synthDC/Summary.csv synthDC/Summary.csv
pipelined/srt/exptestgen

View File

@ -131,8 +131,8 @@
`define PLIC_GPIO_ID 3 `define PLIC_GPIO_ID 3
`define PLIC_UART_ID 10 `define PLIC_UART_ID 10
`define TWO_BIT_PRELOAD "../config/rv64ic/twoBitPredictor.txt" `define TWO_BIT_PRELOAD "../config/shared/twoBitPredictor.txt"
`define BTB_PRELOAD "../config/rv64ic/BTBPredictor.txt" `define BTB_PRELOAD "../config/shared/BTBPredictor.txt"
`define BPRED_ENABLED 1 `define BPRED_ENABLED 1
`define BPTYPE "BPGSHARE" // BPLOCALPAg or BPGLOBAL or BPTWOBIT or BPGSHARE `define BPTYPE "BPGSHARE" // BPLOCALPAg or BPGLOBAL or BPTWOBIT or BPGSHARE
`define TESTSBP 0 `define TESTSBP 0

View File

@ -116,7 +116,7 @@ module bpred
// this predictor will have two pieces of data, // this predictor will have two pieces of data,
// 1) A direction (1 = Taken, 0 = Not Taken) // 1) A direction (1 = Taken, 0 = Not Taken)
// 2) Any information which is necessary for the predictor to built it's next state. // 2) Any information which is necessary for the predictor to build its next state.
// For a 2 bit table this is the prediction count. // For a 2 bit table this is the prediction count.
assign SelBPPredF = ((BPInstrClassF[0] & BPPredF[1] & BTBValidF) | assign SelBPPredF = ((BPInstrClassF[0] & BPPredF[1] & BTBValidF) |

Binary file not shown.

View File

@ -1,2 +1,2 @@
verilator --lint-only --top-module srt srt.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv verilator --lint-only --top-module srt srt.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv
verilator --lint-only --top-module testbench testbench.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv ../src/fpu/unpacking.sv verilator --lint-only --top-module testbench testbench.sv -I../config/rv64gc -I../config/shared ../src/generic/*.sv ../src/generic/flop/*.sv ../src/fpu/unpack.sv

View File

@ -17,7 +17,7 @@ if [file exists work] {
} }
vlib work vlib work
vlog +incdir+../config/rv64gc +incdir+../config/shared srt.sv testbench.sv ../src/generic/flop/flop*.sv ../src/generic/mux.sv ../src/fpu/unpacking.sv vlog +incdir+../config/rv64gc +incdir+../config/shared srt.sv testbench.sv ../src/generic/flop/flop*.sv ../src/generic/mux.sv ../src/fpu/unpack.sv
vopt +acc work.testbench -o workopt vopt +acc work.testbench -o workopt
vsim workopt vsim workopt

View File

@ -92,6 +92,7 @@ module srtpostproc #(parameter N=52) (
output [N-1:0] Quot output [N-1:0] Quot
); );
// replace with on-the-fly conversion
//assign Quot = rp - rm; //assign Quot = rp - rm;
finaladd finaladd(rp, rm, Quot); finaladd finaladd(rp, rm, Quot);
endmodule endmodule

View File

@ -1,7 +1,7 @@
///////////// /////////////
// counter // // divcounter //
///////////// /////////////
module counter(input logic clk, module divcounter(input logic clk,
input logic req, input logic req,
output logic done); output logic done);
@ -36,6 +36,9 @@ endmodule
////////// //////////
// testbench // // testbench //
////////// //////////
/* verilator lint_off STMTDLY */
/* verilator lint_off INFINITELOOP */
module testbench; module testbench;
logic clk; logic clk;
logic req; logic req;
@ -83,11 +86,11 @@ module testbench;
// Unpacker // Unpacker
// Note: BiasE will probably get taken out eventually // Note: BiasE will probably get taken out eventually
unpack unpack(.X({1'b1,a[62:0]}), .Y({1'b1,b[62:0]}), .Z(64'b0), .FmtE(1'b1), .FOpCtrlE(3'b0), unpack unpack(.X({1'b1,a[62:0]}), .Y({1'b1,b[62:0]}), .Z(64'b0), .FmtE(1'b1),
.XSgnE(XSgnE), .YSgnE(YSgnE), .ZSgnE(ZSgnE), .XExpE(XExpE), .YExpE(YExpE), .ZExpE(ZExpE), .XSgnE(XSgnE), .YSgnE(YSgnE), .ZSgnE(ZSgnE), .XExpE(XExpE), .YExpE(YExpE), .ZExpE(ZExpE),
.XManE(XManE), .YManE(YManE), .ZManE(ZManE), .XNormE(XNormE), .XNaNE(XNaNE), .YNaNE(YNaNE), .ZNaNE(ZNaNE), .XManE(XManE), .YManE(YManE), .ZManE(ZManE), .XNormE(XNormE), .XNaNE(XNaNE), .YNaNE(YNaNE), .ZNaNE(ZNaNE),
.XSNaNE(XSNaNE), .YSNaNE(YSNaNE), .ZSNaNE(ZSNaNE), .XDenormE(XDenormE), .YDenormE(YDenormE), .ZDenormE(ZDenormE), .XSNaNE(XSNaNE), .YSNaNE(YSNaNE), .ZSNaNE(ZSNaNE), .XDenormE(XDenormE), .YDenormE(YDenormE), .ZDenormE(ZDenormE),
.XZeroE(XZeroE), .YZeroE(YZeroE), .ZZeroE(ZZeroE), .BiasE(BiasE), .XZeroE(XZeroE), .YZeroE(YZeroE), .ZZeroE(ZZeroE),
.XInfE(XInfE), .YInfE(YInfE), .ZInfE(ZInfE), .XExpMaxE(XExpMaxE)); .XInfE(XInfE), .YInfE(YInfE), .ZInfE(ZInfE), .XExpMaxE(XExpMaxE));
// Divider // Divider
@ -101,8 +104,8 @@ module testbench;
assign result = {1'b0, e, r}; assign result = {1'b0, e, r};
// Counter // Divcounter
counter counter(clk, req, done); divcounter divcounter(clk, req, done);
initial initial
@ -123,7 +126,7 @@ module testbench;
a = Vec[`mema]; a = Vec[`mema];
b = Vec[`memb]; b = Vec[`memb];
nextr = Vec[`memr]; nextr = Vec[`memr];
req <= #5 1; req = #5 1;
end end
// Apply directed test vectors read from file. // Apply directed test vectors read from file.
@ -132,7 +135,7 @@ module testbench;
begin begin
if (done) if (done)
begin begin
req <= #5 1; req = #5 1;
diffp = correctr - result; diffp = correctr - result;
diffn = result - correctr; diffn = result - correctr;
if (($signed(diffn) > 1) | ($signed(diffp) > 1)) // check if accurate to 1 ulp if (($signed(diffn) > 1) | ($signed(diffp) > 1)) // check if accurate to 1 ulp
@ -152,7 +155,7 @@ module testbench;
end end
if (req) if (req)
begin begin
req <= #5 0; req = #5 0;
correctr = nextr; correctr = nextr;
$display("pre increment"); $display("pre increment");
testnum = testnum+1; testnum = testnum+1;
@ -167,3 +170,5 @@ module testbench;
endmodule endmodule
/* verilator lint_on STMTDLY */
/* verilator lint_on INFINITELOOP */

View File

@ -329,8 +329,18 @@ logic [3:0] dummy;
// initialize the branch predictor // initialize the branch predictor
if (`BPRED_ENABLED == 1) if (`BPRED_ENABLED == 1)
initial begin initial begin
$readmemb(`TWO_BIT_PRELOAD, dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PHT.mem); integer adrindex;
$readmemb(`BTB_PRELOAD, dut.core.ifu.bpred.bpred.TargetPredictor.memory.mem);
// Initializing all zeroes into the branch predictor memory.
for(adrindex = 0; adrindex < 1024; adrindex++) begin
force dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PHT.mem[adrindex] = 0;
force dut.core.ifu.bpred.bpred.TargetPredictor.memory.mem[adrindex] = 0;
end
#1;
for(adrindex = 0; adrindex < 1024; adrindex++) begin
release dut.core.ifu.bpred.bpred.Predictor.DirPredictor.PHT.mem[adrindex];
release dut.core.ifu.bpred.bpred.TargetPredictor.memory.mem[adrindex];
end
end end
endmodule endmodule

View File

@ -962,7 +962,7 @@ string imperas32f[] = '{
"rv64i_m/I/andi-01", "6010", "rv64i_m/I/andi-01", "6010",
"rv64i_m/I/auipc-01", "2010", "rv64i_m/I/auipc-01", "2010",
"rv64i_m/I/beq-01", "47010", "rv64i_m/I/beq-01", "47010",
"rv64i_m/I/bge-01", "46010", "rv64i_m/I/bge-01", "47010",
"rv64i_m/I/bgeu-01", "56010", "rv64i_m/I/bgeu-01", "56010",
"rv64i_m/I/blt-01", "4d010", "rv64i_m/I/blt-01", "4d010",
"rv64i_m/I/bltu-01", "57010", "rv64i_m/I/bltu-01", "57010",