aboutsummaryrefslogtreecommitdiff
path: root/test/ppu-stm-integration-demo
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-03-30 15:10:17 +0200
committerlonkaars <loek@pipeframe.xyz>2023-03-30 15:10:17 +0200
commit6292c1101121bc8ba2db752cab3cbe41469b29d0 (patch)
treeb8cc9ac68b2c972b67d8aa4c9da84ea8c415a759 /test/ppu-stm-integration-demo
parent54b6ca70a74b3beb1331fd0b0bed28c665ed1f4d (diff)
new spi system
Diffstat (limited to 'test/ppu-stm-integration-demo')
-rwxr-xr-xtest/ppu-stm-integration-demo/data2test.awk15
-rw-r--r--test/ppu-stm-integration-demo/makefile8
2 files changed, 17 insertions, 6 deletions
diff --git a/test/ppu-stm-integration-demo/data2test.awk b/test/ppu-stm-integration-demo/data2test.awk
new file mode 100755
index 0000000..286a388
--- /dev/null
+++ b/test/ppu-stm-integration-demo/data2test.awk
@@ -0,0 +1,15 @@
+#!/bin/awk -f
+BEGIN {
+ print "#pragma once"
+ print "#include <stdint.h>"
+ printf("const uint8_t HH_PPUINTDEMO_ARR[] = { ")
+}
+
+length($1) == 4 && length($2) == 4 {
+ printf "0x"substr($1,1,2)", 0x"substr($1,3,2)", 0x"substr($2,1,2)", 0x"substr($2,3,2)", "
+}
+
+END {
+ printf("};\n") # close array
+ printf("#define HH_PPUINTDEMO_LENGTH %d\n", NR*4) # calculate array length
+}
diff --git a/test/ppu-stm-integration-demo/makefile b/test/ppu-stm-integration-demo/makefile
index 7d7a7c8..2f4b6f4 100644
--- a/test/ppu-stm-integration-demo/makefile
+++ b/test/ppu-stm-integration-demo/makefile
@@ -4,12 +4,8 @@ TARGETS := test-background-color.h test-image.h test-image.tb.vhd
all: $(TARGETS)
-%.h: %.txt
- echo "#pragma once" > $@
- echo "#include <stdint.h>" >> $@
- (printf "#define HH_PPUINTDEMO_LENGTH "; wc -l < $<) >> $@
- tr -d ':' < $< | awk 'BEGIN { printf "const uint16_t HH_PPUINTDEMO_ADDR[] = { " } 1 { printf "0x"$$1", " } END { print "};" }' >> $@
- tr -d ':' < $< | awk 'BEGIN { printf "const uint16_t HH_PPUINTDEMO_DATA[] = { " } 1 { printf "0x"$$2", " } END { print "};" }' >> $@
+%.h: %.txt ./data2test.awk
+ tr -d ':' < $< | ./data2test.awk > $@
test-%.tb.vhd: test-%.txt ./data2vhdltb.awk
tr -d ':' < $< | ./data2vhdltb.awk > $@