Skip to content

Commit

Permalink
import memory access macros #798
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Gardner-Stephen committed Apr 6, 2024
1 parent f9b6ee3 commit 2bfe33f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/vhdl/tb_keypad_i2c.vhdl
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 2bfe33f

Please sign in to comment.