<commit_before>
all: parsetab.py

docs:
	doxygen Doxyfile

BOARD=zedboard

parsetab.py: syntax.py
	python syntax.py

test: test-echo/ztop_1.bit.bin.gz test-memcpy/ztop_1.bit.bin.gz test-hdmi/hdmidisplay.bit.bin.gz


#################################################################################################
# Generate bsim and zynq make targets for each test in testnames.
# For test 'foo', we will generate 'foo.bits' and 'foo.bsim'

testnames = echo     \
            echo2    \
            memcpy   \
            memread  \
	    memwrite \
            mempoke  \
            strstr   \
            struct   \
	    ring     \
	    nandsim  \
            flowcontrol

bsimtests = $(addsuffix .bsim, $(testnames))

$(bsimtests):
	rm -fr examples/$(basename $@)/bluesim
	make BOARD=bluesim -C examples/$(basename $@) bsim_exe bsim
	(cd examples/$(basename $@)/bluesim; ./sources/bsim& bsimpid=$$!; echo bsimpid $$bsimpid; ./jni/bsim_exe; retcode=$$?; kill $$bsimpid; exit $$retcode)

zedtests = $(addsuffix .zedboard, $(testnames))

$(zedtests):
	rm -fr examples/$(basename $@)/zedboard
	make BOARD=zedboard -C examples/$(basename $@) all

zedruns = $(addsuffix .zedrun, $(testnames))

$(zedruns):
	(cd consolable; make)
	ZEDBOARD_IPADDR=`consolable/checkip`
	adb connect $(ZEDBOARD_IPADDR)
	ANDROID_SERIAL=$(ZEDBOARD_IPADDR):5555
	echo androidserial= $(ANDROID_SERIAL)
	adb -s $(ZEDBOARD_IPADDR):5555 root
	adb -s $(ZEDBOARD_IPADDR):5555 connect $(ZEDBOARD_IPADDR)
	adb -s $(ZEDBOARD_IPADDR):5555 push `find examples/$(basename $@)/zedboard -name \*.gz` /mnt/sdcard
	adb -s $(ZEDBOARD_IPADDR):5555 push `find examples/$(basename $@)/zedboard -name android_exe | grep libs` /mnt/sdcard
	adb -s $(ZEDBOARD_IPADDR):5555 shell insmod /mnt/sdcard/portalmem.ko
	adb -s $(ZEDBOARD_IPADDR):5555 shell insmod /mnt/sdcard/zynqportal.ko
	adb -s $(ZEDBOARD_IPADDR):5555 shell "gzip -dc /mnt/sdcard/mk*gz >/dev/xdevcfg"
	adb -s $(ZEDBOARD_IPADDR):5555 shell /mnt/sdcard/android_exe

gentests = $(addsuffix .gen, $(testnames))

$(gentests):
	make BOARD=zedboard -C examples/$(basename $@)
	(cd examples/$(basename $@)/zedboard; make android_exe)


kc705tests = $(addsuffix .kc705, $(testnames))

$(kc705tests):
	rm -fr examples/$(basename $@)/kc705
	make BOARD=kc705 -C examples/$(basename $@) all

vc707tests = $(addsuffix .vc707, $(testnames))

$(vc707tests):
	rm -fr examples/$(basename $@)/vc707
	make BOARD=vc707 -C examples/$(basename $@) all


#################################################################################################
# not yet updated.

test-hdmi/hdmidisplay.bit.bin.gz: bsv/HdmiDisplay.bsv
	rm -fr test-hdmi
	./genxpsprojfrombsv -B $(BOARD) -p test-hdmi -x HDMI -b HdmiDisplay bsv/HdmiDisplay.bsv bsv/HDMI.bsv bsv/PortalMemory.bsv
	cd test-hdmi; make verilog && make bits && make hdmidisplay.bit.bin.gz
	echo test-hdmi built successfully
<commit_msg>hack for now to run zedboard<commit_after>
all: parsetab.py

docs:
	doxygen Doxyfile

BOARD=zedboard

parsetab.py: syntax.py
	python syntax.py

test: test-echo/ztop_1.bit.bin.gz test-memcpy/ztop_1.bit.bin.gz test-hdmi/hdmidisplay.bit.bin.gz


#################################################################################################
# Generate bsim and zynq make targets for each test in testnames.
# For test 'foo', we will generate 'foo.bits' and 'foo.bsim'

testnames = echo     \
            echo2    \
            memcpy   \
            memread  \
	    memwrite \
            mempoke  \
            strstr   \
            struct   \
	    ring     \
	    nandsim  \
            flowcontrol

bsimtests = $(addsuffix .bsim, $(testnames))

$(bsimtests):
	rm -fr examples/$(basename $@)/bluesim
	make BOARD=bluesim -C examples/$(basename $@) bsim_exe bsim
	(cd examples/$(basename $@)/bluesim; ./sources/bsim& bsimpid=$$!; echo bsimpid $$bsimpid; ./jni/bsim_exe; retcode=$$?; kill $$bsimpid; exit $$retcode)

zedtests = $(addsuffix .zedboard, $(testnames))

$(zedtests):
	rm -fr examples/$(basename $@)/zedboard
	make BOARD=zedboard -C examples/$(basename $@) all

zedruns = $(addsuffix .zedrun, $(testnames))

$(zedruns):
	(cd consolable; make)
	ZEDBOARD_IPADDR=`consolable/checkip` adb connect $(ZEDBOARD_IPADDR)
	ANDROID_SERIAL=$(ZEDBOARD_IPADDR):5555
	echo androidserial= $(ANDROID_SERIAL)
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 root
	ZEDBOARD_IPADDR=`consolable/checkip` adb $(ZEDBOARD_IPADDR)
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 push `find examples/$(basename $@)/zedboard -name \*.gz` /mnt/sdcard
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 push `find examples/$(basename $@)/zedboard -name android_exe | grep libs` /mnt/sdcard
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 shell insmod /mnt/sdcard/portalmem.ko
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 shell insmod /mnt/sdcard/zynqportal.ko
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 shell "gzip -dc /mnt/sdcard/mk*gz >/dev/xdevcfg"
	ZEDBOARD_IPADDR=`consolable/checkip` adb -s $(ZEDBOARD_IPADDR):5555 shell /mnt/sdcard/android_exe

gentests = $(addsuffix .gen, $(testnames))

$(gentests):
	make BOARD=zedboard -C examples/$(basename $@)
	(cd examples/$(basename $@)/zedboard; make android_exe)


kc705tests = $(addsuffix .kc705, $(testnames))

$(kc705tests):
	rm -fr examples/$(basename $@)/kc705
	make BOARD=kc705 -C examples/$(basename $@) all

vc707tests = $(addsuffix .vc707, $(testnames))

$(vc707tests):
	rm -fr examples/$(basename $@)/vc707
	make BOARD=vc707 -C examples/$(basename $@) all


#################################################################################################
# not yet updated.

test-hdmi/hdmidisplay.bit.bin.gz: bsv/HdmiDisplay.bsv
	rm -fr test-hdmi
	./genxpsprojfrombsv -B $(BOARD) -p test-hdmi -x HDMI -b HdmiDisplay bsv/HdmiDisplay.bsv bsv/HDMI.bsv bsv/PortalMemory.bsv
	cd test-hdmi; make verilog && make bits && make hdmidisplay.bit.bin.gz
	echo test-hdmi built successfully

{'fraction_non_alphanumeric': 0.1999336319893811, 'fraction_numerical': 0.02223328355732537, 'mean_word_length': 4.174248927038627, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6728009', 'n_tokens_mistral': 2403, 'n_tokens_neox': 2241, 'n_words': 482}