From fa296fbc6fe1c423932189116bd0cb949de0beef Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 30 Mar 2023 17:00:05 +0200 Subject: spi not working on hardware --- test/ppu-stm-integration-demo/data.h | 4 ++-- test/ppu-stm-integration-demo/data2pputb.awk | 16 ++++++++++++++++ test/ppu-stm-integration-demo/data2spitb.awk | 20 ++++++++++++++++++++ test/ppu-stm-integration-demo/data2vhdltb.awk | 16 ---------------- test/ppu-stm-integration-demo/makefile | 9 ++++++--- 5 files changed, 44 insertions(+), 21 deletions(-) create mode 100755 test/ppu-stm-integration-demo/data2pputb.awk create mode 100755 test/ppu-stm-integration-demo/data2spitb.awk delete mode 100755 test/ppu-stm-integration-demo/data2vhdltb.awk (limited to 'test') diff --git a/test/ppu-stm-integration-demo/data.h b/test/ppu-stm-integration-demo/data.h index ac73e66..cdca4a5 100644 --- a/test/ppu-stm-integration-demo/data.h +++ b/test/ppu-stm-integration-demo/data.h @@ -1,5 +1,5 @@ #pragma once -// #include "test-image.h" -#include "test-background-color.h" +#include "test-image.h" +// #include "test-background-color.h" diff --git a/test/ppu-stm-integration-demo/data2pputb.awk b/test/ppu-stm-integration-demo/data2pputb.awk new file mode 100755 index 0000000..db4b53f --- /dev/null +++ b/test/ppu-stm-integration-demo/data2pputb.awk @@ -0,0 +1,16 @@ +#!/bin/awk -f +BEGIN { + printf "\n" + printf "\t\tWEN <= '1';\n" + printf "\n" +} +1 { + printf "\t\tADDR <= x\""$1"\";\n" + printf "\t\tDATA <= x\""$2"\";\n" + printf "\t\twait for 10 ns;\n" + printf "\n" +} +END { + printf "\t\tWEN <= '0';\n" + printf "\n" +} diff --git a/test/ppu-stm-integration-demo/data2spitb.awk b/test/ppu-stm-integration-demo/data2spitb.awk new file mode 100755 index 0000000..6caf9a3 --- /dev/null +++ b/test/ppu-stm-integration-demo/data2spitb.awk @@ -0,0 +1,20 @@ +#!/bin/awk -f +BEGIN { } + +{ + data = strtonum("0x"$1$2) + print "-- 0x"$1": "$2 + + for (i = 0; i < 32; i++) { + print "SPI_DATA <= '"and(rshift(data, 31), 1)"';" + print "wait for 50 ns;" + print "SPI_CLK <= '1';" + print "wait for 50 ns;" + print "SPI_CLK <= '0';" + if (i == 15) print "--" + else print "" + data = lshift(data, 1) + } +} + +END { } diff --git a/test/ppu-stm-integration-demo/data2vhdltb.awk b/test/ppu-stm-integration-demo/data2vhdltb.awk deleted file mode 100755 index db4b53f..0000000 --- a/test/ppu-stm-integration-demo/data2vhdltb.awk +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/awk -f -BEGIN { - printf "\n" - printf "\t\tWEN <= '1';\n" - printf "\n" -} -1 { - printf "\t\tADDR <= x\""$1"\";\n" - printf "\t\tDATA <= x\""$2"\";\n" - printf "\t\twait for 10 ns;\n" - printf "\n" -} -END { - printf "\t\tWEN <= '0';\n" - printf "\n" -} diff --git a/test/ppu-stm-integration-demo/makefile b/test/ppu-stm-integration-demo/makefile index 2f4b6f4..853dd31 100644 --- a/test/ppu-stm-integration-demo/makefile +++ b/test/ppu-stm-integration-demo/makefile @@ -1,14 +1,17 @@ .PHONY: all clean -TARGETS := test-background-color.h test-image.h test-image.tb.vhd +TARGETS := test-background-color.h test-image.h test-image-spi.tb.vhd test-image-ppu.tb.vhd test-background-color-spi.tb.vhd all: $(TARGETS) %.h: %.txt ./data2test.awk tr -d ':' < $< | ./data2test.awk > $@ -test-%.tb.vhd: test-%.txt ./data2vhdltb.awk - tr -d ':' < $< | ./data2vhdltb.awk > $@ +test-%-ppu.tb.vhd: test-%.txt ./data2pputb.awk + tr -d ':' < $< | ./data2pputb.awk > $@ + +test-%-spi.tb.vhd: test-%.txt ./data2spitb.awk + (tr -d ':' < $<; echo "ffff ffff") | ./data2spitb.awk > $@ clean: $(RM) $(TARGETS) -- cgit v1.2.3