diff --git a/README.md b/README.md index 559c3e0ee..420ea87a1 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ cd ../addins git clone https://github.com/riscv-non-isa/riscv-arch-test git clone https://github.com/riscv-software-src/riscv-isa-sim cd riscv-isa-sim +cp -r arch_test_target/spike/device/rv32i_m/I arch_test_target/spike/device/rv32i_m/F + mkdir build cd build set RISCV=/cad/riscv/gcc/bin (or whatever your path is) diff --git a/wally-pipelined/regression/regression-wally.py b/wally-pipelined/regression/regression-wally.py index ec06956b3..79532c5c8 100755 --- a/wally-pipelined/regression/regression-wally.py +++ b/wally-pipelined/regression/regression-wally.py @@ -48,6 +48,7 @@ for test in tests64: cmd="vsim > {} -c < lines.find(' logic ')): # // logic does not proceed. logic proceeds. logic // proceeds. + if "[" in lines and "]" in lines:# need to account for these space + NowLoc = lines.find(']') + 3# column number in sv code when 1st char of the var name should appear. + if NowLoc>VarLoc: + VarLoc = NowLoc + VarLineNum = GiantString.index(lines) # Update this number if new record is made. + else: + NowLoc = lines.find('logic') + 7 # same as before. + if NowLoc>VarLoc: + VarLoc = NowLoc + VarLineNum = GiantString.index(lines) + #print("Furthest variable appears on line", VarLineNum + 1,VarLoc) # Disable this line after debugging. + return VarLoc +################################################################################## +def modified_logNew(GS,SOV): #3 + Ind = SOV - 1 # SOV is for human readability, Ind is the character's index in computer, since computers count from 0's we need to correct it. + Out = [] + for l in GS: + lines = l.replace('\t',' ') + + if ' logic ' in lines and (lines.find("//") == -1 or lines.find("//") > lines.find(' logic ')): # // logic does not proceed. logic proceeds. logic // proceeds. + if "[" in lines and "]" in lines: # the line is an extended declaration. + EditLoc = lines.find("]") # Re-finds the string index number of ]. + VarLoc = FindCharRel(lines[EditLoc+1::]) + EditLoc + 1 # Checks where variable declaration currently is at. + #print(VarLoc,lines[VarLoc])# VERIFIED + NewLine = Mod_Space_at(lines,VarLoc,VarLoc-Ind) + Out.append(NewLine)# Verified0957 10272021 + else: + EditLoc1 = lines.find('c') # Hopefully sees the c in 'logic' + + VarLoc1 = FindCharRel(lines[EditLoc1+1::]) + EditLoc1 + 1 + NewLine1 = Mod_Space_at(lines,VarLoc1,VarLoc1-Ind) + + Out.append(NewLine1)# Verified 1005 10272021 + else: + Out.append(lines) + return Out +################################################################################ +def write_to_output(filename,GiantString,OW=True,Lines_editted=None): #4 + """Filename is preferrably passed from the early function calls""" + """GiantString has all the corrected features in the code, each line is a good verilog code line""" + newname = filename + if not OW or OW =='f': #which means no overwrite (create a new file) + Decomposed=filename.split('.') + newname = Decomposed[0] + "_AL." + Decomposed[1] # AL for aligned. + + OutFile = open(newname,'w') # This step should create a new file. + OutFile.writelines(GiantString) + OutFile.close() + print("Success! " + newname + " Now contains an aligned file!") + return newname +################################################################################# + +def FindCharRel(Ln): + #returns the computer location of a character's first occurence + for num in range(len(Ln)): + if Ln[num] != " ": + return num + + +def Mod_Space_at(Ln,loc,diff): + #loc is the varLoc from mln, diff is varLoc - Ind + if diff > 0: # to delete + NewString = Ln[:(loc-diff)] + Ln[loc:] + + if diff < 0: # to add + NewString = Ln[:loc] + (-diff)*" " + Ln[loc:] + if diff == 0: + NewString = Ln + + return NewString + +def main_filehandler(overwrite=False): + for filename in os.listdir(): + if ".py" not in filename: + GiantString = read_input(filename) + SOV = ID_start(GiantString) + ModifiedGS = modified_logNew(GiantString,SOV) + Newname = write_to_output(filename,ModifiedGS,overwrite) + +main_filehandler(True) \ No newline at end of file diff --git a/wally-pipelined/src/ifu/RAsPredictor.sv b/wally-pipelined/src/ifu/RAsPredictor.sv index bde30be54..31f4568d0 100644 --- a/wally-pipelined/src/ifu/RAsPredictor.sv +++ b/wally-pipelined/src/ifu/RAsPredictor.sv @@ -30,21 +30,21 @@ module RASPredictor #(parameter int StackSize = 16 ) - (input logic clk, - input logic reset, - input logic pop, + (input logic clk, + input logic reset, + input logic pop, output logic [`XLEN-1:0] popPC, - input logic push, - input logic incr, + input logic push, + input logic incr, input logic [`XLEN-1:0] pushPC ); - logic CounterEn; + logic CounterEn; localparam Depth = $clog2(StackSize); - logic [Depth-1:0] PtrD, PtrQ, PtrP1, PtrM1; - logic [StackSize-1:0] [`XLEN-1:0] memory; - integer index; + logic [Depth-1:0] PtrD, PtrQ, PtrP1, PtrM1; + logic [StackSize-1:0] [`XLEN-1:0] memory; + integer index; assign CounterEn = pop | push | incr; @@ -56,16 +56,16 @@ module RASPredictor // *** what happens if jal is executing and there is a return being flushed in Decode? flopenr #(Depth) PTR(.clk(clk), - .reset(reset), - .en(CounterEn), - .d(PtrD), - .q(PtrQ)); + .reset(reset), + .en(CounterEn), + .d(PtrD), + .q(PtrQ)); // RAS must be reset. - always_ff @ (posedge clk, posedge reset) begin + always_ff @ (posedge clk) begin if(reset) begin for(index=0; index