From 2bfe33f4f5ec318cf8fe8ba67159bffbaf3b8626 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Sat, 6 Apr 2024 10:53:25 +1030 Subject: [PATCH] import memory access macros #798 --- src/vhdl/tb_keypad_i2c.vhdl | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/vhdl/tb_keypad_i2c.vhdl b/src/vhdl/tb_keypad_i2c.vhdl index 9ea6b9aaa..2897a15a7 100644 --- a/src/vhdl/tb_keypad_i2c.vhdl +++ b/src/vhdl/tb_keypad_i2c.vhdl @@ -73,6 +73,40 @@ begin end procedure; + procedure POKE(a : unsigned(15 downto 0); v : unsigned(7 downto 0)) is + begin + cs <= '1'; + fastio_addr(7 downto 0) <= a(7 downto 0); + fastio_wdata <= v; + fastio_write <= '1'; + for i in 1 to 4 loop + clock_tick; + end loop; + fastio_write <= '0'; + cs <= '0'; + end procedure; + + procedure PEEK(a : unsigned(15 downto 0)) is + begin + cs <= '1'; + fastio_addr(7 downto 0) <= a(7 downto 0); + fastio_read <= '1'; + for i in 1 to 8 loop + clock_tick; + end loop; + fastio_read <= '0'; + cs <= '0'; + end procedure; + + procedure wait_a_while(t : integer) is + begin + -- Allow time for everything to happen + for i in 1 to t loop + clock_tick; + end loop; + report "Waited for " & integer'image(t) & " ticks."; + end procedure; + begin test_runner_setup(runner, runner_cfg);