AOP_HOME ?= ../../aop_pkg/
CODE_KIND ?= "vifs"

all: work compile_aop compile_smp compile_vip compile_dut compile_integration create_stub sim

work:
	vlib work

compile_aop:
	vlog +incdir+$(UVM_HOME)/src $(AOP_HOME)/sv/aop_package.sv

compile_smp:
	vlog +incdir+$(UVM_HOME)/src +incdir+../sv/ ../sv/smp_package.sv

compile_vip:
	vlog +incdir+$(UVM_HOME)/src +incdir+../examples/ ../examples/tb/vip.sv

compile_dut:
	vlog -novopt ../examples/DUT/verilog/verilog_block.v
	vlog -novopt ../examples/DUT/verilog/verilog_top.v
	vcom -novopt ../examples/DUT/vhdl/vhdl_block.vhd
	vcom -novopt ../examples/DUT/vhdl/vhdl_top.vhd

compile_integration:
	vlog +incdir+$(UVM_HOME)/src +incdir+../examples/tb/ ../examples/tb/vip_integration.sv
	vlog +incdir+$(UVM_HOME)/src ../examples/tb/tb.sv

create_stub:
	vsim +GENERATE_STUB +GENERATED_CODE=$(CODE_KIND) -suppress 8451 -novopt +UVM_TESTNAME=test_base tb -c -do "run 0; quit -f"
	vlog -novopt stub.sv

create_stub_debug:
	vsim +GENERATE_STUB +GENERATED_CODE=$(CODE_KIND) -suppress 8451 -novopt +UVM_TESTNAME=test_base tb -gui

sim:
	vsim -c -novopt -do "run 10" +UVM_TESTNAME=test_base +GENERATED_CODE=$(CODE_KIND) -suppress 8451 tb verilog_top vhdl_top stub

sim_debug:
	vsim -novopt -do "run 10" +UVM_TESTNAME=test_base +GENERATED_CODE=$(CODE_KIND) -suppress 8451 tb verilog_top vhdl_top stub


clean:
	rm -rf work *.wlf transcript stub* instantiate_interfaces* wlf*

