Professional Documents
Culture Documents
COA Assignment subhanjan saha 2262004
COA Assignment subhanjan saha 2262004
COA Assignment subhanjan saha 2262004
AND GATE
An AND gate is an electrical circuit that combines two signal and
gives one output signal. The output of the AND gate is connected to
a base driver which is coupled to the bases of transistors, and
alternately switches the transistors at opposite corners of the
inverter.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end and_df;
begin
c <= a and b;
end dataflow;
end and_tb;
component and_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
signal a1:std _logic:=’0’;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
OR GATE
OR gate is the type of Logic Gate which combines two input and
gives one output. When at least one of the provided inputs is high
then the output is high otherwise it’s low.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end or_df;
begin
c <= a or b;
end dataflow;
end or_tb;
component or_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
NAND GATE
The NAND gate is the combination of two basic logic gates, the AND
gate and the NOT gate connected in series.It combines two input
and gives one output.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end nand_df;
begin
c <= a nand b;
end dataflow;
component nand_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
NOR GATE
The NOR gate is the combination of two basic logic gates, the OR
gate and the NOT gate connected in series. It combines two input
and gives one output.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
begin
c <= a nor b;
end dataflow;
end nor_tb;
component nor_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
XOR GATE
It is a logical “exclusive OR” function. For two given logical statements, the
XOR function would return TRUE if one of the statements is true and FALSE if
both statements are true. If neither of the statements is true, it also returns
FALSE.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end xor_df;
begin
c <= a xor b;
end dataflow;
Code for TestBench:
entity xor_tb is
end xor_tb;
component xor_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
XNOR GATE
An XNOR gate (Exclusive NOR gate) is a digital logic gate with two input and
one output that performs logical equality. The output of an XNOR gate is true
when both inputs are true or when both inputs are false.
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end xnor_df;
begin
c <= a xnor b;
end dataflow;
end xnor_tb;
component xnor_df is
port ( a : in STD_LOGIC;
b : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’0’;
b<=’1’;
a<=’1’;
b<=’0’;
a<=’1’;
b<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram:
NOT GATE
A NOT gate (Inverter Gate) is a logic gate. Each NOT gate has only one input
signal and one output signal.
port ( a : in STD_LOGIC;
c : out STD_LOGIC );
end not_df;
begin
c <= not a;
end dataflow;
Code for TestBench:
entity not_tb is
end not_tb;
component not_df is
port ( a : in STD_LOGIC;
c : out STD_LOGIC );
end component;
begin
stim_proc:process
begin
a<=’1’;
wait;
end process;
end behavioral;
Circuit Diagram: