forked from Github_Repos/cvw
Added debug option to disable the function radix if not needed.
Function radix slows the simulation by 70 to 76 s (8.5%) for the rv64i tests.
This commit is contained in:
parent
dcae90e3ad
commit
f92f766573
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,3 +8,6 @@ transcript
|
|||||||
vsim.wlf
|
vsim.wlf
|
||||||
wally-pipelined/wlft*
|
wally-pipelined/wlft*
|
||||||
wlft*
|
wlft*
|
||||||
|
/imperas-riscv-tests/FunctionRadix_32.addr
|
||||||
|
/imperas-riscv-tests/FunctionRadix_64.addr
|
||||||
|
/imperas-riscv-tests/ProgramMap.txt
|
||||||
|
@ -51,5 +51,5 @@ add log -r /*
|
|||||||
|
|
||||||
-- Run the Simulation
|
-- Run the Simulation
|
||||||
#run 1000
|
#run 1000
|
||||||
#run -all
|
run -all
|
||||||
#quit
|
#quit
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
onerror {resume}
|
|
||||||
quietly WaveActivateNextPane {} 0
|
quietly WaveActivateNextPane {} 0
|
||||||
add wave -noupdate /testbench/clk
|
add wave -noupdate /testbench/clk
|
||||||
add wave -noupdate /testbench/reset
|
add wave -noupdate /testbench/reset
|
||||||
add wave -noupdate /testbench/test
|
add wave -noupdate /testbench/test
|
||||||
add wave -noupdate -radix ascii /testbench/memfilename
|
add wave -noupdate -radix ascii /testbench/memfilename
|
||||||
|
add wave -noupdate -label {Function Name} -radix Functions /testbench/functionRadix/function_radix/FunctionRadixName
|
||||||
add wave -noupdate -expand -group {Execution Stage} /testbench/dut/hart/ifu/PCE
|
add wave -noupdate -expand -group {Execution Stage} /testbench/dut/hart/ifu/PCE
|
||||||
add wave -noupdate -expand -group {Execution Stage} /testbench/InstrEName
|
add wave -noupdate -expand -group {Execution Stage} /testbench/InstrEName
|
||||||
add wave -noupdate -expand -group {Execution Stage} /testbench/dut/hart/ifu/InstrE
|
add wave -noupdate -expand -group {Execution Stage} /testbench/dut/hart/ifu/InstrE
|
||||||
@ -113,14 +113,12 @@ add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/
|
|||||||
add wave -noupdate /testbench/dut/hart/ieu/dp/ALUResultM
|
add wave -noupdate /testbench/dut/hart/ieu/dp/ALUResultM
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/FunctionRadixFile
|
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/FunctionRadixFile
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramIndexFile
|
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramIndexFile
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramName
|
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramIndexName
|
||||||
add wave -noupdate -expand -group {Function Radix} /testbench/testName
|
add wave -noupdate -expand -group {Function Radix} /testbench/testName
|
||||||
add wave -noupdate -expand -group {Function Radix} /testbench/functionRadix/function_radix/TestAddr
|
add wave -noupdate -expand -group {Function Radix} /testbench/functionRadix/function_radix/TestAddr
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix Functions /testbench/functionRadix/function_radix/index
|
|
||||||
add wave -noupdate -expand -group {Function Radix} /testbench/functionRadix/function_radix/TestNumber
|
|
||||||
TreeUpdate [SetDefaultTree]
|
TreeUpdate [SetDefaultTree]
|
||||||
WaveRestoreCursors {{Cursor 2} {6683 ns} 0} {{Cursor 3} {6455941 ns} 0}
|
WaveRestoreCursors {{Cursor 2} {6683 ns} 0} {{Cursor 3} {5926044 ns} 0}
|
||||||
quietly wave cursor active 1
|
quietly wave cursor active 2
|
||||||
configure wave -namecolwidth 250
|
configure wave -namecolwidth 250
|
||||||
configure wave -valuecolwidth 518
|
configure wave -valuecolwidth 518
|
||||||
configure wave -justifyvalue left
|
configure wave -justifyvalue left
|
||||||
@ -135,4 +133,4 @@ configure wave -griddelta 40
|
|||||||
configure wave -timeline 0
|
configure wave -timeline 0
|
||||||
configure wave -timelineunits ns
|
configure wave -timelineunits ns
|
||||||
update
|
update
|
||||||
WaveRestoreZoom {0 ns} {131270 ns}
|
WaveRestoreZoom {5925753 ns} {5927309 ns}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
`include "wally-config.vh"
|
`include "wally-config.vh"
|
||||||
|
|
||||||
module function_radix(reset, ProgramName);
|
module function_radix(reset, ProgramIndexName);
|
||||||
parameter FunctionRadixFile, ProgramIndexFile;
|
parameter FunctionRadixFile, ProgramIndexFile;
|
||||||
|
|
||||||
input logic reset;
|
input logic reset;
|
||||||
@ -35,18 +35,18 @@ module function_radix(reset, ProgramName);
|
|||||||
input string FunctionRadixFile;
|
input string FunctionRadixFile;
|
||||||
input string ProgramIndexFile;
|
input string ProgramIndexFile;
|
||||||
-----/\----- EXCLUDED -----/\----- */
|
-----/\----- EXCLUDED -----/\----- */
|
||||||
input string ProgramName;
|
input string ProgramIndexName;
|
||||||
|
|
||||||
localparam TestSize = 16;
|
localparam TestSize = 16;
|
||||||
localparam TotalSize = `XLEN+TestSize;
|
localparam TotalSize = `XLEN+TestSize;
|
||||||
|
|
||||||
logic [TotalSize-1:0] memory_bank [];
|
logic [TotalSize-1:0] FunctionRadixMemory [];
|
||||||
logic [TotalSize-1:0] index;
|
logic [TotalSize-1:0] FunctionRadixName;
|
||||||
|
|
||||||
integer ProgramBank [string];
|
integer ProgramIndexMemory [string];
|
||||||
|
|
||||||
logic [`XLEN-1:0] pc;
|
logic [`XLEN-1:0] pc;
|
||||||
logic [TestSize-1:0] TestNumber;
|
logic [TestSize-1:0] ProgramIndexTestNumber;
|
||||||
logic [TotalSize-1:0] TestAddr;
|
logic [TotalSize-1:0] TestAddr;
|
||||||
|
|
||||||
// *** I should look into the system verilog objects instead of signal spy.
|
// *** I should look into the system verilog objects instead of signal spy.
|
||||||
@ -54,7 +54,7 @@ module function_radix(reset, ProgramName);
|
|||||||
$init_signal_spy("/testbench/dut/hart/PCE", "/testbench/functionRadix/function_radix/pc");
|
$init_signal_spy("/testbench/dut/hart/PCE", "/testbench/functionRadix/function_radix/pc");
|
||||||
end
|
end
|
||||||
|
|
||||||
assign TestAddr = {TestNumber, pc};
|
assign TestAddr = {ProgramIndexTestNumber, pc};
|
||||||
|
|
||||||
task automatic bin_search_min;
|
task automatic bin_search_min;
|
||||||
input logic [TotalSize-1:0] pc;
|
input logic [TotalSize-1:0] pc;
|
||||||
@ -98,31 +98,31 @@ module function_radix(reset, ProgramName);
|
|||||||
end
|
end
|
||||||
endtask // bin_search_min
|
endtask // bin_search_min
|
||||||
|
|
||||||
integer fp, ProgramFP;
|
integer FunctionRadixFP, ProgramIndexFP;
|
||||||
integer line_count, ProgramLineCount;
|
integer FunctionRadixLineCount, ProgramLineCount;
|
||||||
logic [TotalSize-1:0] line;
|
logic [TotalSize-1:0] FunctionRadixLine;
|
||||||
string ProgramLine;
|
string ProgramIndexLine;
|
||||||
|
|
||||||
// preload
|
// preload
|
||||||
//always @ (posedge reset) begin
|
//always @ (posedge reset) begin
|
||||||
initial begin
|
initial begin
|
||||||
$readmemh(FunctionRadixFile, memory_bank);
|
$readmemh(FunctionRadixFile, FunctionRadixMemory);
|
||||||
// we need to count the number of lines in the file so we can set line_count.
|
// we need to count the number of lines in the file so we can set FunctionRadixLineCount.
|
||||||
|
|
||||||
line_count = 0;
|
FunctionRadixLineCount = 0;
|
||||||
fp = $fopen(FunctionRadixFile, "r");
|
FunctionRadixFP = $fopen(FunctionRadixFile, "r");
|
||||||
|
|
||||||
// read line by line to count lines
|
// read line by line to count lines
|
||||||
if (fp) begin
|
if (FunctionRadixFP) begin
|
||||||
while (! $feof(fp)) begin
|
while (! $feof(FunctionRadixFP)) begin
|
||||||
$fscanf(fp, "%h\n", line);
|
$fscanf(FunctionRadixFP, "%h\n", FunctionRadixLine);
|
||||||
|
|
||||||
line_count = line_count + 1;
|
FunctionRadixLineCount = FunctionRadixLineCount + 1;
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
$display("Cannot open file %s for reading.", FunctionRadixFile);
|
$display("Cannot open file %s for reading.", FunctionRadixFile);
|
||||||
end
|
end
|
||||||
$fclose(fp);
|
$fclose(FunctionRadixFP);
|
||||||
|
|
||||||
|
|
||||||
// ProgramIndexFile maps the program name to the compile index.
|
// ProgramIndexFile maps the program name to the compile index.
|
||||||
@ -130,28 +130,28 @@ module function_radix(reset, ProgramName);
|
|||||||
// in the custom radix.
|
// in the custom radix.
|
||||||
// Build an associative array to convert the name to an index.
|
// Build an associative array to convert the name to an index.
|
||||||
ProgramLineCount = 0;
|
ProgramLineCount = 0;
|
||||||
ProgramFP = $fopen(ProgramIndexFile, "r");
|
ProgramIndexFP = $fopen(ProgramIndexFile, "r");
|
||||||
|
|
||||||
if (ProgramFP) begin
|
if (ProgramIndexFP) begin
|
||||||
while (! $feof(ProgramFP)) begin
|
while (! $feof(ProgramIndexFP)) begin
|
||||||
$fscanf(ProgramFP, "%s\n", ProgramLine);
|
$fscanf(ProgramIndexFP, "%s\n", ProgramIndexLine);
|
||||||
ProgramBank[ProgramLine] = ProgramLineCount;
|
ProgramIndexMemory[ProgramIndexLine] = ProgramLineCount;
|
||||||
ProgramLineCount = ProgramLineCount + 1;
|
ProgramLineCount = ProgramLineCount + 1;
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
$display("Cannot open file %s for reading.", ProgramIndexFile);
|
$display("Cannot open file %s for reading.", ProgramIndexFile);
|
||||||
end
|
end
|
||||||
$fclose(ProgramFP);
|
$fclose(ProgramIndexFP);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
always @(pc) begin
|
always @(pc) begin
|
||||||
bin_search_min(TestAddr, line_count, memory_bank, index);
|
bin_search_min(TestAddr, FunctionRadixLineCount, FunctionRadixMemory, FunctionRadixName);
|
||||||
end
|
end
|
||||||
|
|
||||||
// Each time there is a new program update the test number
|
// Each time there is a new program update the test number
|
||||||
always @(ProgramName) begin
|
always @(ProgramIndexName) begin
|
||||||
TestNumber = ProgramBank[ProgramName];
|
ProgramIndexTestNumber = ProgramIndexMemory[ProgramIndexName];
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule // function_radix
|
endmodule // function_radix
|
||||||
|
@ -30,7 +30,8 @@ module testbench();
|
|||||||
parameter FunctionRadixFile32 = "../../imperas-riscv-tests/FunctionRadix_32.addr";
|
parameter FunctionRadixFile32 = "../../imperas-riscv-tests/FunctionRadix_32.addr";
|
||||||
parameter FunctionRadixFile64 = "../../imperas-riscv-tests/FunctionRadix_64.addr";
|
parameter FunctionRadixFile64 = "../../imperas-riscv-tests/FunctionRadix_64.addr";
|
||||||
parameter ProgramIndexFile = "../../imperas-riscv-tests/ProgramMap.txt";
|
parameter ProgramIndexFile = "../../imperas-riscv-tests/ProgramMap.txt";
|
||||||
|
parameter DEBUG = 1;
|
||||||
|
|
||||||
logic clk;
|
logic clk;
|
||||||
logic reset;
|
logic reset;
|
||||||
|
|
||||||
@ -454,20 +455,18 @@ string tests32i[] = {
|
|||||||
end // always @ (negedge clk)
|
end // always @ (negedge clk)
|
||||||
|
|
||||||
// track the current function or global label
|
// track the current function or global label
|
||||||
generate
|
if (`XLEN == 32 && DEBUG == 1) begin : functionRadix
|
||||||
if (`XLEN == 32) begin : functionRadix
|
function_radix #(.FunctionRadixFile(FunctionRadixFile32),
|
||||||
function_radix #(.FunctionRadixFile(FunctionRadixFile32),
|
.ProgramIndexFile(ProgramIndexFile))
|
||||||
.ProgramIndexFile(ProgramIndexFile))
|
function_radix(.reset(reset),
|
||||||
function_radix(.reset(reset),
|
.ProgramIndexName(testName));
|
||||||
.ProgramName(testName));
|
end else if (`XLEN == 64 && DEBUG == 1) begin : functionRadix
|
||||||
end else begin : functionRadix
|
function_radix #(.FunctionRadixFile(FunctionRadixFile64),
|
||||||
function_radix #(.FunctionRadixFile(FunctionRadixFile64),
|
.ProgramIndexFile(ProgramIndexFile))
|
||||||
.ProgramIndexFile(ProgramIndexFile))
|
function_radix(.reset(reset),
|
||||||
function_radix(.reset(reset),
|
.ProgramIndexName(testName));
|
||||||
.ProgramName(testName));
|
end
|
||||||
end
|
|
||||||
endgenerate
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
/* verilator lint_on STMTDLY */
|
/* verilator lint_on STMTDLY */
|
||||||
|
Loading…
Reference in New Issue
Block a user