Professional Documents
Culture Documents
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity and_2 is
port ( a,b: in std_logic;
y: out std_logic);
end and_2;
architecture Behavioral of and_2 is
begin
y <= a and b;
end Behavioral;
--Fau unit
LIBRARY ieee;
USE ieee.std_logic_1164.all;
--------------------------------------ENTITY fau IS
PORT ( a, b, cin: IN STD_LOGIC;
s, cout: OUT STD_LOGIC);
END fau;
--------------------------------------ARCHITECTURE fau OF fau IS
BEGIN
s <= a XOR b XOR cin;
cout <= (a AND b) OR (a AND cin) OR (b AND cin);
END fau;
----------------------------------------Reg unit
LIBRARY ieee;
USE ieee.std_logic_1164.all;
--------------------------------------ENTITY reg IS
--Pipe unit
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE work.my_components.all;
--------------------------------------ENTITY pipe IS
PORT ( a, b, clk, rst: IN STD_LOGIC;
q: OUT STD_LOGIC);
END pipe;
--------------------------------------ARCHITECTURE structural OF pipe IS
SIGNAL s, cin, cout: STD_LOGIC;
BEGIN
U1: COMPONENT fau PORT MAP (a, b, cin, s, cout);
U2: COMPONENT reg PORT MAP (cout, clk, rst, cin);
U3: COMPONENT reg PORT MAP (s, clk, rst, q);
END structural;
--My_components
LIBRARY ieee;
USE ieee.std_logic_1164.all;
--------------------------------------PACKAGE my_components IS
-------------------------COMPONENT and_2 IS
PORT (a, b: IN STD_LOGIC; y: OUT STD_LOGIC);
END COMPONENT;
-------------------------COMPONENT fau IS