Line 27... |
Line 27... |
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
LIBRARY ieee;
|
LIBRARY ieee;
|
USE ieee.std_logic_1164.ALL;
|
USE ieee.std_logic_1164.ALL;
|
USE ieee.numeric_std.ALL;
|
USE ieee.numeric_std.ALL;
|
|
|
--USE ieee.textio.ALL;
|
USE std.textio.ALL;
|
|
|
ENTITY testtop IS
|
ENTITY testtop IS
|
END testtop;
|
END testtop;
|
|
|
ARCHITECTURE behavior OF testtop IS
|
ARCHITECTURE behavior OF testtop IS
|
Line 124... |
Line 124... |
-- RXD <= bytetosend(7); wait for bittime;
|
-- RXD <= bytetosend(7); wait for bittime;
|
-- RXD <= '1'; wait for bittime; -- first sixbit 000101
|
-- RXD <= '1'; wait for bittime; -- first sixbit 000101
|
-- wait for waittime;
|
-- wait for waittime;
|
end send_byte;
|
end send_byte;
|
|
|
|
|
BEGIN
|
BEGIN
|
|
|
-- Instantiate the Unit Under Test (UUT)
|
-- Instantiate the Unit Under Test (UUT)
|
uut: top PORT MAP (
|
uut: top PORT MAP (
|
CLK_50M => CLK_50M,
|
CLK_50M => CLK_50M,
|
Line 178... |
Line 177... |
INP => write_byte,
|
INP => write_byte,
|
READY => tx_ready, -- indicates that we may write
|
READY => tx_ready, -- indicates that we may write
|
WR => wrote
|
WR => wrote
|
);
|
);
|
|
|
|
|
-- Stimulus process
|
-- Stimulus process
|
stim_proc: process
|
stim_proc: process
|
|
type bytefile is file of integer; -- TODO: assert 32-bit?
|
|
file rimfile : bytefile;
|
|
variable tapefileword : integer;
|
|
variable tapebytes : signed(31 downto 0);
|
begin
|
begin
|
wait for 1ms;
|
file_open(rimfile, "tapefile.rim", READ_MODE);
|
send_byte("10000101", tx_ready, eot, write_byte, wrote);
|
while not endfile(rimfile) loop
|
send_byte("00111111", tx_ready, eot, write_byte, wrote); -- ignored, as bit 7 is not set
|
--wait for bittime*12;
|
send_byte("10000110", tx_ready, eot, write_byte, wrote);
|
wait until received_byte='1';
|
send_byte("10111000", tx_ready, eot, write_byte, wrote); -- Together 050670
|
-- I seem to be getting 32-bit signed little endian numbers.
|
|
-- Which naturally don't fit in a byte.
|
|
read (rimfile, tapefileword);
|
|
tapebytes := to_signed(tapefileword, 32);
|
|
--report "Read a word, value: " & integer'image(tapefileword);
|
|
|
|
send_byte(std_logic_vector(tapebytes(7 downto 0)), tx_ready, eot, write_byte, wrote);
|
|
wait until received_byte='1';
|
|
send_byte(std_logic_vector(tapebytes(15 downto 8)), tx_ready, eot, write_byte, wrote);
|
|
wait until received_byte='1';
|
|
send_byte(std_logic_vector(tapebytes(23 downto 16)), tx_ready, eot, write_byte, wrote);
|
|
wait until received_byte='1';
|
|
send_byte(std_logic_vector(tapebytes(31 downto 24)), tx_ready, eot, write_byte, wrote);
|
|
|
|
-- send_byte(conv(tapebyte), tx_ready, eot, write_byte, wrote);
|
|
-- send_byte(std_logic_vector(to_signed(integer(tapebyte(0)),8)), tx_ready, eot, write_byte, wrote);
|
|
-- send_byte("10000101", tx_ready, eot, write_byte, wrote);
|
|
-- send_byte("00111111", tx_ready, eot, write_byte, wrote); -- ignored, as bit 7 is not set
|
|
-- send_byte("10000110", tx_ready, eot, write_byte, wrote);
|
|
-- send_byte("10111000", tx_ready, eot, write_byte, wrote); -- Together 050670
|
-- TODO: show reply data
|
-- TODO: show reply data
|
|
end loop;
|
|
file_close(rimfile);
|
|
report "Reached end of RIM (paper tape) file";
|
|
|
wait for CLK_50M_period*10;
|
wait for CLK_50M_period*10;
|
|
|
-- insert stimulus here
|
-- insert stimulus here
|
|
|