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.vhd385
1 files changed, 194 insertions, 191 deletions
diff --git a/basys3/basys3.srcs/spi_tb.vhd b/basys3/basys3.srcs/spi_tb.vhd
index a8aa8c2..f6e2d21 100644
--- a/basys3/basys3.srcs/spi_tb.vhd
+++ b/basys3/basys3.srcs/spi_tb.vhd
@@ -36,197 +36,200 @@ begin
spi_data: process
begin
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '0';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
-
- SPI_MOSI <= '1';
- wait for 50 ns;
- SPI_CLK <= '1';
- wait for 50 ns;
- SPI_CLK <= '0';
+ for i in 0 to 2 loop
+ -- data = 0b01010110010100001001110011111111 (0x56509cff)
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '0';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+
+ SPI_MOSI <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '1';
+ wait for 50 ns;
+ SPI_CLK <= '0';
+ end loop;
wait for 50 ns;
SPI_CLK <= '1';