#!smake -J 3
#
#
#
# Steps for running the vi tests:
# 
# 1) Edit the SIMV variable below to point to the one you want to use
# 2) cd $ROOT/PR/rdpsim/backend/test/Iosim
# 3) make clobber
# 4) make "targets" 
# 	where targets is either a list of individual targets, or
# 	"small5" for the canonical 5 small tests,
#	"big14" for all 14 of the small tests, or
#	"strips" to run the 18 and 32 bit strips
#       "dither" to run a small dither-passthrough test
#       "undither" to run a small unditerhing test
#       "span" to run the span buffer write/read test
#       "scale" to run the scaling test
#
# 5) cat OutData/Results
#	Errors or successes are printed to this file
#
# Note that doing a "make clobber" will clean out the Results directory
#

PRDEPTH = ../../../..
include $(PRDEPTH)/PRdefs
include $(PRDEPTH)/PRrules

LDIRT = create *.tab *.rgb *.log vcs.key *.rdram OutData/*.tab OutData/*.rgb* OutData/*.log OutData/Results

LD_LIBRARY_PATH = $(VCS)/lib

IOSIM      = $(ROOT)/PR/iosim/src/iosim
MONITOR    = $(ROOT)/PR/rdpsim/backend/monitor
FILTER     = $(ROOT)/PR/rdpsim/backend/filter
VPARSE     = $(ROOT)/PR/rdpsim/backend/vparse
IDIFF      = $(ROOT)/usr/sbin/idiff
RDRAMGCLR  = $(ROOT)/PR/rdpsim/tools/rdramgclr

BASE	   = `basename $@ | sed 's/\..*//'`
RDRAM2TAB  = $(IOSIM) -n $(BASE) $(DEBUG) -f vi_$(BASE).tst -l $(@:tab=log) -s "$(SIMV) $(LOGARGS) +mmap_rdram=$(?:.rdram=) +vitab=$@ $(CBUS_MON)"
UNCOMPRESS = /usr/bsd/uncompress -c N$@.Z > N$@
DIFFVIDEO  = echo -n `date `": " >> $(OUTDATA)/Results ;  $(ROOT)/PR/rdpsim/backend/diffvideo -i $? -g N$@ -n
OUTDATA	   = OutData

#SIMV	   = /hosts/sonya/b/hayes/simv.ipc
#SIMV	   = /hosts/reptile/d/regress/nightly1/PR/hw2/chip/sim/simv2.ipc
#SIMV	   = /hosts/baraka/e/kishor/simv_ipc_gate/simv2.ipc.gates
#SIMV      = /dsk2/ProjReality/simv_ipc_gate/simv2.ipc.gates
#SIMV      = /hosts/reptile/usr/var/tmp/howardc/simv2.ipc
#SIMV      = /a/kluster/simv2.ipc
#SIMV      = /hosts/baraka/a/kluster/simv2.ipc
#SIMV	   = /hosts/reptile/d/regress/nightly1/PR/hw2/chip/sim/simv2.ipc

#SIMV      = /hosts/sonya/hal/mdev2root/PR/rdpsim/test/rdp/simv2.ipc
#SIMV      = /hosts/sonya/d/vcs.dumps/simv2.ipc
#SIMV      = /hosts/philco/disk2/mdev2root/PR/hw2/chip/sim/simv2.ipc
#SIMV      = /hosts/baraka/e/kishor/simv_ipc_gate/simv2.ipc.gates

SIMV       = /hosts/baraka/e/kishor/simv_ipc/simv2.ipc
#SIMV      = /hosts/baraka/e/kishor/simv_ipc_hw1/simv.ipc

LOGARGS	   = # +vi_dump -vcd /d/kluster/vi.dump +startdump=35750 +cyclelimit=45412
DEBUG	   = -d 0x241
CBUS_MON   = # +cbus_mon +mbus_mon

.tab.mem:

default: create tree.rgb stripes.rgb small.rgb

create: create.c
	cc -o create create.c

################################################################################

tri-small16.rdram: tri-small16.cvg
	$(FILTER) -i tri-small16.cvg -d 512 -x tri-small16.rdram

tri-small32.rdram: tri-small32.cvg
	$(FILTER) -i tri-small32.cvg -d 512 -x tri-small32.rdram

t31vworks.rdram: t31vworks.cvg
	$(FILTER) -i t31vworks.cvg -d 512 -x t31vworks.rdram

randtreev16.rdram: test061.61_0v.cvg
	$(FILTER) -i test061.61_0v.cvg -d 512 -x randtreev16.rdram

randtreeh16.rdram: test061.61_0h.cvg
	$(FILTER) -i test061.61_0h.cvg -d 512 -x randtreeh16.rdram

randtreev32.rdram: test063.63_0v.cvg
	$(FILTER) -i test063.63_0v.cvg -d 512 -x randtreev32.rdram

randtreeh32.rdram: test063.63_0h.cvg
	$(FILTER) -i test063.63_0h.cvg -d 512 -x randtreeh32.rdram

scale.rdram: scale.cvg
	$(FILTER) -i scale.cvg -d 512 -x scale.rdram

scalew.rdram: scalew.cvg
	$(FILTER) -i scalew.cvg -d 512 -x scalew.rdram

################################################################################


tree.tab: vi.32-32.tst tree.rdram
	$(IOSIM) -f vi.32-32.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tree +vitab=tree.tab +mbus_mon"

tree.rgb: tree.tab
	$(MONITOR) -i tree.tab -h 0x00200040 -v 0x00050045 -o tree.rgb 

tree-i.tab: vi.32-32i.tst tree.rdram
	$(IOSIM) -f vi.32-32i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tree +vitab=tree-i.tab +mbus_mon"

tree-i.rgb: tree-i.tab
	$(MONITOR) -i tree-i.tab -h 0x00200040 -v 0x00050025 -o tree-i.rgb 

htree.tab: vi.32-16.tst tree.rdram
	$(IOSIM) -f vi.32-16.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tree +vitab=htree.tab +mbus_mon"

htree.rgb: htree.tab
	$(MONITOR) -i htree.tab -h 0x00200040 -v 0x00050025 -o htree.rgb 


ltri.tab: vi.32-32.tst tri.rdram
	$(IOSIM) -f vi.32-32.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri +vitab=ltri.tab +mbus_mon"

ltri.rgb: ltri.tab
	$(MONITOR) -i ltri.tab -h 0x00200040 -v 0x00050045 -o ltri.rgb 

stripes.tab: vi.32-32.tst stripes.rdram
	$(IOSIM) -f vi.32-32.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=stripes +vitab=stripes.tab +mbus_mon"

stripes.rgb: stripes.tab
	$(MONITOR) -i stripes.tab -h 0x00200040 -v 0x00050045 -o stripes.rgb 

small.tab: vi.32-4.tst stripes.rdram
	$(IOSIM) -f vi.32-4.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=stripes +vitab=small.tab +mbus_mon"

small.rgb: small.tab
	$(MONITOR) -i small.tab -h 0x00200040 -v 0x0005000d -o small.rgb 

stri.tab: vi.32-4.tst tri.rdram
	$(IOSIM) -f vi.32-4.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri +vitab=stri.tab +mbus_mon +vi_dump -vcd /var/tmp/kluster/stri.dump"

stri.rgb: stri.tab
	$(MONITOR) -i stri.tab -h 0x00200040 -v 0x0005000d -o stri.rgb 

donut.tab: vi.320-240.tst t31vworks.rdram
	$(IOSIM) -f vi.320-240.tst -s "$(SIMVDIR)/simv.gipc +mmap_rdram=t31vworks +vitab=donut.tab +mbus_mon"

donut.rgb: donut.tab
	$(MONITOR) -i donut.tab -h 0x00200160 -v 0x001501f5 -o donut.rgb 

stri-i.tab: vi.32-4i.tst tri.rdram
	$(IOSIM) -f vi.32-4i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri +vitab=stri-i.tab +mbus_mon +vi_dump -vcd /var/tmp/kluster/stri-i.dump"

stri-i.rgb: stri-i.tab
	$(MONITOR) -i stri-i.tab -h 0x00200040 -v 0x0005000d -o stri-i.rgb 

small-i.tab: vi.32-4i.tst stripes.rdram
	$(IOSIM) -f vi.32-4i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=stripes +vitab=small-i.tab +mbus_mon"

small-i.rgb: small-i.tab
	$(MONITOR) -i small-i.tab -h 0x00200040 -v 0x0005000d -o small-i.rgb 

foo-i.tab: vi.32-32i.tst foo.rdram
	$(IOSIM) -f vi.32-32i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=foo +vitab=foo-i.tab +mbus_mon"

foo-i.rgb: foo-i.tab
	$(MONITOR) -i foo-i.tab -h 0x00200040 -v 0x00050025 -o foo-i.rgb 

narrow.tab: vi.32-240.tst narrow.rdram
	$(IOSIM) -f vi.32-240.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=narrow +vitab=narrow.tab +mbus_mon"

narrow.rgb: narrow.tab
	$(MONITOR) -i narrow.tab -h 0x00200040 -v 0x001501f5 -o narrow.rgb 

test031.31_0-small.tab: vi.32-32-16.tst test031.31_0-small.rdram
	$(IOSIM) -f vi.32-32-16.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=test031.31_0-small +vitab=test031.31_0-small.tab +mbus_mon"

test031.31_0-small.rgb: test031.31_0-small.tab
	$(MONITOR) -i test031.31_0-small.tab -h 0x00200040 -v 0x00050045 -o test031.31_0-small.rgb 

test031.31_0.tab: vi.320-240.tst test031.31_0.rdram
	$(IOSIM) -f vi.320-240.tst -s "$(SIMVDIR)/simv.gipc +mmap_rdram=test031.31_0 +vitab=test031.31_0.tab +mbus_mon"

test031.31_0.rgb: test031.31_0.tab
	$(MONITOR) -i test031.31_0.tab -h 0x00200160 -v 0x001501f5 -o test031.31_0.rgb 

fuckup.tab: vi.32-16-18.tst tri-small16.rdram
	$(IOSIM) -f vi.32-16-18.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +vitab=fuckup.tab +mbus_mon"

fuckup.rgb: fuckup.tab
	$(MONITOR) -i fuckup.tab -h 0x00200040 -v 0x00050025 -o fuckup.rgb 

footest.tab: vi.32-32-32foo.tst footest.rdram
	$(IOSIM) -f vi.32-32-32foo.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=footest +vitab=footest.tab +mbus_mon"

footest.rgb: footest.tab
	$(MONITOR) -i footest.tab -h 0x00200040 -v 0x00050045 -o footest.rgb 

bartest.tab: vi.320-2-32.tst t31vworks.rdram
	$(IOSIM) -f vi.320-2-32.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=t31vworks +vitab=bartest.tab +mbus_mon"

bartest.rgb: bartest.tab
	$(MONITOR) -i bartest.tab -h 0x00200040 -v 0x00050045 -o bartest.rgb 

t31vworks-slice.tab: vi.32-240-18-2.2i.tst t31vworks-slice.rdram
	$(IOSIM) -f vi.32-240-18-2.2i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=t31vworks-slice +vitab=t31vworks-slice.tab +mbus_mon""

t31vworks-slice.rgb: t31vworks-slice.tab
	$(MONITOR) -i t31vworks-slice.tab -h 0x00200040 -v 0x000500f5 -o t31vworks-slice.rgb 

checker.tab: vi.32-32.tst checker.rdram
	$(IOSIM) -f vi.32-32.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=checker +vitab=checker.tab +mbus_mon"

checker.rgb: checker.tab
	$(MONITOR) -i checker.tab -h 0x00200040 -v 0x00050045 -o checker.rgb 

blah.tab: vi.32-32-2.2i.tst blah.rdram
	$(IOSIM) -f vi.32-32-2.2i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=blah +vitab=blah.tab +mbus_mon"

blah.rgb: blah.tab
	$(MONITOR) -i blah.tab -h 0x00200040 -v 0x00050025 -o blah.rgb 

grok240.tab: vi.32-240-18-2.2i.tst grok.rdram
	$(IOSIM) -f vi.32-240-18-2.2i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=grok +vitab=grok240.tab +mbus_mon"

grok240.rgb: grok240.tab
	$(MONITOR) -i grok240.tab -h 0x00200040 -v 0x000500f5 -o grok240.rgb 

grok32.tab: vi.32-32-18-2.2i.tst grok.rdram
	$(IOSIM) -f vi.32-32-18-2.2i.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=grok +vitab=grok32.tab +mbus_mon"

grok32.rgb: grok32.tab
	$(MONITOR) -i grok32.tab -h 0x00200040 -v 0x00050025 -o grok32.rgb 

bigdata.tab: vi.bigdata.tst bigdata.rdram
	$(IOSIM) -f vi.bigdata.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=bigdata +vitab=bigdata.tab +mbus_mon +vi_dump -vcd /var/tmp/kluster/bigdata.dump"

bigdata.rgb: bigdata.tab
	$(VPARSE)  -i bigdata.tab -o big5.tab -f 2	
	$(MONITOR) -i big5.tab000 -o Nlan1.rgb -h 0x00200044 -v 0x0050025
	$(MONITOR) -i big5.tab001 -o Nlan2.rgb -h 0x00200044 -v 0x0050025
	$(MONITOR) -i big5.tab002 -o Nlpn1.rgb -h 0x00200040 -v 0x0050025
	$(MONITOR) -i big5.tab003 -o Nhan1.rgb -h 0x00200044 -v 0x0050025
	$(MONITOR) -i big5.tab004 -o Nhpf2.rgb -h 0x00200044 -v 0x0050025
	$(IDIFF) Nlan1.rgb lan1.rgb
	$(IDIFF) Nlan2.rgb lan2.rgb
	$(IDIFF) Nlpn1.rgb lpn1.rgb
	$(IDIFF) Nhan1.rgb han1.rgb
	$(IDIFF) Nhpf2.rgb hpf2.rgb


dump: vi_dump.tst tri-small16.rdram
	$(IOSIM) -f vi_dump.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +cbus_mon +vi_dump -vcd /usr/tmp/pg/verilog.dump"

dump2: vi_dump2.tst tri-small32.rdram
	$(IOSIM) -f vi_dump2.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small32 +cbus_mon +vi_dump -vcd /usr/tmp/pg/verilog.dump"

###########################################################################################
#
# Big 14 tests
# 

big14: lan1.rgb lan2.rgb laf1.rgb laf2.rgb lpn1.rgb lpn2.rgb lpf1.rgb lpf2.rgb han1.rgb haf1.rgb hpn1.rgb hpn2.rgb hpf1.rgb hpf2.rgb 

small5: lan1.rgb lan2.rgb lpn1.rgb han1.rgb hpf2.rgb 

$(OUTDATA)/lan1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/lan2.tab: tri-small32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/laf1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/laf2.tab: tri-small32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/lpn1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/lpn2.tab: tri-small32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/lpf1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/lpf2.tab: tri-small32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/han1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/haf1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/hpn1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/hpn2.tab: tri-small32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/hpf1.tab: tri-small16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/hpf2.tab: tri-small32.rdram
	$(RDRAM2TAB)

lan1.rgb: $(OUTDATA)/lan1.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

lan2.rgb: $(OUTDATA)/lan2.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

laf1.rgb: $(OUTDATA)/laf1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

laf2.rgb: $(OUTDATA)/laf2.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

lpn1.rgb: $(OUTDATA)/lpn1.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x00050025 >> $(OUTDATA)/Results

lpn2.rgb: $(OUTDATA)/lpn2.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x00050025 >> $(OUTDATA)/Results

lpf1.rgb: $(OUTDATA)/lpf1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x00050025 >> $(OUTDATA)/Results

lpf2.rgb: $(OUTDATA)/lpf2.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

han1.rgb: $(OUTDATA)/han1.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

haf1.rgb: $(OUTDATA)/haf1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

hpn1.rgb: $(OUTDATA)/hpn1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x00050025 >> $(OUTDATA)/Results

hpn2.rgb: $(OUTDATA)/hpn2.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

hpf1.rgb: $(OUTDATA)/hpf1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

hpf2.rgb: $(OUTDATA)/hpf2.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

# End of big 14 tests
#
###########################################################################################


###########################################################################################
# Horizontal/vertical strip tests
#

strips:	h18.rgb h32.rgb v18.rgb v32.rgb

$(OUTDATA)/h18.tab:  randtreeh16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/h32.tab:  randtreeh32.rdram
	$(RDRAM2TAB)

$(OUTDATA)/v18.tab:  randtreev16.rdram
	$(RDRAM2TAB)

$(OUTDATA)/v32.tab:  randtreev32.rdram
	$(RDRAM2TAB)

h18.rgb: $(OUTDATA)/h18.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200160 -v 0x00050025 >> $(OUTDATA)/Results

h32.rgb: $(OUTDATA)/h32.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200160 -v 0x00050025 >> $(OUTDATA)/Results

v18.rgb: $(OUTDATA)/v18.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x000500f5 >> $(OUTDATA)/Results

v32.rgb: $(OUTDATA)/v32.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x000500f5 >> $(OUTDATA)/Results

#
# End of Horizontal/vertical strip tests
###########################################################################################

# This is the span buffer test

span: span.rgb

$(OUTDATA)/span.tab: tri-small16.rdram
	$(RDRAM2TAB)
	
span.rgb: $(OUTDATA)/span.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200040 -v 0x00050025 >> $(OUTDATA)/Results

##########################################################################################

# Qsim Tab file targets

test000.tab.Z: vi_lan1.tst tri-small16.rdram
	$(IOSIM) -f vi_lan1.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small16 +cbus_mon +vi_dump"
	mv vi.tab test000.tab
	compress -f test000.tab

vi.tab: vi_lan1.tst tri-small16.rdram
	$(IOSIM) -f vi_lan1.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small16 +cbus_mon"



fullpath.tab: $(_FORCE)
	$(RDRAMGCLR) test022.22
	$(IOSIM) -f rdp_vi.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=test022.22 +vitab=fullpath.tab +mbus_mon"

fullpath.rgb: $(_FORCE)
	$(MONITOR) -i fullpath.tab -h 0x00200160 -v 0x001501f5 -o fullpath.rgb 
	
mhan1.tab: vi_mhan1.tst tri-small16.rdram
	$(IOSIM) -d 0x241 -f vi_mhan1.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +vitab=mhan1.tab +vi_dump -vcd /var/tmp/kluster/mhan1.dump"

mhan1.rgb: mhan1.tab
	$(MONITOR) -i mhan1.tab -h 0x00200040 -v 0x00050007 -o mhan1.rgb 

# This is the span buffer test
nhan1.tab: vi_nhan1.tst tri-small16.rdram
	$(IOSIM) -d 0x241 -f vi_nhan1.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +vitab=nhan1.tab +vi_dump -vcd /var/tmp/kluster/nhan1.dump"

nhan1.rgb: nhan1.tab
	$(MONITOR) -i nhan1.tab -h 0x00200040 -v 0x00050025 -o nhan1.rgb 

srw: $(_FORCE)
	$(IOSIM) -d 0x241 -f srw.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16"


fhan1.tab: vi_fhan1.tst tri-small16.rdram
	$(IOSIM) -d 0x241 -f vi_fhan1.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +vitab=fhan1.tab +vi_dump -vcd /var/tmp/kluster/fhan1.dump"

fhan1.rgb: fhan1.tab
	$(MONITOR) -i fhan1.tab -h 0x00200040 -v 0x00050025 -o fhan1.rgb 

zhan1.tab: vi_zhan1.tst tri-small16.rdram
	$(IOSIM) -d 0x241 -f vi_zhan1.tst -l io.log -s "$(SIMVDIR)/simv.gipc +mmap_rdram=tri-small16 +vitab=zhan1.tab +vi_dump -vcd /var/tmp/kluster/zhan1.dump"

zhan1.rgb: zhan1.tab
	$(MONITOR) -i zhan1.tab -h 0x00200040 -v 0x00050025 -o zhan1.rgb 


# Qsim Tab file targets

vi000.tab: vi_lan1.tst tri-small16.rdram
	$(IOSIM) -f vi_lan1.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small16 +cbus_mon"
	mv vi.tab vi000.tab

vi001.tab: vi_lan2.tst tri-small32.rdram
	$(IOSIM) -f vi_lan2.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small32 +cbus_mon"
	mv vi.tab vi001.tab

vi002.tab: vi_lpn1.tst tri-small16.rdram
	$(IOSIM) -f vi_lpn1.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small16 +cbus_mon"
	mv vi.tab vi002.tab

vi003.tab: vi_han1.tst tri-small16.rdram
	$(IOSIM) -f vi_han1.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small16 +cbus_mon"
	mv vi.tab vi003.tab

vi004.tab: vi_hpf2.tst tri-small32.rdram
	$(IOSIM) -f vi_hpf2.tst -l io.log -s "$(SIMVDIR)/simv.ipc +mmap_rdram=tri-small32 +cbus_mon"
	mv vi.tab vi004.tab



vi005.tab: vi.32-240-18i.tst randtreev16.rdram
	$(IOSIM) -f vi.32-240-18i.tst -l io.log -s "$(SIMVDIR)/simv.ipc +vitab=vi005t.tab +mmap_rdram=randtreev16 +cbus_mon"
	- mv vi.tab vi005.tab

vi005.rgb: vi005.tab
	$(MONITOR) -i vi005t.tab -h 0x00200040 -v 0x000500f5 -o vi005.rgb 

vi006.tab: vi.320-32-18i.tst randtreeh16.rdram
	$(IOSIM) -f vi.320-32-18i.tst -l io.log -s "$(SIMVDIR)/simv.ipc +vitab=vi006t.tab +mmap_rdram=randtreeh16 +cbus_mon"
	- mv vi.tab vi006.tab

vi006.rgb: vi006.tab
	$(MONITOR) -i vi006t.tab -h 0x00200160 -v 0x00050025 -o vi006.rgb 


vi007.tab: vi.32-240-32i.tst randtreev32.rdram
	$(IOSIM) -f vi.32-240-32i.tst -l io.log -s "$(SIMVDIR)/simv.ipc +vitab=vi007t.tab +mmap_rdram=randtreev32 +cbus_mon"
	- mv vi.tab vi007.tab

vi007.rgb: vi007.tab
	$(MONITOR) -i vi007t.tab -h 0x00200040 -v 0x000500f5 -o vi007.rgb 

vi008.tab:  vi.320-32-32i.tst randtreeh32.rdram
	$(IOSIM) -f vi.320-32-32i.tst  -l io.log -s "$(SIMVDIR)/simv.ipc +vitab=vi008t.tab +mmap_rdram=randtreeh32 +cbus_mon"
	- mv vi.tab vi008.tab

vi008.rgb: vi008.tab
	$(MONITOR) -i vi008t.tab -h 0x00200160 -v 0x00050025 -o vi008.rgb 


###########################################################################################
#
# New dither tests
# 

UDMONITOR = $(MONITOR) -i $? -o $@ -h 0x00200044 -v 0x00050025 

dither:   mdlan2.rgb 
undither: mulan2.rgb

mtri32.rdram: mtri32.cvg
	$(FILTER) -i $? -d 512 -x $@

#
# dither tests
#

$(OUTDATA)/mdlan2.tab: mtri32.rdram
	$(RDRAM2TAB)

mdlan2.rgb: $(OUTDATA)/mdlan2.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

#
# undither tests
#

$(OUTDATA)/mulan2.tab: mtri32.rdram
	$(RDRAM2TAB)

mulan2.rgb: $(OUTDATA)/mulan2.tab 
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200044 -v 0x00050025 >> $(OUTDATA)/Results

$(OUTDATA)/foolan2.tab: mtri32.rdram
	$(RDRAM2TAB)

FOOMONITOR = $(MONITOR) -i $? -o $@ -h 0x00200040 -v 0x00050045 

foolan2.rgb: $(OUTDATA)/foolan2.tab 
	- $(FOOMONITOR)


#
# animation undither tests
#

# these tests run 4 frames of Howard's 16 triangle rdp
# dither test through the backend filter to test the
# undithering and antialiasing. Their .tst files have
# undither turned on, divot_removal turned off. They
# should diff pixel for pixel with the output of a
# filter -u

anundither: a0lan1.rgb a1lan1.rgb a2lan1.rgb a3lan1.rgb


ANMONITOR   = - $(MONITOR) -i $? -o $@ -h 0x00200160 -v 0x001501f5 
CVGTORDRAM  = $(FILTER) -i $? -d 512 -x $@

an0_16.rdram: anidither.0_0.cvg
	$(CVGTORDRAM)

$(OUTDATA)/a0lan1.tab: an0_16.rdram
	$(RDRAM2TAB)

a0lan1.rgb: $(OUTDATA)/a0lan1.tab 
	$(ANMONITOR)


an1_16.rdram: anidither.1_0.cvg
	$(CVGTORDRAM)

$(OUTDATA)/a1lan1.tab: an1_16.rdram
	$(RDRAM2TAB)

a1lan1.rgb: $(OUTDATA)/a1lan1.tab 
	$(ANMONITOR)


an2_16.rdram: anidither.2_0.cvg
	$(CVGTORDRAM)

$(OUTDATA)/a2lan1.tab: an2_16.rdram
	$(RDRAM2TAB)

a2lan1.rgb: $(OUTDATA)/a2lan1.tab 
	$(ANMONITOR)


an3_16.rdram: anidither.3_0.cvg
	$(CVGTORDRAM)

$(OUTDATA)/a3lan1.tab: an3_16.rdram
	$(RDRAM2TAB)

a3lan1.rgb: $(OUTDATA)/a3lan1.tab 
	$(ANMONITOR)


###########################################################################################
#
# New video scaling tests
# 
SCALEMONITOR = - $(MONITOR) -i $? -o $(OUTDATA)/$@ -h 0x00200044 -v 0x00050025 
SCALEWMONITOR= - $(MONITOR) -i $? -o $(OUTDATA)/$@ -h 0x00200160 -v 0x00050025 

# these two narrow tests are worthless because the scaling causes
# the black bands to grow past the valid video data. 

$(OUTDATA)/scale-1.tab: scale.rdram
	$(RDRAM2TAB)

scale-1.rgb: $(OUTDATA)/scale-1.tab 
	$(SCALEMONITOR)        	

$(OUTDATA)/scale-2.tab: scale.rdram
	$(RDRAM2TAB)

scale-2.rgb: $(OUTDATA)/scale-2.tab 
	$(SCALEMONITOR)        	

##########
# wide video tests

scale: scalew-1.rgb

$(OUTDATA)/scalew-1.tab:  scalew.rdram
	$(RDRAM2TAB)

scalew-1.rgb: $(OUTDATA)/scalew-1.tab
	$(UNCOMPRESS)
	- $(DIFFVIDEO) -h 0x00200160 -v 0x00050025 >> $(OUTDATA)/Results	

# exactly the same as scalew-1, just here so I can run 
# different versions of the hardware at the same time
$(OUTDATA)/scalew-2.tab:  scalew.rdram
	$(RDRAM2TAB)

scalew-2.rgb: $(OUTDATA)/scalew-2.tab
	$(SCALEWMONITOR) 

############################################################################
#
# all the vi regression tests:
#

allvi: big14 strips dither undither span scale


