aboutsummaryrefslogtreecommitdiff
path: root/basys3/basys3.srcs/spi_tb.vhd
diff options
context:
space:
mode:
Diffstat (limited to 'basys3/basys3.srcs/spi_tb.vhd')
-rw-r--r--basys3/basys3.srcs/spi_tb.vhd607
1 files changed, 389 insertions, 218 deletions
diff --git a/basys3/basys3.srcs/spi_tb.vhd b/basys3/basys3.srcs/spi_tb.vhd
index 8e4b8aa..255f38b 100644
--- a/basys3/basys3.srcs/spi_tb.vhd
+++ b/basys3/basys3.srcs/spi_tb.vhd
@@ -1,3 +1,4 @@
+-- vim: ft=vhdl
library ieee;
library unisim;
@@ -25,7 +26,7 @@ begin
process
begin
- for i in 0 to 10000 loop
+ while true loop
wait for 5 ns;
SYSCLK <= '1';
wait for 5 ns;
@@ -36,227 +37,397 @@ begin
process
begin
- for i in 0 to 2 loop
- -- data = 0b01010110010100001001110011111111 (0x56509cff)
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_DATA <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- end loop;
+ -- -- 0xdc00: 0f0f
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+--
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '0';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+-- 0xffff: ffff
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+--
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+SPI_DATA <= '1';
+wait for 50 ns;
+SPI_CLK <= '1';
+wait for 50 ns;
+SPI_CLK <= '0';
+
+ -- m4 macro expansion (see makefile)
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
- wait for 50 ns;
RESET <= '1';
wait for 50 ns;
RESET <= '0';
-
-
wait; -- stop for simulator
end process;
end;