?? 93_wss_top.vhd
字號:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE work.pkg_types.ALL;
ENTITY top IS
PORT ( clk : IN bit1;
reset : IN bit1;
command : IN bit1;
c_sel : OUT bit1;
s_sel : OUT bit1;
burst : OUT bit2_r;
p_sel : OUT bit1;
mode : OUT bit1;
c_done : IN bit1;
s_done : IN bit1;
done0 : IN bit1;
done1 : IN bit1;
status : OUT bit1);
END top;
ARCHITECTURE behavior OF top IS
CONSTANT n :integer:=2;
SIGNAL burst_int :bit2_r;
BEGIN
PROCESS
BEGIN
--初始化
mode <= '0';
burst_int <= "00";
p_sel <= '0';
c_sel <= '0';
s_sel <= '0';
status <='0';
main_loop : LOOP
--等到所有組件都準備就緒
WAIT UNTIL c_done='1' AND reset='1' AND rising_edge(clk) AND
s_done='1' AND done0='1' AND done1='1';
status <= '1';
--等命令的到來
IF command /='1' THEN
WAIT UNTIL command='1' AND reset='1' AND rising_edge(clk);
END IF;
--設定初始工作信號,但co_processor不為最后一個處理過程
mode <='0';
burst_int <="00";
status <='0';
c_sel <='1';
s_sel <='1';
--等到mem_string和mem_sequence有應答信號
WAIT UNTIL c_done='0' AND s_done='0' AND rising_edge(clk);
--選定信號復位
c_sel <='0';
s_sel <='0';
--等到mem_string和mem_sequence的裝載過程處理完成
WAIT UNTIL c_done='1' AND s_done='1' AND rising_edge(clk);
IF reset/='1' THEN
EXIT main_loop;
END IF;
--mem_string裝載下一個burst
burst_int <= burst_int + 1;
s_sel <='1';
WAIT UNTIL s_done='0' AND rising_edge(clk);
s_sel <='0';
WAIT UNTIL s_done='1' AND rising_edge(clk);
IF reset/='1' THEN
EXIT main_loop;
END IF;
--當burst_int在范圍內,找出與mem_sequence中最相近的burst
WHILE burst_int < n AND reset='1' LOOP
burst_int <= burst_int + 1;
s_sel <='1';
p_sel <='1';
WAIT UNTIL s_done='0' AND done0='0' AND rising_edge(clk);
s_sel <='0';
p_sel <='0';
WAIT UNTIL s_done='1' AND done0='0' AND rising_edge(clk);
END LOOP;
IF reset/='1' THEN
EXIT main_loop;
END IF;
--說明co_processor為最后一個處理過程
mode <='1';
p_sel <='1';
WAIT UNTIL done1='1' AND rising_edge(clk);
END LOOP main_loop;
END PROCESS;
burst <=burst_int;
END behavior;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -