diff --git a/.gitignore b/.gitignore index 3f254d13..8692d6bc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ transcript vsim.wlf wally-pipelined/wlft* wlft* +/imperas-riscv-tests/FunctionRadix_32.addr +/imperas-riscv-tests/FunctionRadix_64.addr +/imperas-riscv-tests/ProgramMap.txt diff --git a/wally-pipelined/regression/wally-pipelined-ross.do b/wally-pipelined/regression/wally-pipelined-ross.do index 54eafc0f..e76e7fad 100644 --- a/wally-pipelined/regression/wally-pipelined-ross.do +++ b/wally-pipelined/regression/wally-pipelined-ross.do @@ -51,5 +51,5 @@ add log -r /* -- Run the Simulation #run 1000 -#run -all +run -all #quit diff --git a/wally-pipelined/regression/wave.do b/wally-pipelined/regression/wave.do index 208358b0..69e7fe82 100644 --- a/wally-pipelined/regression/wave.do +++ b/wally-pipelined/regression/wave.do @@ -1,9 +1,9 @@ -onerror {resume} quietly WaveActivateNextPane {} 0 add wave -noupdate /testbench/clk add wave -noupdate /testbench/reset add wave -noupdate /testbench/test 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/InstrEName 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 -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/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/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] -WaveRestoreCursors {{Cursor 2} {6683 ns} 0} {{Cursor 3} {6455941 ns} 0} -quietly wave cursor active 1 +WaveRestoreCursors {{Cursor 2} {6683 ns} 0} {{Cursor 3} {5926044 ns} 0} +quietly wave cursor active 2 configure wave -namecolwidth 250 configure wave -valuecolwidth 518 configure wave -justifyvalue left @@ -135,4 +133,4 @@ configure wave -griddelta 40 configure wave -timeline 0 configure wave -timelineunits ns update -WaveRestoreZoom {0 ns} {131270 ns} +WaveRestoreZoom {5925753 ns} {5927309 ns} diff --git a/wally-pipelined/testbench/function_radix.sv b/wally-pipelined/testbench/function_radix.sv index 929e4349..ae96ba61 100644 --- a/wally-pipelined/testbench/function_radix.sv +++ b/wally-pipelined/testbench/function_radix.sv @@ -27,7 +27,7 @@ `include "wally-config.vh" -module function_radix(reset, ProgramName); +module function_radix(reset, ProgramIndexName); parameter FunctionRadixFile, ProgramIndexFile; input logic reset; @@ -35,18 +35,18 @@ module function_radix(reset, ProgramName); input string FunctionRadixFile; input string ProgramIndexFile; -----/\----- EXCLUDED -----/\----- */ - input string ProgramName; + input string ProgramIndexName; localparam TestSize = 16; localparam TotalSize = `XLEN+TestSize; - logic [TotalSize-1:0] memory_bank []; - logic [TotalSize-1:0] index; + logic [TotalSize-1:0] FunctionRadixMemory []; + logic [TotalSize-1:0] FunctionRadixName; - integer ProgramBank [string]; + integer ProgramIndexMemory [string]; logic [`XLEN-1:0] pc; - logic [TestSize-1:0] TestNumber; + logic [TestSize-1:0] ProgramIndexTestNumber; logic [TotalSize-1:0] TestAddr; // *** 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"); end - assign TestAddr = {TestNumber, pc}; + assign TestAddr = {ProgramIndexTestNumber, pc}; task automatic bin_search_min; input logic [TotalSize-1:0] pc; @@ -98,31 +98,31 @@ module function_radix(reset, ProgramName); end endtask // bin_search_min - integer fp, ProgramFP; - integer line_count, ProgramLineCount; - logic [TotalSize-1:0] line; - string ProgramLine; + integer FunctionRadixFP, ProgramIndexFP; + integer FunctionRadixLineCount, ProgramLineCount; + logic [TotalSize-1:0] FunctionRadixLine; + string ProgramIndexLine; // preload //always @ (posedge reset) begin initial begin - $readmemh(FunctionRadixFile, memory_bank); - // we need to count the number of lines in the file so we can set line_count. + $readmemh(FunctionRadixFile, FunctionRadixMemory); + // we need to count the number of lines in the file so we can set FunctionRadixLineCount. - line_count = 0; - fp = $fopen(FunctionRadixFile, "r"); + FunctionRadixLineCount = 0; + FunctionRadixFP = $fopen(FunctionRadixFile, "r"); // read line by line to count lines - if (fp) begin - while (! $feof(fp)) begin - $fscanf(fp, "%h\n", line); + if (FunctionRadixFP) begin + while (! $feof(FunctionRadixFP)) begin + $fscanf(FunctionRadixFP, "%h\n", FunctionRadixLine); - line_count = line_count + 1; + FunctionRadixLineCount = FunctionRadixLineCount + 1; end end else begin $display("Cannot open file %s for reading.", FunctionRadixFile); end - $fclose(fp); + $fclose(FunctionRadixFP); // ProgramIndexFile maps the program name to the compile index. @@ -130,28 +130,28 @@ module function_radix(reset, ProgramName); // in the custom radix. // Build an associative array to convert the name to an index. ProgramLineCount = 0; - ProgramFP = $fopen(ProgramIndexFile, "r"); + ProgramIndexFP = $fopen(ProgramIndexFile, "r"); - if (ProgramFP) begin - while (! $feof(ProgramFP)) begin - $fscanf(ProgramFP, "%s\n", ProgramLine); - ProgramBank[ProgramLine] = ProgramLineCount; + if (ProgramIndexFP) begin + while (! $feof(ProgramIndexFP)) begin + $fscanf(ProgramIndexFP, "%s\n", ProgramIndexLine); + ProgramIndexMemory[ProgramIndexLine] = ProgramLineCount; ProgramLineCount = ProgramLineCount + 1; end end else begin $display("Cannot open file %s for reading.", ProgramIndexFile); end - $fclose(ProgramFP); + $fclose(ProgramIndexFP); end always @(pc) begin - bin_search_min(TestAddr, line_count, memory_bank, index); + bin_search_min(TestAddr, FunctionRadixLineCount, FunctionRadixMemory, FunctionRadixName); end // Each time there is a new program update the test number - always @(ProgramName) begin - TestNumber = ProgramBank[ProgramName]; + always @(ProgramIndexName) begin + ProgramIndexTestNumber = ProgramIndexMemory[ProgramIndexName]; end endmodule // function_radix diff --git a/wally-pipelined/testbench/testbench-imperas.sv b/wally-pipelined/testbench/testbench-imperas.sv index 2cf650fd..161491d2 100644 --- a/wally-pipelined/testbench/testbench-imperas.sv +++ b/wally-pipelined/testbench/testbench-imperas.sv @@ -30,7 +30,8 @@ module testbench(); parameter FunctionRadixFile32 = "../../imperas-riscv-tests/FunctionRadix_32.addr"; parameter FunctionRadixFile64 = "../../imperas-riscv-tests/FunctionRadix_64.addr"; parameter ProgramIndexFile = "../../imperas-riscv-tests/ProgramMap.txt"; - + parameter DEBUG = 1; + logic clk; logic reset; @@ -454,20 +455,18 @@ string tests32i[] = { end // always @ (negedge clk) // track the current function or global label - generate - if (`XLEN == 32) begin : functionRadix - function_radix #(.FunctionRadixFile(FunctionRadixFile32), - .ProgramIndexFile(ProgramIndexFile)) - function_radix(.reset(reset), - .ProgramName(testName)); - end else begin : functionRadix - function_radix #(.FunctionRadixFile(FunctionRadixFile64), - .ProgramIndexFile(ProgramIndexFile)) - function_radix(.reset(reset), - .ProgramName(testName)); - end - endgenerate - + if (`XLEN == 32 && DEBUG == 1) begin : functionRadix + function_radix #(.FunctionRadixFile(FunctionRadixFile32), + .ProgramIndexFile(ProgramIndexFile)) + function_radix(.reset(reset), + .ProgramIndexName(testName)); + end else if (`XLEN == 64 && DEBUG == 1) begin : functionRadix + function_radix #(.FunctionRadixFile(FunctionRadixFile64), + .ProgramIndexFile(ProgramIndexFile)) + function_radix(.reset(reset), + .ProgramIndexName(testName)); + end + endmodule /* verilator lint_on STMTDLY */