SlideShare a Scribd company logo
1 of 45
Download to read offline
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Padmabhooshan Vasantraodada Patil Institute of Technology,
Budhgaon-416304
Digital System Design
LAB MANUAL
Prepared by
Mr. A. B. Shinde
Assistant Professor,
Electronics Engineering,

Department of Electronics Engineering
2013-14
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
------Half Adder (Behavioral)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ha_adder is
Port ( a : in std_logic;
b : in std_logic;
s : out std_logic;
c : out std_logic);
end ha_adder;
architecture Behavioral of ha_adder is
begin
s<= a xor b;
c<= a and b;
end Behavioral
Entity Level Diagram
Architectural Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
XOR Gate
Device utilization Summary:
---------------------------
Number of Slices: 1 out of 1200 0%
Number of 4 input LUTs: 2 out of 2400 0%
Number of bonded IOBs: 4 out of 96 4%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Full Adder (Structural)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity f_adder is
Port ( a : in std_logic;
b : in std_logic;
cin : in std_logic;
sum : out std_logic;
carry : out std_logic);
end f_adder;
architecture structural of f_adder is
signal s1, c1, c2: std_logic;
component ha_adder is
Port ( a : in std_logic;
b : in std_logic;
s : out std_logic;
c : out std_logic);
end component;
begin
u1: ha_adder port map(a, b, s1, c1);
u2: ha_adder port map(s1, cin, sum, c2);
carry<= c1 or c2;
end structural;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 1 out of 1200 0%
Number of 4 input LUTs: 2 out of 2400 0%
Number of bonded IOBs: 5 out of 96 5%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------4 bit Full Adder (Structural)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity adder_4bit is
Port ( a : in std_logic_vector(3 downto 0);
b : in std_logic_vector(3 downto 0);
cin : in std_logic;
Sum : out std_logic_vector(3 downto 0);
Cy : out std_logic);
end adder_4bit;
architecture Behavioral of adder_4bit is
component f_adder is
Port ( a : in std_logic;
b : in std_logic;
cin : in std_logic;
sum : out std_logic;
carry : out std_logic);
end component;
signal c1, c2, c3:std_logic;
begin
u1:f_adder port map(a=>a(0),
b=>b(0),
cin=>cin,
sum=>Sum(0),
carry=>c1);
u2:f_adder port map(a=>a(1),
b=>b(1),
cin=>c1,
sum=>Sum(1),
carry=>c2);
u3:f_adder port map(a=>a(2),
b=>b(2),
cin=>c2,
sum=>Sum(2),
carry=>c3);
u4:f_adder port map(a=>a(3),
b=>b(3),
cin=>c3,
sum=>Sum(3),
carry=>Cy);
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 5 out of 1200 0%
Number of 4 input LUTs: 9 out of 2400 0%
Number of bonded IOBs: 14 out of 96 14%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------16 bit Full Adder (Structural)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity adder_16bit is
Port ( x : in std_logic_vector(15 downto 0);
y : in std_logic_vector(15 downto 0);
pre_carry : in std_logic;
Sum : out std_logic_vector(15 downto 0);
Carry : out std_logic);
end adder_16bit;
architecture Behavioral of adder_16bit is
component adder_4bit is
Port ( a : in std_logic_vector(3 downto 0);
b : in std_logic_vector(3 downto 0);
cin : in std_logic;
Sum : out std_logic_vector(3 downto 0);
Cy : out std_logic);
end component;
signal c1,c2,c3:std_logic;
begin
u1:adder_4bit port map(a=>x(3 downto 0),
b=>y(3 downto 0),
cin=>pre_carry,
Sum=>Sum(3 downto 0),
Cy=>c1);
u2:adder_4bit port map(a=>x(7 downto 4),
b=>y(7 downto 4),
cin=>c1,
Sum=>Sum(7 downto 4),
Cy=>c2);
u3:adder_4bit port map(a=>x(11 downto 8),
b=>y(11 downto 8),
cin=>c2,
Sum=>Sum(11 downto 8),
Cy=>c3);
u4:adder_4bit port map(a=>x(15 downto 12),
b=>y(15 downto 12),
cin=>c3,
Sum=>Sum(15 downto 12),
Cy=>Carry);
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 19 out of 1200 1%
Number of 4 input LUTs: 33 out of 2400 1%
Number of bonded IOBs: 50 out of 96 52%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------4bit Magnitude Comparator (Structural)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity comp_4bit is
Port ( a : in std_logic_vector(3 downto 0);
b : in std_logic_vector(3 downto 0);
altb : out std_logic;
aeqb : out std_logic;
agtb : out std_logic);
end comp_4bit;
architecture comp_arch of comp_4bit is
component adder_4bit is
Port ( a : in std_logic_vector(3 downto 0);
b : in std_logic_vector(3 downto 0);
cin : in std_logic;
Sum : out std_logic_vector(3 downto 0);
Cy : out std_logic);
end component;
component xnor_4 is
port (s: in std_logic_vector(3 downto 0);
t: in std_logic_vector(3 downto 0);
v: out std_logic_vector(3 downto 0));
end component;
component and_4 is
port ( p,q,r,s:in std_logic;
y:out std_logic);
end component;
component not_4 is
port ( i:in std_logic_vector(3 downto 0);
j:out std_logic_vector(3 downto 0));
end component;
signal s1,s2,s3,s5,s6:std_logic_vector(3 downto 0);
signal s4:std_logic:='0';
begin
u1: adder_4bit port map ( a=>s1,
b=>b,
cin=>s4,
Sum=>s5,
Cy=>altb);
u2: adder_4bit port map ( a=>s2,
b=>a,
cin=>s4,
Sum=>s6,
Cy=>agtb);
u3: xnor_4 port map ( s=>a,
t=>b,
v=>s3);
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
u4: and_4 port map ( p=>s3(3),
q=>s3(2),
r=>s3(1),
s=>s3(0),
y=>aeqb);
u5: not_4 port map ( i=>a,
j=>s1);
u6: not_4 port map ( i=>b,
j=>s2);
end comp_arch;
Entity Level Diagram
Architectural Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Device utilization summary:
---------------------------
Number of Slices: 5 out of 1200 0%
Number of 4 input LUTs: 9 out of 2400 0%
Number of bonded IOBs: 11 out of 96 11%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------BCD up-down Counter------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity coun_bcd_updn is
Port ( clk : in std_logic;
reset : in std_logic;
updn : in std_logic;
count : out std_logic_vector(3 downto 0));
end coun_bcd_updn;
architecture Behavioral of coun_bcd_updn is
signal temp:std_logic_vector(3 downto 0);
begin
process(clk,reset)
begin
if(reset='1')then
temp<="0000";
elsif(clk'event and clk='1')then
if (updn='1')then
if(temp=x"9")then
temp<=x"0";
else
temp<=temp+1;
end if;
else
if(temp=x"0")then
temp<=x"9";
else
temp<=temp-1;
end if;
end if;
end if;
end process;
count<=temp;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 6 out of 1200 0%
Number of Slice Flip Flops: 4 out of 2400 0%
Number of 4 input LUTs: 11 out of 2400 0%
Number of bonded IOBs: 7 out of 96 7%
Number of GCLKs: 1 out of 4 25%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------4bit Binary up-down Counter------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity counter_updn is
Port ( clk : in std_logic;
reset : in std_logic;
updn: in std_logic;
count : out std_logic_vector(3 downto 0));
end counter_updn;
architecture Behavioral of counter_updn is
signal temp:std_logic_vector(3 downto 0);
begin
process(clk,reset)
begin
if(reset='1')then
temp<="0000";
elsif(clk'event and clk='1')then
if (updn='1')then
temp<=temp+1;
else
temp<=temp-1;
end if;
end if;
end process;
count<=temp;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 2 out of 1200 0%
Number of Slice Flip Flops: 4 out of 2400 0%
Number of 4 input LUTs: 4 out of 2400 0%
Number of bonded IOBs: 7 out of 96 7%
Number of GCLKs: 1 out of 4 25%
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------3:8 Decoder------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity deco_3_8 is
Port ( input : in std_logic_vector(2 downto 0);
en : in std_logic;
output : out std_logic_vector(7 downto 0));
end deco_3_8;
architecture Behavioral of deco_3_8 is
begin
process(input,en)
begin
if (en='0') then
output<=(others=>'0');
else
case input is
when "000" => output<="00000001";
when "001" => output<="00000010";
when "010" => output<="00000100";
when "011" => output<="00001000";
when "100" => output<="00010000";
when "101" => output<="00100000";
when "110" => output<="01000000";
when others => output<="10000000";
end case;
end if;
end process;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 4 out of 192 2%
Number of 4 input LUTs: 8 out of 384 2%
Number of bonded IOBs: 12 out of 90 13%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------5:32 Decoder (Structural)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity deco_5_32 is
Port ( i : in std_logic_vector(4 downto 0);
En : in std_logic;
y : out std_logic_vector(31 downto 0));
end deco_5_32;
architecture dec_arch of deco_5_32 is
component deco_2_4 is
Port ( i : in std_logic_vector(1 downto 0);
e : in std_logic;
y : out std_logic_vector(3 downto 0));
end component;
component deco_3_8 is
Port ( input : in std_logic_vector(2 downto 0);
en : in std_logic;
output : out std_logic_vector(7 downto 0));
end component;
signal s : std_logic_vector(3 downto 0);
begin
u1: deco_2_4 port map (i=>i(4 downto 3),
e=>En,
y=>s);
u2: deco_3_8 port map (input=>i(2 downto 0),
en=>s(3),
output=>y(31 downto 24));
u3: deco_3_8 port map (input=>i(2 downto 0),
en=>s(2),
output=>y(23 downto 16));
u4: deco_3_8 port map (input=>i(2 downto 0),
en=>s(1),
output=>y(15 downto 8));
u5: deco_3_8 port map (input=>i(2 downto 0),
en=>s(0),
output=>y(7 downto 0));
end dec_arch;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 21 out of 192 10%
Number of 4 input LUTs: 36 out of 384 9%
Number of bonded IOBs: 38 out of 90 42%
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Encoder (When____Else)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity enco_8_3_when is
Port ( i : in std_logic_vector(7 downto 0);
y : out std_logic_vector(2 downto 0));
end enco_8_3_when;
architecture Behavioral of enco_8_3_when is
begin
y<="000" when i="00000001" else
"001" when i="00000010" else
"010" when i="00000100" else
"011" when i="00001000" else
"100" when i="00010000" else
"101" when i="00100000" else
"110" when i="01000000" else
"111" when i="10000000" else
"ZZZ";
end Behavioral;
-------Encoder (With____Select)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity enco_8_3_with is
Port ( i : in std_logic_vector(7 downto 0);
y : out std_logic_vector(2 downto 0));
end enco_8_3_with;
architecture Behavioral of enco_8_3_with is
begin
with i select
y<= "000" when "00000001",
"001" when "00000010",
"010" when "00000100",
"011" when "00001000",
"100" when "00010000",
"101" when "00100000",
"110" when "01000000",
"111" when "10000000",
"ZZZ" when others;
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 8 out of 192 4%
Number of 4 input LUTs: 16 out of 384 4%
Number of bonded IOBs: 11 out of 90 12%
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Priority Encoder------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity prio_enco is
Port ( i : in std_logic_vector(7 downto 0);
y : out std_logic_vector(2 downto 0));
end prio_enco;
architecture Behavioral of prio_enco is
begin
process(i)
begin
if (i(7)='1')then
y<="111";
elsif (i(6)='1')then
y<="110";
elsif (i(5)='1')then
y<="101";
elsif (i(4)='1')then
y<="100";
elsif (i(3)='1')then
y<="011";
elsif (i(2)='1')then
y<="010";
elsif (i(1)='1')then
y<="001";
elsif (i(0)='1')then
y<="000";
else
y<="ZZZ";
end if;
end process;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 4 out of 192 2%
Number of 4 input LUTs: 8 out of 384 2%
Number of bonded IOBs: 11 out of 90 12%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Single Port RAM------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ram_1p is
Port ( clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(4 downto 0);
dio : inout std_logic_vector(3 downto 0));
end ram_1p;
architecture Behavioral of ram_1p is
type ram_type is array (31 downto 0) of std_logic_vector(3
downto 0);
signal ram: ram_type;
begin
process (clk)
begin
if (clk'event and clk='1')then
if (we='1')then
ram(conv_integer(addr))<=dio;
else
dio<=ram(conv_integer(addr));
end if;
end if;
end process;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 8 out of 192 4%
Number of Slice Flip Flops: 4 out of 384 1%
Number of 4 input LUTs: 8 out of 384 2%
Number of bonded IOBs: 11 out of 90 12%
Number of GCLKs: 1 out of 4 25%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Dual Port RAM------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ram_2p is
Port ( clk : in std_logic;
we : in std_logic;
addr : in std_logic_vector(4 downto 0);
din : in std_logic_vector(3 downto 0);
spo : out std_logic_vector(3 downto 0);
dpo : out std_logic_vector(3 downto 0);
x : in std_logic);
end ram_2p;
architecture Behavioral of ram_2p is
type ram_type is array (31 downto 0) of std_logic_vector(3
downto 0);
signal ram:ram_type;
begin
process(clk)
begin
if (clk'event and clk='1')then
if(we='1')then
ram(conv_integer(addr))<=din;
end if;
end if;
end process;
process(clk)
begin
if (clk'event and clk='1')then
if (we='0')then
if(x='0')then
spo<=ram(conv_integer(addr));
else
dpo<=ram(conv_integer(addr));
end if;
end if;
end if;
end process;
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 10 out of 192 5%
Number of Slice Flip Flops: 8 out of 384 2%
Number of 4 input LUTs: 10 out of 384 2%
Number of bonded IOBs: 20 out of 90 22%
Number of GCLKs: 1 out of 4 25%
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------4:1 Multiplexer (CASE STATEMENT)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_4_1_case is
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
d : in std_logic;
s : in std_logic_vector(1 downto 0);
y : out std_logic);
end mux_4_1_case;
architecture Behavioral of mux_4_1_case is
begin
process(a,b,c,d,s)
begin
case s is
when "00" => y<= a;
when "01" => y<= b;
when "10" => y<= c;
when others => y<= d;
end case;
end process;
end Behavioral;
-------4:1 Multiplexer (WHEN__ELSE STATEMENT)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_4_1_when_else is
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
d : in std_logic;
s : in std_logic_vector(1 downto 0);
y : out std_logic);
end mux_4_1_when_else;
architecture Behavioral of mux_4_1_when_else is
begin
y<= a when s="00" else
b when s="01" else
c when s="10" else
d;
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------4:1 Multiplexer (IF__ELSE STATEMENT)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_4_1_if is
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
d : in std_logic;
s : in std_logic_vector(1 downto 0);
y : out std_logic);
end mux_4_1_if;
architecture Behavioral of mux_4_1_if is
begin
process(s,a,b,c,d)
begin
if (s="00") then
y<=a;
elsif (s="01") then
y<=b;
elsif (s="10") then
y<=c;
else
y<=d;
end if;
end process;
end Behavioral;
-------4:1 Multiplexer (WITH___SELECT STATEMENT)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_4_1_with_select is
Port ( a : in std_logic;
b : in std_logic;
c : in std_logic;
d : in std_logic;
s : in std_logic_vector(1 downto 0);
y : out std_logic);
end mux_4_1_with_select;
architecture Behavioral of mux_4_1_with_select is
begin
with s select
y<= a when "00",
b when "01",
c when "10",
d when others;
end Behavioral;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Entity Level Diagram
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 1 out of 192 0%
Number of 4 input LUTs: 2 out of 384 0%
Number of bonded IOBs: 7 out of 90 7%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------8:1 Multiplexer------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mux_8_1 is
Port ( i : in std_logic_vector(7 downto 0);
s : in std_logic_vector(2 downto 0);
y : out std_logic);
end mux_8_1;
architecture Behavioral of mux_8_1 is
begin
with s select
y<= i(0) when "000",
i(1) when "001",
i(2) when "010",
i(3) when "011",
i(4) when "100",
i(5) when "101",
i(6) when "110",
i(7) when others;
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 2 out of 192 1%
Number of 4 input LUTs: 4 out of 384 1%
Number of bonded IOBs: 12 out of 90 13%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Sequence Detector (Mealy 1011)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity mealy_1011 is
Port ( clk : in std_logic;
x : in std_logic;
reset:in std_logic;
z : out std_logic);
end mealy_1011;
architecture Behavioral of mealy_1011 is
type state is (s0,s1,s2,s3);
signal current:state;
begin
process(clk,x)
begin
if (reset='1')then
current<=s0;
z<='0';
elsif (clk'event and clk='1')then
case current is
when s0 =>
if (x='1')then
current<=s1;
z<='0';
else
current<=s0;
z<='0';
end if;
when s1 =>
if (x='0')then
current<=s2;
z<='0';
else
current<=s1;
z<='0';
end if;
when s2 =>
if (x='1')then
current<=s3;
z<='0';
else
current<=s0;
z<='0';
end if;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
when s3 =>
if (x='1')then
current<=s1;
z<='1';
else
current<=s2;
z<='0';
end if;
when others=>
null;
end case;
end if;
end process;
end Behavioral;
Entity Level Diagram
Architectural Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 2 out of 768 0%
Number of Slice Flip Flops: 3 out of 1536 0%
Number of 4 input LUTs: 2 out of 1536 0%
Number of bonded IOBs: 4 out of 96 4%
Number of GCLKs: 1 out of 4 25%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Sequence Detector (Moore 1011)------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity moore_1011 is
Port ( clk : in std_logic;
x : in std_logic;
reset:in std_logic;
z : out std_logic);
end moore_1011;
architecture Behavioral of moore_1011 is
type state is (s0,s1,s2,s3,s4);
signal current:state;
begin
process(clk,x)
begin
if (reset='1')then
current<=s0;
elsif (clk'event and clk='1')then
case current is
when s0 =>
if (x='1')then
current<=s1;
else
current<=s0;
end if;
when s1 =>
if (x='0')then
current<=s2;
else
current<=s1;
end if;
when s2 =>
if (x='1')then
current<=s3;
else
current<=s0;
end if;
when s3 =>
if (x='1')then
current<=s4;
else
current<=s3;
end if;
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
when others=>
current<=s0;
end case;
end if;
end process;
z<='1' when current=s4 else
'0';
end Behavioral;
Entity Level Diagram
Architectural Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 2 out of 768 0%
Number of Slice Flip Flops: 3 out of 1536 0%
Number of 4 input LUTs: 3 out of 1536 0%
Number of bonded IOBs: 4 out of 96 4%
Number of GCLKs: 1 out of 4 25%
Simulation Waveform
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
-------Shift Register using Generate Statement------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity shift_generate is
Port ( sin : in std_logic;
clk : in std_logic;
reset : in std_logic;
sout : out std_logic);
end shift_generate;
architecture Behavioral of shift_generate is
component d_ff is
Port ( d : in std_logic;
clk : in std_logic;
reset : in std_logic;
q : out std_logic);
end component;
signal temp:std_logic_vector(4 downto 0);
begin
temp(0)<=sin;
sreg:for i in 0 to 3 generate
u:d_ff port map (d=>temp(i),
clk=>clk,
reset=>reset,
q=>temp(i+1));
end generate;
sout<=temp(4);
end Behavioral;
Entity Level Diagram
Digital System Design
Department of Electronics Engg., P.V.P.I.T., Budhgaon
Architectural Level Diagram
Device utilization summary:
---------------------------
Number of Slices: 2 out of 1200 0%
Number of Slice Flip Flops: 4 out of 2400 0%
Number of bonded IOBs: 4 out of 96 4%
Number of GCLKs: 1 out of 4 25%
Simulation Waveform

More Related Content

What's hot

Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical fileArchita Misra
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesRicardo Castro
 
Vlsi lab manual exp:2
Vlsi lab manual exp:2Vlsi lab manual exp:2
Vlsi lab manual exp:2komala vani
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL BasicRon Liu
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationGouthaman V
 
EC6612 VLSI Design Lab Manual
EC6612 VLSI Design Lab ManualEC6612 VLSI Design Lab Manual
EC6612 VLSI Design Lab Manualtamil arasan
 
Vhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unitVhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unitNikhil Sahu
 
Practical file
Practical filePractical file
Practical filerajeevkr35
 
VLSI Experiments I
VLSI Experiments IVLSI Experiments I
VLSI Experiments IGouthaman V
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDLanand hd
 
Functions for Nano 5 Card
Functions for Nano 5 CardFunctions for Nano 5 Card
Functions for Nano 5 CardOmar Sanchez
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學 艾鍗科技
 

What's hot (20)

Digital system design practical file
Digital system design practical fileDigital system design practical file
Digital system design practical file
 
Vhdl lab manual
Vhdl lab manualVhdl lab manual
Vhdl lab manual
 
VHDL CODE
VHDL CODE VHDL CODE
VHDL CODE
 
Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)Verilog lab manual (ECAD and VLSI Lab)
Verilog lab manual (ECAD and VLSI Lab)
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
 
VLSI & E-CAD Lab Manual
VLSI & E-CAD Lab ManualVLSI & E-CAD Lab Manual
VLSI & E-CAD Lab Manual
 
VLSI lab manual
VLSI lab manualVLSI lab manual
VLSI lab manual
 
Vlsi lab manual exp:2
Vlsi lab manual exp:2Vlsi lab manual exp:2
Vlsi lab manual exp:2
 
Day2 Verilog HDL Basic
Day2 Verilog HDL BasicDay2 Verilog HDL Basic
Day2 Verilog HDL Basic
 
VLSI Anna University Practical Examination
VLSI Anna University Practical ExaminationVLSI Anna University Practical Examination
VLSI Anna University Practical Examination
 
EC6612 VLSI Design Lab Manual
EC6612 VLSI Design Lab ManualEC6612 VLSI Design Lab Manual
EC6612 VLSI Design Lab Manual
 
Verilog HDL
Verilog HDLVerilog HDL
Verilog HDL
 
Vhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unitVhdl code and project report of arithmetic and logic unit
Vhdl code and project report of arithmetic and logic unit
 
Practical file
Practical filePractical file
Practical file
 
VLSI Experiments I
VLSI Experiments IVLSI Experiments I
VLSI Experiments I
 
Verilog lab mauual
Verilog lab mauualVerilog lab mauual
Verilog lab mauual
 
Modules and ports in Verilog HDL
Modules and ports in Verilog HDLModules and ports in Verilog HDL
Modules and ports in Verilog HDL
 
Functions for Nano 5 Card
Functions for Nano 5 CardFunctions for Nano 5 Card
Functions for Nano 5 Card
 
Verilog 語法教學
Verilog 語法教學 Verilog 語法教學
Verilog 語法教學
 
Vhdl programming
Vhdl programmingVhdl programming
Vhdl programming
 

Similar to VHDL Programs

Pipeline stalling in vhdl
Pipeline stalling in vhdlPipeline stalling in vhdl
Pipeline stalling in vhdlSai Malleswar
 
Write complete VHDL codes for the following schematic. Solution.pdf
Write complete VHDL codes for the following schematic.  Solution.pdfWrite complete VHDL codes for the following schematic.  Solution.pdf
Write complete VHDL codes for the following schematic. Solution.pdfarjuncollection
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDLYaser Kalifa
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESkarthik kadava
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building HierarchyMohamed Samy
 
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix NepalFPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix NepalKrishna Gaihre
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisitionazhar557
 
Vhd lhigh2003
Vhd lhigh2003Vhd lhigh2003
Vhd lhigh2003gkumawat
 
Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)TakashiSuoh
 

Similar to VHDL Programs (20)

Pipeline stalling in vhdl
Pipeline stalling in vhdlPipeline stalling in vhdl
Pipeline stalling in vhdl
 
Write complete VHDL codes for the following schematic. Solution.pdf
Write complete VHDL codes for the following schematic.  Solution.pdfWrite complete VHDL codes for the following schematic.  Solution.pdf
Write complete VHDL codes for the following schematic. Solution.pdf
 
Vhdl basic unit-2
Vhdl basic unit-2Vhdl basic unit-2
Vhdl basic unit-2
 
Fpga creating counter with external clock
Fpga   creating counter with external clockFpga   creating counter with external clock
Fpga creating counter with external clock
 
Introduction to VHDL
Introduction to VHDLIntroduction to VHDL
Introduction to VHDL
 
Uart
UartUart
Uart
 
Session1
Session1Session1
Session1
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLES
 
Fpga creating counter with internal clock
Fpga   creating counter with internal clockFpga   creating counter with internal clock
Fpga creating counter with internal clock
 
Presentation1.pdf
Presentation1.pdfPresentation1.pdf
Presentation1.pdf
 
Eecs 317 20010209
Eecs 317 20010209Eecs 317 20010209
Eecs 317 20010209
 
DIGITAL ELECTRONICS LAB
DIGITAL ELECTRONICS LABDIGITAL ELECTRONICS LAB
DIGITAL ELECTRONICS LAB
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Building Hierarchy
Building HierarchyBuilding Hierarchy
Building Hierarchy
 
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix NepalFPGA training session generic package and funtions of VHDL by Digitronix Nepal
FPGA training session generic package and funtions of VHDL by Digitronix Nepal
 
Data Acquisition
Data AcquisitionData Acquisition
Data Acquisition
 
Vhd lhigh2003
Vhd lhigh2003Vhd lhigh2003
Vhd lhigh2003
 
Structural modelling
Structural modellingStructural modelling
Structural modelling
 
VHDL
VHDLVHDL
VHDL
 
Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)Arithmatic logic unit using VHDL (gates)
Arithmatic logic unit using VHDL (gates)
 

More from A B Shinde

Communication System Basics
Communication System BasicsCommunication System Basics
Communication System BasicsA B Shinde
 
MOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC AmplifierMOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC AmplifierA B Shinde
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: BasicsA B Shinde
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and SegmentationA B Shinde
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainA B Shinde
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image FundamentalsA B Shinde
 
Resume Writing
Resume WritingResume Writing
Resume WritingA B Shinde
 
Image Processing Basics
Image Processing BasicsImage Processing Basics
Image Processing BasicsA B Shinde
 
Blooms Taxonomy in Engineering Education
Blooms Taxonomy in Engineering EducationBlooms Taxonomy in Engineering Education
Blooms Taxonomy in Engineering EducationA B Shinde
 
ISE 7.1i Software
ISE 7.1i SoftwareISE 7.1i Software
ISE 7.1i SoftwareA B Shinde
 
VHDL Coding Syntax
VHDL Coding SyntaxVHDL Coding Syntax
VHDL Coding SyntaxA B Shinde
 
VLSI Testing Techniques
VLSI Testing TechniquesVLSI Testing Techniques
VLSI Testing TechniquesA B Shinde
 
Selecting Engineering Project
Selecting Engineering ProjectSelecting Engineering Project
Selecting Engineering ProjectA B Shinde
 
Interview Techniques
Interview TechniquesInterview Techniques
Interview TechniquesA B Shinde
 
Semiconductors
SemiconductorsSemiconductors
SemiconductorsA B Shinde
 
Diode Applications & Transistor Basics
Diode Applications & Transistor BasicsDiode Applications & Transistor Basics
Diode Applications & Transistor BasicsA B Shinde
 
Electronics Basic Concepts
Electronics Basic ConceptsElectronics Basic Concepts
Electronics Basic ConceptsA B Shinde
 

More from A B Shinde (20)

Communication System Basics
Communication System BasicsCommunication System Basics
Communication System Basics
 
MOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC AmplifierMOSFETs: Single Stage IC Amplifier
MOSFETs: Single Stage IC Amplifier
 
MOSFETs
MOSFETsMOSFETs
MOSFETs
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: Basics
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and Segmentation
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Resume Format
Resume FormatResume Format
Resume Format
 
Digital Image Fundamentals
Digital Image FundamentalsDigital Image Fundamentals
Digital Image Fundamentals
 
Resume Writing
Resume WritingResume Writing
Resume Writing
 
Image Processing Basics
Image Processing BasicsImage Processing Basics
Image Processing Basics
 
Blooms Taxonomy in Engineering Education
Blooms Taxonomy in Engineering EducationBlooms Taxonomy in Engineering Education
Blooms Taxonomy in Engineering Education
 
ISE 7.1i Software
ISE 7.1i SoftwareISE 7.1i Software
ISE 7.1i Software
 
VHDL Coding Syntax
VHDL Coding SyntaxVHDL Coding Syntax
VHDL Coding Syntax
 
VLSI Testing Techniques
VLSI Testing TechniquesVLSI Testing Techniques
VLSI Testing Techniques
 
Selecting Engineering Project
Selecting Engineering ProjectSelecting Engineering Project
Selecting Engineering Project
 
Interview Techniques
Interview TechniquesInterview Techniques
Interview Techniques
 
Semiconductors
SemiconductorsSemiconductors
Semiconductors
 
Diode Applications & Transistor Basics
Diode Applications & Transistor BasicsDiode Applications & Transistor Basics
Diode Applications & Transistor Basics
 
Electronics Basic Concepts
Electronics Basic ConceptsElectronics Basic Concepts
Electronics Basic Concepts
 

Recently uploaded

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 

Recently uploaded (20)

main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 

VHDL Programs

  • 1. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Padmabhooshan Vasantraodada Patil Institute of Technology, Budhgaon-416304 Digital System Design LAB MANUAL Prepared by Mr. A. B. Shinde Assistant Professor, Electronics Engineering,  Department of Electronics Engineering 2013-14
  • 2. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon ------Half Adder (Behavioral)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ha_adder is Port ( a : in std_logic; b : in std_logic; s : out std_logic; c : out std_logic); end ha_adder; architecture Behavioral of ha_adder is begin s<= a xor b; c<= a and b; end Behavioral Entity Level Diagram Architectural Level Diagram
  • 3. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon XOR Gate Device utilization Summary: --------------------------- Number of Slices: 1 out of 1200 0% Number of 4 input LUTs: 2 out of 2400 0% Number of bonded IOBs: 4 out of 96 4% Simulation Waveform
  • 4. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Full Adder (Structural)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity f_adder is Port ( a : in std_logic; b : in std_logic; cin : in std_logic; sum : out std_logic; carry : out std_logic); end f_adder; architecture structural of f_adder is signal s1, c1, c2: std_logic; component ha_adder is Port ( a : in std_logic; b : in std_logic; s : out std_logic; c : out std_logic); end component; begin u1: ha_adder port map(a, b, s1, c1); u2: ha_adder port map(s1, cin, sum, c2); carry<= c1 or c2; end structural; Entity Level Diagram
  • 5. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 1 out of 1200 0% Number of 4 input LUTs: 2 out of 2400 0% Number of bonded IOBs: 5 out of 96 5% Simulation Waveform
  • 6. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------4 bit Full Adder (Structural)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity adder_4bit is Port ( a : in std_logic_vector(3 downto 0); b : in std_logic_vector(3 downto 0); cin : in std_logic; Sum : out std_logic_vector(3 downto 0); Cy : out std_logic); end adder_4bit; architecture Behavioral of adder_4bit is component f_adder is Port ( a : in std_logic; b : in std_logic; cin : in std_logic; sum : out std_logic; carry : out std_logic); end component; signal c1, c2, c3:std_logic; begin u1:f_adder port map(a=>a(0), b=>b(0), cin=>cin, sum=>Sum(0), carry=>c1); u2:f_adder port map(a=>a(1), b=>b(1), cin=>c1, sum=>Sum(1), carry=>c2); u3:f_adder port map(a=>a(2), b=>b(2), cin=>c2, sum=>Sum(2), carry=>c3); u4:f_adder port map(a=>a(3), b=>b(3), cin=>c3, sum=>Sum(3), carry=>Cy); end Behavioral;
  • 7. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 5 out of 1200 0% Number of 4 input LUTs: 9 out of 2400 0% Number of bonded IOBs: 14 out of 96 14% Simulation Waveform
  • 8. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------16 bit Full Adder (Structural)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity adder_16bit is Port ( x : in std_logic_vector(15 downto 0); y : in std_logic_vector(15 downto 0); pre_carry : in std_logic; Sum : out std_logic_vector(15 downto 0); Carry : out std_logic); end adder_16bit; architecture Behavioral of adder_16bit is component adder_4bit is Port ( a : in std_logic_vector(3 downto 0); b : in std_logic_vector(3 downto 0); cin : in std_logic; Sum : out std_logic_vector(3 downto 0); Cy : out std_logic); end component; signal c1,c2,c3:std_logic; begin u1:adder_4bit port map(a=>x(3 downto 0), b=>y(3 downto 0), cin=>pre_carry, Sum=>Sum(3 downto 0), Cy=>c1); u2:adder_4bit port map(a=>x(7 downto 4), b=>y(7 downto 4), cin=>c1, Sum=>Sum(7 downto 4), Cy=>c2); u3:adder_4bit port map(a=>x(11 downto 8), b=>y(11 downto 8), cin=>c2, Sum=>Sum(11 downto 8), Cy=>c3); u4:adder_4bit port map(a=>x(15 downto 12), b=>y(15 downto 12), cin=>c3, Sum=>Sum(15 downto 12), Cy=>Carry); end Behavioral;
  • 9. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 19 out of 1200 1% Number of 4 input LUTs: 33 out of 2400 1% Number of bonded IOBs: 50 out of 96 52% Simulation Waveform
  • 10. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------4bit Magnitude Comparator (Structural)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity comp_4bit is Port ( a : in std_logic_vector(3 downto 0); b : in std_logic_vector(3 downto 0); altb : out std_logic; aeqb : out std_logic; agtb : out std_logic); end comp_4bit; architecture comp_arch of comp_4bit is component adder_4bit is Port ( a : in std_logic_vector(3 downto 0); b : in std_logic_vector(3 downto 0); cin : in std_logic; Sum : out std_logic_vector(3 downto 0); Cy : out std_logic); end component; component xnor_4 is port (s: in std_logic_vector(3 downto 0); t: in std_logic_vector(3 downto 0); v: out std_logic_vector(3 downto 0)); end component; component and_4 is port ( p,q,r,s:in std_logic; y:out std_logic); end component; component not_4 is port ( i:in std_logic_vector(3 downto 0); j:out std_logic_vector(3 downto 0)); end component; signal s1,s2,s3,s5,s6:std_logic_vector(3 downto 0); signal s4:std_logic:='0'; begin u1: adder_4bit port map ( a=>s1, b=>b, cin=>s4, Sum=>s5, Cy=>altb); u2: adder_4bit port map ( a=>s2, b=>a, cin=>s4, Sum=>s6, Cy=>agtb); u3: xnor_4 port map ( s=>a, t=>b, v=>s3);
  • 11. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon u4: and_4 port map ( p=>s3(3), q=>s3(2), r=>s3(1), s=>s3(0), y=>aeqb); u5: not_4 port map ( i=>a, j=>s1); u6: not_4 port map ( i=>b, j=>s2); end comp_arch; Entity Level Diagram Architectural Level Diagram
  • 12. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Device utilization summary: --------------------------- Number of Slices: 5 out of 1200 0% Number of 4 input LUTs: 9 out of 2400 0% Number of bonded IOBs: 11 out of 96 11% Simulation Waveform
  • 13. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------BCD up-down Counter------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity coun_bcd_updn is Port ( clk : in std_logic; reset : in std_logic; updn : in std_logic; count : out std_logic_vector(3 downto 0)); end coun_bcd_updn; architecture Behavioral of coun_bcd_updn is signal temp:std_logic_vector(3 downto 0); begin process(clk,reset) begin if(reset='1')then temp<="0000"; elsif(clk'event and clk='1')then if (updn='1')then if(temp=x"9")then temp<=x"0"; else temp<=temp+1; end if; else if(temp=x"0")then temp<=x"9"; else temp<=temp-1; end if; end if; end if; end process; count<=temp; end Behavioral; Entity Level Diagram
  • 14. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 6 out of 1200 0% Number of Slice Flip Flops: 4 out of 2400 0% Number of 4 input LUTs: 11 out of 2400 0% Number of bonded IOBs: 7 out of 96 7% Number of GCLKs: 1 out of 4 25% Simulation Waveform
  • 15. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------4bit Binary up-down Counter------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity counter_updn is Port ( clk : in std_logic; reset : in std_logic; updn: in std_logic; count : out std_logic_vector(3 downto 0)); end counter_updn; architecture Behavioral of counter_updn is signal temp:std_logic_vector(3 downto 0); begin process(clk,reset) begin if(reset='1')then temp<="0000"; elsif(clk'event and clk='1')then if (updn='1')then temp<=temp+1; else temp<=temp-1; end if; end if; end process; count<=temp; end Behavioral; Entity Level Diagram
  • 16. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 2 out of 1200 0% Number of Slice Flip Flops: 4 out of 2400 0% Number of 4 input LUTs: 4 out of 2400 0% Number of bonded IOBs: 7 out of 96 7% Number of GCLKs: 1 out of 4 25%
  • 17. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Simulation Waveform
  • 18. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------3:8 Decoder------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity deco_3_8 is Port ( input : in std_logic_vector(2 downto 0); en : in std_logic; output : out std_logic_vector(7 downto 0)); end deco_3_8; architecture Behavioral of deco_3_8 is begin process(input,en) begin if (en='0') then output<=(others=>'0'); else case input is when "000" => output<="00000001"; when "001" => output<="00000010"; when "010" => output<="00000100"; when "011" => output<="00001000"; when "100" => output<="00010000"; when "101" => output<="00100000"; when "110" => output<="01000000"; when others => output<="10000000"; end case; end if; end process; end Behavioral; Entity Level Diagram
  • 19. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 4 out of 192 2% Number of 4 input LUTs: 8 out of 384 2% Number of bonded IOBs: 12 out of 90 13% Simulation Waveform
  • 20. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------5:32 Decoder (Structural)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity deco_5_32 is Port ( i : in std_logic_vector(4 downto 0); En : in std_logic; y : out std_logic_vector(31 downto 0)); end deco_5_32; architecture dec_arch of deco_5_32 is component deco_2_4 is Port ( i : in std_logic_vector(1 downto 0); e : in std_logic; y : out std_logic_vector(3 downto 0)); end component; component deco_3_8 is Port ( input : in std_logic_vector(2 downto 0); en : in std_logic; output : out std_logic_vector(7 downto 0)); end component; signal s : std_logic_vector(3 downto 0); begin u1: deco_2_4 port map (i=>i(4 downto 3), e=>En, y=>s); u2: deco_3_8 port map (input=>i(2 downto 0), en=>s(3), output=>y(31 downto 24)); u3: deco_3_8 port map (input=>i(2 downto 0), en=>s(2), output=>y(23 downto 16)); u4: deco_3_8 port map (input=>i(2 downto 0), en=>s(1), output=>y(15 downto 8)); u5: deco_3_8 port map (input=>i(2 downto 0), en=>s(0), output=>y(7 downto 0)); end dec_arch;
  • 21. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 21 out of 192 10% Number of 4 input LUTs: 36 out of 384 9% Number of bonded IOBs: 38 out of 90 42%
  • 22. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Simulation Waveform
  • 23. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Encoder (When____Else)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity enco_8_3_when is Port ( i : in std_logic_vector(7 downto 0); y : out std_logic_vector(2 downto 0)); end enco_8_3_when; architecture Behavioral of enco_8_3_when is begin y<="000" when i="00000001" else "001" when i="00000010" else "010" when i="00000100" else "011" when i="00001000" else "100" when i="00010000" else "101" when i="00100000" else "110" when i="01000000" else "111" when i="10000000" else "ZZZ"; end Behavioral; -------Encoder (With____Select)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity enco_8_3_with is Port ( i : in std_logic_vector(7 downto 0); y : out std_logic_vector(2 downto 0)); end enco_8_3_with; architecture Behavioral of enco_8_3_with is begin with i select y<= "000" when "00000001", "001" when "00000010", "010" when "00000100", "011" when "00001000", "100" when "00010000", "101" when "00100000", "110" when "01000000", "111" when "10000000", "ZZZ" when others; end Behavioral;
  • 24. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 8 out of 192 4% Number of 4 input LUTs: 16 out of 384 4% Number of bonded IOBs: 11 out of 90 12%
  • 25. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Simulation Waveform
  • 26. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Priority Encoder------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity prio_enco is Port ( i : in std_logic_vector(7 downto 0); y : out std_logic_vector(2 downto 0)); end prio_enco; architecture Behavioral of prio_enco is begin process(i) begin if (i(7)='1')then y<="111"; elsif (i(6)='1')then y<="110"; elsif (i(5)='1')then y<="101"; elsif (i(4)='1')then y<="100"; elsif (i(3)='1')then y<="011"; elsif (i(2)='1')then y<="010"; elsif (i(1)='1')then y<="001"; elsif (i(0)='1')then y<="000"; else y<="ZZZ"; end if; end process; end Behavioral; Entity Level Diagram
  • 27. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 4 out of 192 2% Number of 4 input LUTs: 8 out of 384 2% Number of bonded IOBs: 11 out of 90 12% Simulation Waveform
  • 28. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Single Port RAM------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ram_1p is Port ( clk : in std_logic; we : in std_logic; addr : in std_logic_vector(4 downto 0); dio : inout std_logic_vector(3 downto 0)); end ram_1p; architecture Behavioral of ram_1p is type ram_type is array (31 downto 0) of std_logic_vector(3 downto 0); signal ram: ram_type; begin process (clk) begin if (clk'event and clk='1')then if (we='1')then ram(conv_integer(addr))<=dio; else dio<=ram(conv_integer(addr)); end if; end if; end process; end Behavioral; Entity Level Diagram
  • 29. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 8 out of 192 4% Number of Slice Flip Flops: 4 out of 384 1% Number of 4 input LUTs: 8 out of 384 2% Number of bonded IOBs: 11 out of 90 12% Number of GCLKs: 1 out of 4 25% Simulation Waveform
  • 30. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Dual Port RAM------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ram_2p is Port ( clk : in std_logic; we : in std_logic; addr : in std_logic_vector(4 downto 0); din : in std_logic_vector(3 downto 0); spo : out std_logic_vector(3 downto 0); dpo : out std_logic_vector(3 downto 0); x : in std_logic); end ram_2p; architecture Behavioral of ram_2p is type ram_type is array (31 downto 0) of std_logic_vector(3 downto 0); signal ram:ram_type; begin process(clk) begin if (clk'event and clk='1')then if(we='1')then ram(conv_integer(addr))<=din; end if; end if; end process; process(clk) begin if (clk'event and clk='1')then if (we='0')then if(x='0')then spo<=ram(conv_integer(addr)); else dpo<=ram(conv_integer(addr)); end if; end if; end if; end process; end Behavioral;
  • 31. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 10 out of 192 5% Number of Slice Flip Flops: 8 out of 384 2% Number of 4 input LUTs: 10 out of 384 2% Number of bonded IOBs: 20 out of 90 22% Number of GCLKs: 1 out of 4 25%
  • 32. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Simulation Waveform
  • 33. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------4:1 Multiplexer (CASE STATEMENT)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mux_4_1_case is Port ( a : in std_logic; b : in std_logic; c : in std_logic; d : in std_logic; s : in std_logic_vector(1 downto 0); y : out std_logic); end mux_4_1_case; architecture Behavioral of mux_4_1_case is begin process(a,b,c,d,s) begin case s is when "00" => y<= a; when "01" => y<= b; when "10" => y<= c; when others => y<= d; end case; end process; end Behavioral; -------4:1 Multiplexer (WHEN__ELSE STATEMENT)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mux_4_1_when_else is Port ( a : in std_logic; b : in std_logic; c : in std_logic; d : in std_logic; s : in std_logic_vector(1 downto 0); y : out std_logic); end mux_4_1_when_else; architecture Behavioral of mux_4_1_when_else is begin y<= a when s="00" else b when s="01" else c when s="10" else d; end Behavioral;
  • 34. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------4:1 Multiplexer (IF__ELSE STATEMENT)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mux_4_1_if is Port ( a : in std_logic; b : in std_logic; c : in std_logic; d : in std_logic; s : in std_logic_vector(1 downto 0); y : out std_logic); end mux_4_1_if; architecture Behavioral of mux_4_1_if is begin process(s,a,b,c,d) begin if (s="00") then y<=a; elsif (s="01") then y<=b; elsif (s="10") then y<=c; else y<=d; end if; end process; end Behavioral; -------4:1 Multiplexer (WITH___SELECT STATEMENT)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mux_4_1_with_select is Port ( a : in std_logic; b : in std_logic; c : in std_logic; d : in std_logic; s : in std_logic_vector(1 downto 0); y : out std_logic); end mux_4_1_with_select; architecture Behavioral of mux_4_1_with_select is begin with s select y<= a when "00", b when "01", c when "10", d when others; end Behavioral;
  • 35. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Entity Level Diagram Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 1 out of 192 0% Number of 4 input LUTs: 2 out of 384 0% Number of bonded IOBs: 7 out of 90 7% Simulation Waveform
  • 36. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------8:1 Multiplexer------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mux_8_1 is Port ( i : in std_logic_vector(7 downto 0); s : in std_logic_vector(2 downto 0); y : out std_logic); end mux_8_1; architecture Behavioral of mux_8_1 is begin with s select y<= i(0) when "000", i(1) when "001", i(2) when "010", i(3) when "011", i(4) when "100", i(5) when "101", i(6) when "110", i(7) when others; end Behavioral; Entity Level Diagram
  • 37. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 2 out of 192 1% Number of 4 input LUTs: 4 out of 384 1% Number of bonded IOBs: 12 out of 90 13% Simulation Waveform
  • 38. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Sequence Detector (Mealy 1011)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity mealy_1011 is Port ( clk : in std_logic; x : in std_logic; reset:in std_logic; z : out std_logic); end mealy_1011; architecture Behavioral of mealy_1011 is type state is (s0,s1,s2,s3); signal current:state; begin process(clk,x) begin if (reset='1')then current<=s0; z<='0'; elsif (clk'event and clk='1')then case current is when s0 => if (x='1')then current<=s1; z<='0'; else current<=s0; z<='0'; end if; when s1 => if (x='0')then current<=s2; z<='0'; else current<=s1; z<='0'; end if; when s2 => if (x='1')then current<=s3; z<='0'; else current<=s0; z<='0'; end if;
  • 39. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon when s3 => if (x='1')then current<=s1; z<='1'; else current<=s2; z<='0'; end if; when others=> null; end case; end if; end process; end Behavioral; Entity Level Diagram Architectural Level Diagram
  • 40. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 2 out of 768 0% Number of Slice Flip Flops: 3 out of 1536 0% Number of 4 input LUTs: 2 out of 1536 0% Number of bonded IOBs: 4 out of 96 4% Number of GCLKs: 1 out of 4 25% Simulation Waveform
  • 41. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Sequence Detector (Moore 1011)------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity moore_1011 is Port ( clk : in std_logic; x : in std_logic; reset:in std_logic; z : out std_logic); end moore_1011; architecture Behavioral of moore_1011 is type state is (s0,s1,s2,s3,s4); signal current:state; begin process(clk,x) begin if (reset='1')then current<=s0; elsif (clk'event and clk='1')then case current is when s0 => if (x='1')then current<=s1; else current<=s0; end if; when s1 => if (x='0')then current<=s2; else current<=s1; end if; when s2 => if (x='1')then current<=s3; else current<=s0; end if; when s3 => if (x='1')then current<=s4; else current<=s3; end if;
  • 42. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon when others=> current<=s0; end case; end if; end process; z<='1' when current=s4 else '0'; end Behavioral; Entity Level Diagram Architectural Level Diagram
  • 43. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 2 out of 768 0% Number of Slice Flip Flops: 3 out of 1536 0% Number of 4 input LUTs: 3 out of 1536 0% Number of bonded IOBs: 4 out of 96 4% Number of GCLKs: 1 out of 4 25% Simulation Waveform
  • 44. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon -------Shift Register using Generate Statement------ library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity shift_generate is Port ( sin : in std_logic; clk : in std_logic; reset : in std_logic; sout : out std_logic); end shift_generate; architecture Behavioral of shift_generate is component d_ff is Port ( d : in std_logic; clk : in std_logic; reset : in std_logic; q : out std_logic); end component; signal temp:std_logic_vector(4 downto 0); begin temp(0)<=sin; sreg:for i in 0 to 3 generate u:d_ff port map (d=>temp(i), clk=>clk, reset=>reset, q=>temp(i+1)); end generate; sout<=temp(4); end Behavioral; Entity Level Diagram
  • 45. Digital System Design Department of Electronics Engg., P.V.P.I.T., Budhgaon Architectural Level Diagram Device utilization summary: --------------------------- Number of Slices: 2 out of 1200 0% Number of Slice Flip Flops: 4 out of 2400 0% Number of bonded IOBs: 4 out of 96 4% Number of GCLKs: 1 out of 4 25% Simulation Waveform