我是初学的,大家帮忙看看吧,谢谢了。
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
ENTITY ca2 IS
PORT (clk : IN std_logic;
Q1,Q2,Q3,Q4: OUT std_logic);
END ca2;
ARCHITECTURE behavioral OF ca2 IS
COMPONENT dff
PORT (
d,clk :IN STD_LOGIC;
q:OUT STD_LOGIC );
END COMPONENT;
SIGNAL data :STD_LOGIC_VECTOR (7 DOWNTO 0);
BEGIN
dffn_1: dff PORT MAP (data(0),clk,data(4));
dffn_2: dff PORT MAP (data(1),clk,data(5));
dffn_3: dff PORT MAP (data(2),clk,data(6));
dffn_4: dff PORT MAP (data(3),clk,data(7));
data(0) <= data(4) xor data(5);
data(1) <= data(4) xor data(6);
data(2) <= data(5) xor data(6) xor data(7);
data(3) <= data(6);
Q1 <= data(4);
Q2 <= data(5);
Q3 <= data(6);
Q4 <= data(7);
END behavioral; |