Line 1... |
Line 1... |
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
|
use std.textio.all;
|
|
|
use work.globals.all;
|
use work.globals.all;
|
|
|
entity testSim is
|
entity testSim is
|
end testSim;
|
end testSim;
|
Line 30... |
Line 31... |
signal reset_manchester, soft_reset, ready_o_buff : std_logic;
|
signal reset_manchester, soft_reset, ready_o_buff : std_logic;
|
|
|
|
|
signal clk_i : std_logic;
|
signal clk_i : std_logic;
|
signal rst_i : std_logic := '1';
|
signal rst_i : std_logic := '1';
|
signal data_i : std_logic;
|
--signal data_i : std_logic;
|
signal ready_o : std_logic;
|
signal ready_o : std_logic;
|
signal character_o : std_logic_vector(0 to 7);
|
signal character_o : std_logic_vector(0 to 7);
|
signal anode_ctrl : std_logic_vector(3 downto 0);
|
signal anode_ctrl : std_logic_vector(3 downto 0);
|
signal button_o : std_logic_vector(1 downto 0);
|
signal button_o : std_logic_vector(1 downto 0);
|
signal parity_o : std_logic;
|
signal parity_o : std_logic;
|
Line 46... |
Line 47... |
constant half_period : time := 10 ns;
|
constant half_period : time := 10 ns;
|
constant period : time := 2*half_period;
|
constant period : time := 2*half_period;
|
constant mid_single : time := (INTERVAL_MIN_SINGLE+INTERVAL_MAX_SINGLE)/2*period;
|
constant mid_single : time := (INTERVAL_MIN_SINGLE+INTERVAL_MAX_SINGLE)/2*period;
|
constant WORD : std_logic_vector(28 downto 0) := "01100101100101010101010101010";
|
constant WORD : std_logic_vector(28 downto 0) := "01100101100101010101010101010";
|
|
|
|
----------Added by Thiag-------------
|
|
file TEST_IP : TEXT open READ_MODE is "six.dat";
|
|
signal data_i : std_ulogic;
|
|
constant BIT_PERIOD : time := 100 us;
|
|
-------------------------------------
|
|
|
begin
|
begin
|
character_o(7) <= '1'; -- turn off decimal point
|
character_o(7) <= '1'; -- turn off decimal point
|
|
|
reset_manchester <= rst_i or soft_reset;
|
reset_manchester <= rst_i or soft_reset;
|
ready_o <= ready_o_buff;
|
ready_o <= ready_o_buff;
|
Line 135... |
Line 142... |
variable counter : integer range 0 to 1023;
|
variable counter : integer range 0 to 1023;
|
begin
|
begin
|
if rst_i = '1' then
|
if rst_i = '1' then
|
char_select <= 0;
|
char_select <= 0;
|
counter := 0;
|
counter := 0;
|
div_clk := '0';
|
--div_clk := '0';
|
soft_reset <= '0';
|
soft_reset <= '0';
|
elsif (clk_i'event and clk_i = '1') then
|
elsif (clk_i'event and clk_i = '1') then
|
-- register the output
|
-- register the output
|
if (ready_o_buff = '1') then
|
if (ready_o_buff = '1') then
|
ud_buff1_reg <= ud_buff1;
|
ud_buff1_reg <= ud_buff1;
|
Line 181... |
Line 188... |
anode_ctrl <= "0111" when 0,
|
anode_ctrl <= "0111" when 0,
|
"1011" when 1,
|
"1011" when 1,
|
"1101" when 2,
|
"1101" when 2,
|
"1110" when 3;
|
"1110" when 3;
|
|
|
|
--process
|
|
--begin
|
|
-- wait for 5*period;
|
|
-- rst_i <= '0';
|
|
|
|
-- -- begin transmission header
|
|
-- data_i <= '1';
|
|
-- wait for 5*MID_SINGLE;
|
|
--
|
|
-- data_i <= '0';
|
|
-- wait for MID_SINGLE;
|
|
-- -- end transmission header
|
|
|
|
-- for i in WORD'left downto 0 loop
|
|
-- data_i <= WORD(i);
|
|
-- wait for MID_SINGLE;
|
|
-- end loop;
|
|
|
|
-- data_i <= '1';
|
|
-- wait for MID_SINGLE;
|
|
--
|
|
-- rst_i <= '1';
|
|
-- wait for 5*period;
|
|
|
|
--end process;
|
|
|
process
|
process
|
|
variable LINE_BUF : LINE;
|
|
variable IP_BIT : BIT;
|
begin
|
begin
|
wait for 5*period;
|
wait for 5*period;
|
rst_i <= '0';
|
rst_i <= '0';
|
|
|
-- begin transmission header
|
while not ENDFILE (TEST_IP) loop
|
data_i <= '1';
|
READLINE (TEST_IP,LINE_BUF);
|
wait for 5*MID_SINGLE;
|
while (LINE_BUF'LENGTH /= 0) loop
|
|
READ(LINE_BUF,IP_BIT);
|
data_i <= '0';
|
data_i <= TO_STDULOGIC(IP_BIT);
|
wait for MID_SINGLE;
|
wait for BIT_PERIOD;
|
-- end transmission header
|
|
|
|
for i in WORD'left downto 0 loop
|
|
data_i <= WORD(i);
|
|
wait for MID_SINGLE;
|
|
end loop;
|
end loop;
|
|
end loop;
|
data_i <= '1';
|
assert (FALSE)
|
wait for MID_SINGLE;
|
report "End of Input Data"
|
|
severity ERROR;
|
rst_i <= '1';
|
|
wait for 5*period;
|
|
|
|
end process;
|
end process;
|
|
|
clock : process
|
clock : process
|
begin
|
begin
|
clk_i <= '1';
|
clk_i <= '1';
|