this is basically to see if the arbiter works correctly and it enters a busy state
after the fetch was accepted.
signal pc_spalte : hspalte;
signal pc_get, pc_done : std_logic;
signal pc_char : hbyte;
+ signal pc_busy : std_logic;
--dummy button
signal btn_a_int : std_logic;
pc_spalte => pc_spalte,
pc_zeile => pc_zeile,
pc_char => pc_char,
+ pc_busy => pc_busy,
pc_done => pc_done
);
rx_data => (others => '0'),
rx_new => '0',
-- History
- pc_zeile => pc_zeile,
- pc_spalte => pc_spalte,
- pc_get => pc_get,
- pc_done => pc_done,
- pc_char => pc_char
+ pc_zeile => pc_zeile,
+ pc_spalte => pc_spalte,
+ pc_get => pc_get,
+ pc_done => pc_done,
+ pc_char => pc_char,
+ pc_busy => pc_busy
);
process
btn_pressed : process is
begin
- btn_a_int <= '0';
+ btn_a_int <= '1';
wait until sys_res_n = '1';
wait for 50000 * 15 ns;
wait until rising_edge(sys_clk);
- btn_a_int <= '1';
- wait for 30 ns;
btn_a_int <= '0';
+ wait for 30 ns;
+ btn_a_int <= '1';
wait;
end process btn_pressed;
end architecture sim;
signal rx_new : std_logic;
signal pc_get : std_logic;
signal pc_done : std_logic;
+ signal pc_busy : std_logic;
signal rx_data, tx_data : std_logic_vector(7 downto 0);
signal pc_zeile : hzeile;
pc_spalte => pc_spalte,
pc_get => pc_get,
pc_done => pc_done,
+ pc_busy => pc_busy,
pc_char => pc_char
);
stub_history : process
file f : text open read_mode is "../../src/pc_communication.test";
- --variable rb : hbyte;
variable rb : character;
variable good : boolean;
variable i : integer;
variable buf : my_string;
variable l : line;
begin
- --take control of the situation.
pc_char <= (others => '0');
pc_done <= '0';
+ pc_busy <= '0';
wait until sys_res_n = '1';
while not endfile (f) loop
while i < l'length loop
pc_done <= '0';
wait until rising_edge(pc_get);
+ wait for 90 ns;
+ pc_busy <= '1';
pc_char <= (others => '0');
wait for 300 ns;
pc_char <= hbyte(std_logic_vector(to_unsigned(character'pos(buf(i)),8)));
i := i + 1;
+ pc_busy <= '0';
pc_done <= '1';
wait for 30 ns;
-
end loop;
end loop;
-- init & reset
-- we only simulate pressing of button a by now!
sys_res_n <= '0';
- btn_a <= '0';
+ btn_a <= '1';
rx_data <= ( others => '0');
rx_new <= '0';
wait for 90 ns;
sys_res_n <= '1';
wait for 30 ns;
- btn_a <= '1';
- wait for 30 ns;
btn_a <= '0';
+ wait for 30 ns;
+ btn_a <= '1';
wait;
--wait for 1000 ns;
--assert false report "test beendet" severity failure;
signal pc_zeile : hzeile;
signal pc_char : hbyte;
signal pc_done : std_logic;
+ signal pc_busy : std_logic;
-- parser/scanner
signal do_it, finished : std_logic;
-- debouncing
pc_spalte => pc_spalte,
pc_zeile => pc_zeile,
pc_char => pc_char,
+ pc_busy => pc_busy,
pc_done => pc_done
);
pc_zeile => pc_zeile,
pc_spalte => pc_spalte,
pc_get => pc_get,
+ pc_busy => pc_busy,
pc_done => pc_done,
pc_char => pc_char
);
-- 50 zeilen * 71 zeichen * 2 (berechnung + ergebnis) = 7100 bytes
constant hspalte_max : integer := 71;
- constant hzeile_max : integer := 50;
+ constant hzeile_max : integer := 100;
constant H_RAM_SIZE : integer := 7100;
constant H_RAM_WIDTH : integer := log2c(H_RAM_SIZE);
subtype hspalte is std_logic_vector(6 downto 0);
pc_char_int <= (others => '0');
pc_done_int <= '0';
+ pc_busy_int <= '0';
address_int <= (0 => '1', others => '0');
data_in_int <= x"00";
pc_char_int <= pc_char_next;
pc_done_int <= pc_done_next;
+ pc_busy_int <= pc_busy_next;
address_int <= address_next;
data_in_int <= data_in_next;
data_in_next <= data_in_int;
pc_done_next <= '0';
pc_char_next <= pc_char_int; --(others => '0');
+ pc_busy_next <= '0';
p_rdone_next <= p_rdone_int;
p_wdone_next <= p_wdone_int;
p_read_next <= p_read_int;
addr_tmp(hspalte'length - 1 downto 0) := s_cnt_int;
end if;
s_cnt_next <= addr_tmp(hspalte'length - 1 downto 0);
-
wr_next <= '1';
address_next <= std_logic_vector(unsigned(pos_int) + unsigned(addr_tmp));
data_in_next <= (others => '0');
addr_tmp := mul_tmp((addr_tmp'length - 1) downto 0);
addr_tmp := std_logic_vector(unsigned(addr_tmp) + unsigned(pc_spalte));
address_next <= addr_tmp;
+ pc_busy_next <= '1';
when S_PC_READ =>
pc_char_next <= data_out;
pc_done_next <= '1';
pc_zeile : out hzeile;
pc_spalte : out hspalte;
pc_get : out std_logic;
+ pc_busy : in std_logic; --signals if the history module actually grants our request.
pc_done : in std_logic;
pc_char : in hbyte
);
end case;
end process output_pc;
- next_state_pc : process (btn_a, pc_done, rx_new, rx_data, spalte, state,
- tx_data_i ,tx_done_i, zeile)
+ next_state_pc : process (btn_a, pc_busy, pc_done, rx_new, rx_data, spalte,
+ state, tx_data_i ,tx_done_i, zeile)
begin
state_next <= state;
case state is
when IDLE =>
- if (rx_new = '1' and rx_data = x"0a" ) or btn_a = '1' then
+ if (rx_new = '1' and rx_data = x"0a" ) or btn_a = '0' then
state_next <= FETCH;
end if;
when FETCH =>
- state_next <= WAIT_HIST;
+ if pc_busy = '1' then
+ state_next <= WAIT_HIST;
+ else
+ state_next <= FETCH;
+ end if;
when WAIT_HIST =>
if (pc_done = '1') then
state_next <= FORWARD;