diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-02-10 16:26:03 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-02-10 16:26:03 +0100 |
commit | 6c56d89c8db4830418bdd27d5c775a77d0ab462b (patch) | |
tree | b4baba1a3374ca0c8bc139fa1c545cbd113ee795 /vhdl/ice_tb.vhd | |
download | rom-emulator-6c56d89c8db4830418bdd27d5c775a77d0ab462b.tar.gz rom-emulator-6c56d89c8db4830418bdd27d5c775a77d0ab462b.tar.bz2 rom-emulator-6c56d89c8db4830418bdd27d5c775a77d0ab462b.tar.xz rom-emulator-6c56d89c8db4830418bdd27d5c775a77d0ab462b.zip |
wip
Diffstat (limited to 'vhdl/ice_tb.vhd')
-rw-r--r-- | vhdl/ice_tb.vhd | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/vhdl/ice_tb.vhd b/vhdl/ice_tb.vhd new file mode 100644 index 0000000..24916cd --- /dev/null +++ b/vhdl/ice_tb.vhd @@ -0,0 +1,66 @@ +library ieee; +use ieee.std_logic_1164.all; +use work.all; + +entity ice_tb is +end ice_tb; + +architecture ice_tb_arch of ice_tb is + signal bit_in : std_logic; + signal bit_out : std_logic; + signal bit_clk : std_logic := '0'; + signal byte_clk : std_logic := '0'; + signal a_oe : std_logic := '1'; + signal d_oe : std_logic := '1'; + + signal ah : std_logic_vector(7 downto 0); + signal al : std_logic_vector(7 downto 0); + signal d_out : std_logic_vector(7 downto 0); + + constant tClk : time := 1 ns; +begin + ice : entity work.ice port map(bit_in, bit_out, bit_clk, byte_clk, a_oe, d_oe, ah, al, d_out); + + stimulus : process + procedure byte_out(byte : in std_logic_vector(7 downto 0)) is + begin + for i in byte'range loop + bit_in <= byte(i); + bit_clk <= '1'; + wait for tClk; + + bit_clk <= '0'; + wait for tClk; + end loop; + + byte_clk <= '1'; + wait for tClk; + + byte_clk <= '0'; + wait for tClk; + end; + + procedure write_ram( + data : in std_logic_vector(7 downto 0); + address : in std_logic_vector(15 downto 0)) is + begin + -- TODO: busreq + wait for busack + byte_out(data); + byte_out(address(7 downto 0)); + byte_out(address(15 downto 8)); + end; + + begin + write_ram("10100101", "0000000000000001"); + d_oe <= '0'; + a_oe <= '0'; + + wait for tClk; + assert ah = "00000000" report "ah failed"; + assert al = "00000001" report "al failed"; + assert d_out = "10100101" report "d_out failed"; + + assert false report "end of test" severity note; + wait; + end process; +end; |