mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Improve version of the function radix which does not cause the wave file rendering to slow down.
This commit is contained in:
parent
f1f7884e10
commit
b1d1f3995c
wally-pipelined
@ -57,9 +57,11 @@ function processProgram {
|
|||||||
# parse out the addresses and the labels
|
# parse out the addresses and the labels
|
||||||
local addresses=`echo "$listOfAddr" | awk '{print $1}'`
|
local addresses=`echo "$listOfAddr" | awk '{print $1}'`
|
||||||
local labels=`echo "$listOfAddr" | awk '{print "\""$2"\"", "-color \"SpringGreen\","}' | tr -d '<>:'`
|
local labels=`echo "$listOfAddr" | awk '{print "\""$2"\"", "-color \"SpringGreen\","}' | tr -d '<>:'`
|
||||||
|
local labelsName=`echo "$listOfAddr" | awk '{print ""$2""}' | tr -d '<>:'`
|
||||||
|
|
||||||
# output per program function address list
|
# output per program function address list
|
||||||
echo "$addresses" > $objDumpFile.addr
|
echo "$addresses" > $objDumpFile.addr
|
||||||
|
echo "$labelsName" > $objDumpFile.lab
|
||||||
|
|
||||||
# need to add some formatting to each line
|
# need to add some formatting to each line
|
||||||
local numLines=`echo "$listOfAddr" | wc -l`
|
local numLines=`echo "$listOfAddr" | wc -l`
|
||||||
|
@ -3,7 +3,6 @@ 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
|
||||||
@ -111,16 +110,25 @@ add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/
|
|||||||
add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/dp/SrcAE
|
add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/dp/SrcAE
|
||||||
add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/dp/SrcBE
|
add wave -noupdate -expand -group {alu execution stage} /testbench/dut/hart/ieu/dp/SrcBE
|
||||||
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 /testbench/functionRadix/function_radix/FunctionAddr
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramIndexFile
|
add wave -noupdate /testbench/functionRadix/function_radix/reset
|
||||||
add wave -noupdate -expand -group {Function Radix} -radix ascii /testbench/functionRadix/function_radix/ProgramIndexName
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramLabelMapLineCount
|
||||||
add wave -noupdate -expand -group {Function Radix} /testbench/testName
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramLabelMapLine
|
||||||
add wave -noupdate -expand -group {Function Radix} /testbench/functionRadix/function_radix/TestAddr
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramLabelMapFP
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramLabelMapFile
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramAddrMapLineCount
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramAddrMapLine
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramAddrMapFP
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramAddrMapFile
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/pc
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/FunctionName
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/FunctionAddr
|
||||||
|
add wave -noupdate /testbench/functionRadix/function_radix/ProgramAddrIndex
|
||||||
TreeUpdate [SetDefaultTree]
|
TreeUpdate [SetDefaultTree]
|
||||||
WaveRestoreCursors {{Cursor 2} {6683 ns} 0} {{Cursor 3} {5926044 ns} 0}
|
WaveRestoreCursors {{Cursor 2} {1091 ns} 0} {{Cursor 3} {5926044 ns} 0}
|
||||||
quietly wave cursor active 2
|
quietly wave cursor active 1
|
||||||
configure wave -namecolwidth 250
|
configure wave -namecolwidth 250
|
||||||
configure wave -valuecolwidth 518
|
configure wave -valuecolwidth 229
|
||||||
configure wave -justifyvalue left
|
configure wave -justifyvalue left
|
||||||
configure wave -signalnamewidth 1
|
configure wave -signalnamewidth 1
|
||||||
configure wave -snapdistance 10
|
configure wave -snapdistance 10
|
||||||
@ -133,4 +141,4 @@ configure wave -griddelta 40
|
|||||||
configure wave -timeline 0
|
configure wave -timeline 0
|
||||||
configure wave -timelineunits ns
|
configure wave -timelineunits ns
|
||||||
update
|
update
|
||||||
WaveRestoreZoom {5925753 ns} {5927309 ns}
|
WaveRestoreZoom {0 ns} {105 us}
|
||||||
|
@ -27,45 +27,40 @@
|
|||||||
|
|
||||||
`include "wally-config.vh"
|
`include "wally-config.vh"
|
||||||
|
|
||||||
module function_radix(reset, ProgramIndexName);
|
module function_radix(reset, ProgramAddrMapFile, ProgramLabelMapFile);
|
||||||
parameter FunctionRadixFile, ProgramIndexFile;
|
|
||||||
|
|
||||||
input logic reset;
|
input logic reset;
|
||||||
/* -----\/----- EXCLUDED -----\/-----
|
input string ProgramAddrMapFile;
|
||||||
input string FunctionRadixFile;
|
input string ProgramLabelMapFile;
|
||||||
input string ProgramIndexFile;
|
|
||||||
-----/\----- EXCLUDED -----/\----- */
|
|
||||||
input string ProgramIndexName;
|
|
||||||
|
|
||||||
localparam TestSize = 16;
|
logic [`XLEN-1:0] ProgramAddrMapMemory [];
|
||||||
localparam TotalSize = `XLEN+TestSize;
|
string ProgramLabelMapMemory [integer];
|
||||||
|
string FunctionName;
|
||||||
logic [TotalSize-1:0] FunctionRadixMemory [];
|
|
||||||
logic [TotalSize-1:0] FunctionRadixName;
|
|
||||||
|
|
||||||
integer ProgramIndexMemory [string];
|
|
||||||
|
|
||||||
logic [`XLEN-1:0] pc;
|
|
||||||
logic [TestSize-1:0] ProgramIndexTestNumber;
|
logic [`XLEN-1:0] pc, FunctionAddr;
|
||||||
logic [TotalSize-1:0] TestAddr;
|
integer ProgramAddrIndex;
|
||||||
|
|
||||||
// *** I should look into the system verilog objects instead of signal spy.
|
// *** I should look into the system verilog objects instead of signal spy.
|
||||||
initial begin
|
initial begin
|
||||||
$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 = {ProgramIndexTestNumber, pc};
|
|
||||||
|
|
||||||
task automatic bin_search_min;
|
task automatic bin_search_min;
|
||||||
input logic [TotalSize-1:0] pc;
|
input logic [`XLEN-1:0] pc;
|
||||||
input logic [TotalSize-1:0] length;
|
input logic [`XLEN-1:0] length;
|
||||||
ref logic [TotalSize-1:0] array [];
|
ref logic [`XLEN-1:0] array [];
|
||||||
output logic [TotalSize-1:0] minval;
|
output logic [`XLEN-1:0] minval;
|
||||||
|
output logic [`XLEN-1:0] mid;
|
||||||
|
|
||||||
logic [TotalSize-1:0] left, right;
|
logic [`XLEN-1:0] left, right;
|
||||||
logic [TotalSize-1:0] mid;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if ( pc == 0 ) begin
|
||||||
|
// *** want to keep the old value for mid and minval
|
||||||
|
mid = 0;
|
||||||
|
return;
|
||||||
|
end
|
||||||
left = 0;
|
left = 0;
|
||||||
right = length;
|
right = length;
|
||||||
while (left <= right) begin
|
while (left <= right) begin
|
||||||
@ -98,61 +93,59 @@ module function_radix(reset, ProgramIndexName);
|
|||||||
end
|
end
|
||||||
endtask // bin_search_min
|
endtask // bin_search_min
|
||||||
|
|
||||||
integer FunctionRadixFP, ProgramIndexFP;
|
integer ProgramAddrMapFP, ProgramLabelMapFP;
|
||||||
integer FunctionRadixLineCount, ProgramLineCount;
|
integer ProgramAddrMapLineCount, ProgramLabelMapLineCount;
|
||||||
logic [TotalSize-1:0] FunctionRadixLine;
|
longint ProgramAddrMapLine;
|
||||||
string ProgramIndexLine;
|
string ProgramLabelMapLine;
|
||||||
|
|
||||||
// preload
|
// preload
|
||||||
//always @ (posedge reset) begin
|
// initial begin
|
||||||
initial begin
|
always @ (posedge reset) begin
|
||||||
$readmemh(FunctionRadixFile, FunctionRadixMemory);
|
$readmemh(ProgramAddrMapFile, ProgramAddrMapMemory);
|
||||||
// we need to count the number of lines in the file so we can set FunctionRadixLineCount.
|
// we need to count the number of lines in the file so we can set FunctionRadixLineCount.
|
||||||
|
|
||||||
FunctionRadixLineCount = 0;
|
ProgramAddrMapLineCount = 0;
|
||||||
FunctionRadixFP = $fopen(FunctionRadixFile, "r");
|
ProgramAddrMapFP = $fopen(ProgramAddrMapFile, "r");
|
||||||
|
|
||||||
// read line by line to count lines
|
// read line by line to count lines
|
||||||
if (FunctionRadixFP) begin
|
if (ProgramAddrMapFP) begin
|
||||||
while (! $feof(FunctionRadixFP)) begin
|
while (! $feof(ProgramAddrMapFP)) begin
|
||||||
$fscanf(FunctionRadixFP, "%h\n", FunctionRadixLine);
|
$fscanf(ProgramAddrMapFP, "%h\n", ProgramAddrMapLine);
|
||||||
|
|
||||||
FunctionRadixLineCount = FunctionRadixLineCount + 1;
|
ProgramAddrMapLineCount = ProgramAddrMapLineCount + 1;
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
$display("Cannot open file %s for reading.", FunctionRadixFile);
|
$display("Cannot open file %s for reading.", ProgramAddrMapFile);
|
||||||
end
|
end
|
||||||
$fclose(FunctionRadixFP);
|
$fclose(ProgramAddrMapFP);
|
||||||
|
|
||||||
|
|
||||||
// ProgramIndexFile maps the program name to the compile index.
|
// ProgramIndexFile maps the program name to the compile index.
|
||||||
// The compile index is then used to inditify the application
|
// The compile index is then used to inditify the application
|
||||||
// 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;
|
ProgramLabelMapLineCount = 0;
|
||||||
ProgramIndexFP = $fopen(ProgramIndexFile, "r");
|
ProgramLabelMapFP = $fopen(ProgramLabelMapFile, "r");
|
||||||
|
|
||||||
if (ProgramIndexFP) begin
|
if (ProgramLabelMapFP) begin
|
||||||
while (! $feof(ProgramIndexFP)) begin
|
while (! $feof(ProgramLabelMapFP)) begin
|
||||||
$fscanf(ProgramIndexFP, "%s\n", ProgramIndexLine);
|
$fscanf(ProgramLabelMapFP, "%s\n", ProgramLabelMapLine);
|
||||||
ProgramIndexMemory[ProgramIndexLine] = ProgramLineCount;
|
ProgramLabelMapMemory[ProgramLabelMapLineCount] = ProgramLabelMapLine;
|
||||||
ProgramLineCount = ProgramLineCount + 1;
|
ProgramLabelMapLineCount = ProgramLabelMapLineCount + 1;
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
$display("Cannot open file %s for reading.", ProgramIndexFile);
|
$display("Cannot open file %s for reading.", ProgramLabelMapFile);
|
||||||
end
|
end
|
||||||
$fclose(ProgramIndexFP);
|
$fclose(ProgramLabelMapFP);
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
always @(pc) begin
|
always @(pc) begin
|
||||||
bin_search_min(TestAddr, FunctionRadixLineCount, FunctionRadixMemory, FunctionRadixName);
|
bin_search_min(pc, ProgramAddrMapLineCount, ProgramAddrMapMemory, FunctionAddr, ProgramAddrIndex);
|
||||||
end
|
end
|
||||||
|
|
||||||
// Each time there is a new program update the test number
|
|
||||||
always @(ProgramIndexName) begin
|
assign FunctionName = ProgramLabelMapMemory[ProgramAddrIndex];
|
||||||
ProgramIndexTestNumber = ProgramIndexMemory[ProgramIndexName];
|
|
||||||
end
|
|
||||||
|
|
||||||
endmodule // function_radix
|
endmodule // function_radix
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ string tests32i[] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
string tests[];
|
string tests[];
|
||||||
string testName;
|
string ProgramAddrMapFile, ProgramLabelMapFile;
|
||||||
logic [`AHBW-1:0] HRDATAEXT;
|
logic [`AHBW-1:0] HRDATAEXT;
|
||||||
logic HREADYEXT, HRESPEXT;
|
logic HREADYEXT, HRESPEXT;
|
||||||
logic [31:0] HADDR;
|
logic [31:0] HADDR;
|
||||||
@ -379,7 +379,8 @@ string tests32i[] = {
|
|||||||
memfilename = {"../../imperas-riscv-tests/work/", tests[test], ".elf.memfile"};
|
memfilename = {"../../imperas-riscv-tests/work/", tests[test], ".elf.memfile"};
|
||||||
$readmemh(memfilename, dut.imem.RAM);
|
$readmemh(memfilename, dut.imem.RAM);
|
||||||
$readmemh(memfilename, dut.uncore.dtim.RAM);
|
$readmemh(memfilename, dut.uncore.dtim.RAM);
|
||||||
testName = tests[test];
|
ProgramAddrMapFile = {"../../imperas-riscv-tests/work/", tests[test], ".elf.objdump.addr"};
|
||||||
|
ProgramLabelMapFile = {"../../imperas-riscv-tests/work/", tests[test], ".elf.objdump.lab"};
|
||||||
$display("Read memfile %s", memfilename);
|
$display("Read memfile %s", memfilename);
|
||||||
reset = 1; # 42; reset = 0;
|
reset = 1; # 42; reset = 0;
|
||||||
end
|
end
|
||||||
@ -454,24 +455,19 @@ string tests32i[] = {
|
|||||||
$readmemh(memfilename, dut.imem.RAM);
|
$readmemh(memfilename, dut.imem.RAM);
|
||||||
$readmemh(memfilename, dut.uncore.dtim.RAM);
|
$readmemh(memfilename, dut.uncore.dtim.RAM);
|
||||||
$display("Read memfile %s", memfilename);
|
$display("Read memfile %s", memfilename);
|
||||||
testName = tests[test];
|
ProgramAddrMapFile = {"../../imperas-riscv-tests/work/", tests[test], ".elf.objdump.addr"};
|
||||||
|
ProgramLabelMapFile = {"../../imperas-riscv-tests/work/", tests[test], ".elf.objdump.lab"};
|
||||||
reset = 1; # 17; reset = 0;
|
reset = 1; # 17; reset = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end // always @ (negedge clk)
|
end // always @ (negedge clk)
|
||||||
|
|
||||||
// track the current function or global label
|
// track the current function or global label
|
||||||
if (`XLEN == 32 && DEBUG == 1) begin : functionRadix
|
if (DEBUG == 1) begin : functionRadix
|
||||||
function_radix #(.FunctionRadixFile(FunctionRadixFile32),
|
function_radix function_radix(.reset(reset),
|
||||||
.ProgramIndexFile(ProgramIndexFile))
|
.ProgramAddrMapFile(ProgramAddrMapFile),
|
||||||
function_radix(.reset(reset),
|
.ProgramLabelMapFile(ProgramLabelMapFile));
|
||||||
.ProgramIndexName(testName));
|
end
|
||||||
end else if (`XLEN == 64 && DEBUG == 1) begin : functionRadix
|
|
||||||
function_radix #(.FunctionRadixFile(FunctionRadixFile64),
|
|
||||||
.ProgramIndexFile(ProgramIndexFile))
|
|
||||||
function_radix(.reset(reset),
|
|
||||||
.ProgramIndexName(testName));
|
|
||||||
end
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user