mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	busybear: preload bootram
thanks to Prof Stine for the .do file commands @kaveh can you check line 201? it does nothing, but things break when I remove that line
This commit is contained in:
		
							parent
							
								
									b36a5614b4
								
							
						
					
					
						commit
						3d82ceffb7
					
				@ -27,11 +27,14 @@ vlib work-busybear
 | 
				
			|||||||
# "Extra checking for conflicts with always_comb done at vopt time"
 | 
					# "Extra checking for conflicts with always_comb done at vopt time"
 | 
				
			||||||
# because vsim will run vopt
 | 
					# because vsim will run vopt
 | 
				
			||||||
vlog +incdir+../config/busybear ../testbench/*.sv ../src/*/*.sv -suppress 2583
 | 
					vlog +incdir+../config/busybear ../testbench/*.sv ../src/*/*.sv -suppress 2583
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# start and run simulation
 | 
					# start and run simulation
 | 
				
			||||||
# remove +acc flag for faster sim during regressions if there is no need to access internal signals
 | 
					# remove +acc flag for faster sim during regressions if there is no need to access internal signals
 | 
				
			||||||
vopt +acc work.testbench_busybear -o workopt 
 | 
					vopt +acc work.testbench_busybear -o workopt 
 | 
				
			||||||
vsim workopt -suppress 8852,12070
 | 
					vsim workopt -suppress 8852,12070
 | 
				
			||||||
 | 
					mem load -startaddress 0 -endaddress 1024 -filltype value -fillradix hex -filldata 0 /testbench_busybear/bootram
 | 
				
			||||||
 | 
					mem load -startaddress 0 -i "/courses/e190ax/busybear_boot/bootmem.txt" -format hex /testbench_busybear/bootram
 | 
				
			||||||
 | 
					
 | 
				
			||||||
view wave
 | 
					view wave
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -177,7 +177,8 @@ module testbench_busybear();
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  logic [`XLEN-1:0] RAM[('h8000000 >> 3):0];
 | 
					  logic [`XLEN-1:0] RAM[('h8000000 >> 3):0];
 | 
				
			||||||
  logic [`XLEN-1:0] bootram[('h2000 >> 3):0];
 | 
					  logic [`XLEN-1:0] bootram[('h2000 >> 3):0];
 | 
				
			||||||
  logic [`XLEN-1:0] readRAM, readPC;
 | 
					  logic [`XLEN-1:0] readRAM;
 | 
				
			||||||
 | 
					  logic [31:0]      readPC;
 | 
				
			||||||
  integer RAMAdr, RAMPC;
 | 
					  integer RAMAdr, RAMPC;
 | 
				
			||||||
  assign RAMAdr = (HADDR - (HADDR > 'h2fff ? 'h80000000 : 'h1000)) >> 3;
 | 
					  assign RAMAdr = (HADDR - (HADDR > 'h2fff ? 'h80000000 : 'h1000)) >> 3;
 | 
				
			||||||
  assign RAMPC = (PCF - (PCF > 'h2fff ? 'h80000000 : 'h1000)) >> 3;
 | 
					  assign RAMPC = (PCF - (PCF > 'h2fff ? 'h80000000 : 'h1000)) >> 3;
 | 
				
			||||||
@ -194,7 +195,7 @@ module testbench_busybear();
 | 
				
			|||||||
  end
 | 
					  end
 | 
				
			||||||
  always @(PCF) begin
 | 
					  always @(PCF) begin
 | 
				
			||||||
    if (PCF >= 'h80000000 && PCF <= 'h87FFFFFF) begin
 | 
					    if (PCF >= 'h80000000 && PCF <= 'h87FFFFFF) begin
 | 
				
			||||||
      readPC = RAM[RAMPC];
 | 
					      readPC = RAM[RAMPC] >> PCF[2] * 32;
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  // there's almost certianly a better way than just copying this, but its simple enough for now:
 | 
					  // there's almost certianly a better way than just copying this, but its simple enough for now:
 | 
				
			||||||
@ -208,8 +209,9 @@ module testbench_busybear();
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  always @(PCF) begin
 | 
					  always @(PCF) begin
 | 
				
			||||||
 | 
					    $write(""); // I know this does nothing, the first instruction doesn't load for me without it
 | 
				
			||||||
    if (PCF >= 'h1000 && PCF <= 'h2FFF) begin
 | 
					    if (PCF >= 'h1000 && PCF <= 'h2FFF) begin
 | 
				
			||||||
      readPC = bootram[RAMPC];
 | 
					      readPC = bootram[RAMPC] >> PCF[2] * 32;
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -431,7 +433,7 @@ module testbench_busybear();
 | 
				
			|||||||
        $display("%0t ps, instr %0d: PC does not equal PC expected: %x, %x", $time, instrs, PCF, pcExpected);
 | 
					        $display("%0t ps, instr %0d: PC does not equal PC expected: %x, %x", $time, instrs, PCF, pcExpected);
 | 
				
			||||||
        `ERROR
 | 
					        `ERROR
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
      if (readPC != InstrF) begin
 | 
					      if ((~speculative) && (readPC != InstrF)) begin
 | 
				
			||||||
        $display("%0t ps, instr %0d: readPC does not equal InstrF: %x, %x", $time, instrs, readPC, InstrF);
 | 
					        $display("%0t ps, instr %0d: readPC does not equal InstrF: %x, %x", $time, instrs, readPC, InstrF);
 | 
				
			||||||
        warningCount += 1;
 | 
					        warningCount += 1;
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user