三個(gè)單片機(jī)的復(fù)位端并聯(lián)接至同一個(gè)復(fù)位端。復(fù)位信號(hào)在信號(hào)極性和脈沖寬度上滿足單片機(jī)復(fù)位要求,驅(qū)動(dòng)能力滿足多單片機(jī)需要。復(fù)位電路同樣是受控于控制模塊,用以實(shí)現(xiàn)單片機(jī)同步。
1.4 報(bào)警與控制
不同狀態(tài)下核心控制模塊有不同的信號(hào)輸出,異常狀態(tài)同時(shí)也是報(bào)警信號(hào)。正常狀態(tài)輸出綠燈,出錯(cuò)狀態(tài)輸出黃燈,失敗狀態(tài)輸出紅燈。黃燈輸出時(shí)系統(tǒng)可以暫時(shí)繼續(xù)工作,等到系統(tǒng)空閑或許可時(shí)進(jìn)行糾錯(cuò)。紅燈輸出時(shí)系統(tǒng)立即進(jìn)入保護(hù)狀態(tài),輸出端呈現(xiàn)高阻狀態(tài),需要時(shí)可以馬上糾錯(cuò),恢復(fù)系統(tǒng)。
系統(tǒng)恢復(fù)需要對(duì)控制模塊進(jìn)行復(fù)位,復(fù)位脈沖可以是自身的失敗狀態(tài)輸出,也可以是出錯(cuò)脈沖輸出和其他信號(hào)的組合邏輯??刂颇K的復(fù)位,實(shí)際是對(duì)各單片機(jī)重新進(jìn)行時(shí)序?qū)R和復(fù)位單片機(jī)程序。此處設(shè)計(jì)需結(jié)合具體使用場合考慮。
2 控制模塊的VHDL語言描述
本控制模塊主要采用VHDL語言進(jìn)行描述。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
Entity redu_control is
Port( a_bus,b_bus,c_bus: in std_logic_vector(7
downto 0); --三輸入總線,本設(shè)計(jì)定為8位
o_bus: out std_logic_vector(7 downto 0); --8位輸出總線
error_out,fail_out:out std_logic; --出錯(cuò)、失敗輸出
reset_in,clock_in: in std_logic; --復(fù)位、時(shí)鐘輸入
power,clock,reset: out std_logic;--電源、時(shí)鐘、復(fù)位輸出
)
end;
architecture control_pro of redu_control is
signal int: std_logic;
begin
bus_pro:process(a_bus,b_bus,c_bus) --總線控制過程
begin
if a_bus=b_bus then
o_bus<=a_bus;
if a_bus=c_bus then --正常輸出
error_out<='0';
fail_out<='0';
else
error_out<='1'; --給出出錯(cuò)信號(hào)
fail_out<='0';
end if
elsif a_bus=c_bus then
o_bus<=a_bus;
error_out<='1'; --給出出錯(cuò)信號(hào)
fail_out<='0';
elsif b_bus=c_bus then --不同的出錯(cuò)情況
o_bus<=b_bus;
error_out<='1';
fail_out<='0';
else --失敗輸出
o_bus<=(others=>'z');
fail_out<='1';
end if
end process bus_pro; --總線過程結(jié)束
start_pro process --啟動(dòng)過程
begin
wait until reset_in='1'; --等待外部復(fù)位啟動(dòng)
power<='0';
clock<='0';
reset<='0'; --停止電源、時(shí)鐘、復(fù)位輸出
power<='1' after 3 s; --3s后輸出電源信號(hào)
clock<=clock_in after 6 s; --6s后輸出時(shí)鐘信號(hào)
reset<='1' after 9 s; --9s后輸出復(fù)位信號(hào)
reset<='0' after 10 s; --復(fù)位信號(hào)回到高電平
end process start_pro; --啟動(dòng)過程結(jié)束
評(píng)論