به نظر شما مشکل برنامه زیر چیه که اجرا نمیشه ؟
این برنامه ساخت یک جمع کننده 4 بیتی با کمک تمام جمع کننده است :
این برنامه ساخت یک جمع کننده 4 بیتی با کمک تمام جمع کننده است :
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity fa is
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
c_in : in STD_LOGIC;
s : out STD_LOGIC;
c_out : out STD_LOGIC);
end fa;
architecture Behavioral of fa is
signal s1,o2: std_logic;
begin
s1<=x xor y xor c_in;
s<=not s1;
o2<=(x and y)or(c_in and (x xor y));
c_out<=not o2;
end Behavioral;
entity adder4bit is
Port ( a : in std_LOGIC_VECTOR (3 downto 0);
b : in std_LOGIC_VECTOR (3 downto 0);
cin : in std_LOGIC;
s : out std_LOGIC_VECTOR (3 downto 0);
cout : out std_LOGIC);
end adder4bit;
architecture Behavioral of adder4bit is
component fa
port (x : in STD_LOGIC;
y : in STD_LOGIC;
c_in : in STD_LOGIC;
s : out STD_LOGIC;
c_out : out STD_LOGIC);
end component;
signal t1,t2,t3:STD_LOGIC;
begin
fa0: fa port map(x=>a(0),y=>b(0),c_in=>cin,s=>s(0), c_out=>t1);
fa1: fa port map(x=>a(1),y=>b(1),c_in=>t1,s=>s(1),c _out=>t2);
fa2: fa port map(x=>a(2),y=>b(2),c_in=>t2,s=>s(2),c _out=>t3);
fa3: fa port map(x=>a(3),y=>b(3),c_in=>t3,s=>s(3),c _out=>cout);
end Behavioral;
use IEEE.STD_LOGIC_1164.ALL;
entity fa is
Port ( x : in STD_LOGIC;
y : in STD_LOGIC;
c_in : in STD_LOGIC;
s : out STD_LOGIC;
c_out : out STD_LOGIC);
end fa;
architecture Behavioral of fa is
signal s1,o2: std_logic;
begin
s1<=x xor y xor c_in;
s<=not s1;
o2<=(x and y)or(c_in and (x xor y));
c_out<=not o2;
end Behavioral;
entity adder4bit is
Port ( a : in std_LOGIC_VECTOR (3 downto 0);
b : in std_LOGIC_VECTOR (3 downto 0);
cin : in std_LOGIC;
s : out std_LOGIC_VECTOR (3 downto 0);
cout : out std_LOGIC);
end adder4bit;
architecture Behavioral of adder4bit is
component fa
port (x : in STD_LOGIC;
y : in STD_LOGIC;
c_in : in STD_LOGIC;
s : out STD_LOGIC;
c_out : out STD_LOGIC);
end component;
signal t1,t2,t3:STD_LOGIC;
begin
fa0: fa port map(x=>a(0),y=>b(0),c_in=>cin,s=>s(0), c_out=>t1);
fa1: fa port map(x=>a(1),y=>b(1),c_in=>t1,s=>s(1),c _out=>t2);
fa2: fa port map(x=>a(2),y=>b(2),c_in=>t2,s=>s(2),c _out=>t3);
fa3: fa port map(x=>a(3),y=>b(3),c_in=>t3,s=>s(3),c _out=>cout);
end Behavioral;
دیدگاه