mirror of
				https://github.com/openhwgroup/cvw
				synced 2025-02-11 06:05:49 +00:00 
			
		
		
		
	Add support for dumping vcd.
This commit is contained in:
		
							parent
							
								
									750fb6bfce
								
							
						
					
					
						commit
						9be0303493
					
				
							
								
								
									
										5
									
								
								bin/wsim
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								bin/wsim
									
									
									
									
									
								
							@ -23,6 +23,7 @@ parser.add_argument("--tb", "-t", help="Testbench", choices=["testbench", "testb
 | 
			
		||||
parser.add_argument("--gui", "-g", help="Simulate with GUI", action="store_true")
 | 
			
		||||
parser.add_argument("--coverage", "-c", help="Code & Functional Coverage", action="store_true")
 | 
			
		||||
parser.add_argument("--args", "-a", help="Optional arguments passed to simulator via $value$plusargs", default="")
 | 
			
		||||
parser.add_argument("--vcd", "-v", help="Generate testbench.vcd", action="store_true")
 | 
			
		||||
args = parser.parse_args()
 | 
			
		||||
print("Config=" + args.config + " tests=" + args.testsuite + " sim=" + args.sim + " gui=" + str(args.gui) + " args='" + args.args + "'")
 | 
			
		||||
 | 
			
		||||
@ -37,6 +38,8 @@ if (args.coverage):
 | 
			
		||||
        print("Coverage option only available for Questa")
 | 
			
		||||
        exit(1)
 | 
			
		||||
 | 
			
		||||
if (args.vcd):
 | 
			
		||||
    args.args += " -DMAKEVCD=1"
 | 
			
		||||
 | 
			
		||||
#  create the output sub-directories.
 | 
			
		||||
WALLY = os.environ.get('WALLY')
 | 
			
		||||
@ -67,6 +70,6 @@ if (args.sim == "questa"):
 | 
			
		||||
elif (args.sim == "verilator"):
 | 
			
		||||
    # PWD=${WALLY}/sim CONFIG=rv64gc TESTSUITE=arch64i
 | 
			
		||||
    print(f"Running Verilator on {args.config} {args.testsuite}")
 | 
			
		||||
    os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite}")
 | 
			
		||||
    os.system(f"/usr/bin/make -C {regressionDir}/verilator WALLYCONF={args.config} TEST={args.testsuite} EXTRA_ARGS='{args.args}'")
 | 
			
		||||
elif (args.sim == "vcs"):
 | 
			
		||||
    print("Running VCS on %s %s", args.config, args.testsuite)
 | 
			
		||||
 | 
			
		||||
@ -6,7 +6,8 @@ OPT=
 | 
			
		||||
PARAMS?=-DVERILATOR=1 --no-trace-top
 | 
			
		||||
NONPROF?=--stats
 | 
			
		||||
VERILATOR_DIR=${WALLY}/sim/verilator
 | 
			
		||||
SOURCE=${WALLY}/config/shared/*.vh ${WALLY}/config/${WALLYCONF} ${WALLY}/src/cvw.sv ${WALLY}/testbench/testbench.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
 | 
			
		||||
SOURCE=${WALLY}/config/shared/*.vh ${WALLY}/config/${WALLYCONF} ${WALLY}/src/cvw.sv ${WALLY}/testbench/*.sv ${WALLY}/testbench/common/*.sv ${WALLY}/src/*/*.sv ${WALLY}/src/*/*/*.sv
 | 
			
		||||
EXTRA_ARGS=
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
WALLYCONF?=rv64gc
 | 
			
		||||
@ -43,8 +44,9 @@ run: wkdir/$(WALLYCONF)_$(TEST)/Vtestbench
 | 
			
		||||
wkdir/$(WALLYCONF)_$(TEST)/Vtestbench: $(SOURCE)
 | 
			
		||||
	verilator \
 | 
			
		||||
	--Mdir wkdir/$(WALLYCONF)_$(TEST) -o Vtestbench \
 | 
			
		||||
	--binary \
 | 
			
		||||
	--binary --trace \
 | 
			
		||||
	$(OPT) $(PARAMS) $(NONPROF) \
 | 
			
		||||
	$(EXTRA_ARGS) \
 | 
			
		||||
	--timescale "1ns/1ns" --timing --top-module testbench  --relative-includes \
 | 
			
		||||
	"-I${WALLY}/config/shared" "-I${WALLY}/config/$(WALLYCONF)" \
 | 
			
		||||
	${WALLY}/sim/verilator/wrapper.c \
 | 
			
		||||
@ -57,6 +59,7 @@ obj_dir_profiling/Vtestbench_$(WALLYCONF): $(DEPENDENCIES)
 | 
			
		||||
	--Mdir obj_dir_profiling -o Vtestbench_$(WALLYCONF) \
 | 
			
		||||
	--binary \
 | 
			
		||||
	--prof-cfuncs $(OPT) $(PARAMS) \
 | 
			
		||||
	$(EXTRA_ARGS) \
 | 
			
		||||
	--timescale "1ns/1ns" --timing --top-module testbench  --relative-includes \
 | 
			
		||||
	$(INCLUDE_PATH) \
 | 
			
		||||
	wrapper.c \
 | 
			
		||||
 | 
			
		||||
@ -225,6 +225,10 @@ module testbench;
 | 
			
		||||
      $display("TEST %s not supported in this configuration", TEST);
 | 
			
		||||
      $finish;
 | 
			
		||||
    end
 | 
			
		||||
`ifdef MAKEVCD
 | 
			
		||||
    $dumpfile("testbench.vcd");
 | 
			
		||||
    $dumpvars;
 | 
			
		||||
`endif
 | 
			
		||||
  end // initial begin
 | 
			
		||||
 | 
			
		||||
  // Model the testbench as an fsm.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user