// Full adder –VerilogHDL
modulefulladd(a, b, c, sum, carry);
input a;
input b;
input c;
output sum;
output carry;
wire p,q,r,s;
xor
x1(p,a,b),
x2(sum,p,c);
and
a1(q,a,b),
a2(r,b,c),
a3(s,a,c);
or
o1(carry,q,r,s);
endmodule
Structural Modeling in
VerilogHDL & VHDL
(Ex:FullAdder)
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity fadd_structuralis
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
sum : out std_logic;
carry : out std_logic);
end fadd_structural;
architecture structural of fadd_structuralis
component xor2
port(a,b:instd_logic;
z:out std_logic);
end component;
component and2
port(a,b:instd_logic;
z:out std_logic);
end component;
component or3
port(a,b,c:instd_logic;
z:out std_logic);
end component;
signal p,q,r,s:std_logic;
begin
x1: xor2 port map (a,b,p);
x2: xor2 port map (p,c,sum);
a1: and2 port map (a,b,q);
a2: and2 port map (b,c,r);
a3: and2 port map (c,a,s);
o1: or3 port map (q,r,s,carry);
end structural;