本控制模块主要采用VHDL语言进行描述。
library ieee;
use ieee.std_1164.all;
use ieee.std_logic_unsigned.all;
Entity redu_control is
Port (a_bus,b_bus,c_bus:in std_logic_vector(7-三输入总线,--本设计定为8位)
o_bus: out std_logic_vector(7 downto 0);--8位输出总线
error_out,fail_outut std_logic;--出错、失败输出
reset_in,clock_in: in std_logic;--复位、时钟输入
power,clock,resetut std_logic;--电源、时钟、复位输出
)
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
if a_bus=c_bus then - 正常输出
error_out
fail_out
else
error_out
fail_out='0';
end if
elsif a_bus=c_bus then
o_bus
error_out
fail_out
elsif b_bus=c_bus then -不同的出错情况
o_bus
error_out
fail_out
else --失败输出
o_bus'z');
fail_out
end if
end procESS bus_pro; --总线过程结束
start_pro process -启动过程
begin
wait until reset_in='1'; --等待外部复位启动
power
clock
reset
power
clock
reset
reset
end process start_pro;--启动过程结束
end;