EC0324 VLSI Lab Manual - Latest
EC0324 VLSI Lab Manual - Latest
OR
AND
Description
The output is active high
if any one of the input is
in active high state,
Mathematically,
Q = A+B
Truth Table
A B Output Q
0
0 0
1 1
0 1
1 1 1
The output is active high A B Output Q
only if both the inputs are
in active high
state, 0 0 0
Mathematically,
Q = A.B
0 1 0
1
NOT
0 0
1 1 1
A
Output Q
1
0
Logic Symbol
Pin Diagram
NOR
NAND
0 0
1 1 0
The output is active high A B Output Q
only if any one of the
input is in active low 0 0 1
state, Mathematically,
Q = A.B
0 1 1
1
0 1
1 1 0
The output is active high A B Output Q
only if any one of the
input is in active high 0 0 0
state, Mathematically,
Q=A B
0 1 1
EXOR
0 1
1 0
7486
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity Logic_gates is
Port ( A, B, : in std_logic;
Y_OR,Y_AND,Y_NOT,Y_NOR,Y_NAND,Y_EXOR : out std_logic);
end Lgic_gates;
architecture LG of Logic_gates is
begin
Y_OR <= A or B;
Y_AND <= A and B;
Y_NOT <= not A ;
Y_NOR <= A nor B;
Y_NAND <= A nand B;
Y_EXOR <= A xor B;
end LG;
Lab Report
Each individual will be required to submit a lab report. Use the format specified in the "Lab
Report Requirements document available on the class web page. Be sure to include the following
items in your lab report:
Lab cover sheet with staff verification sign.
Answer the pre-lab questions
Complete VHDL code design for all logic gates and output signal waveforms
Answer the post-lab questions
Grading
Pre-lab Work
Lab Performance
Post-lab Work
Lab report
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the logic gates to
your staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each logic gates
Output signal waveform for all logic gates and its truth table
15 points
15 points
100
200
300
400
1
1
500
// Half Subtractor
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
5
600
700
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity halfsubtractor is
Port ( a, b : in std_logic; difference, borrow : out std_logic);
end halfsubtractor;
architecture halfsubtractor of halfsubtractor is
signal abar : std_logic;
begin
abar <= not a;
difference <= a xor b;
borrow
end halfsubtractor;
100
200
300
400
1
1
500
Differe
Borrow
// Full Adder
// Dataflow Description
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity FA_dataflow is
Port ( A, B, Cin : in std_logic;
SUM, Cout : out std_logic);
6
600
700
800
900
1000
1100
end FA_dataflow;
architecture FA_dataflow of FA_dataflow is
begin
SUM <= A xor B xor Cin;
Cout <= (A and B) or (A and Cin) or (B and Cin);
end FA_dataflow;
// Structural Description
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity onebitFA is
Port ( a, b, cin : in std_logic; Sum, cout : out std_logic);
end onebitFA;
architecture onebitFA of onebitFA is
component xor2
port (a, b : in std_logic; c : out std_logic);
end component;
component and2
port (a, b : in std_logic; c : out std_logic);
end component;
component or3
port (a, b, c : in std_logic; d
: out std_logic);
end component;
signal y1,y2,y3,y4 : std_logic;
begin
7
Cin
100
200
300
400
500
600
700
800
1
1
1
900
Co
// Full Subtractor
// Structural Description
8
1000
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity onebitFS is
Port ( A, B, Bin : in std_logic;
D, Bout : out std_logic);
end onebitFS;
architecture onebitFS of onebitFS is
component and3
port ( a,b,c :
in
std_logic; d :
out std_logic);
end component;
component and2
port ( a,b : in std_logic; c : out std_logic);
end component;
component or3
port ( a,b,c : in std_logic; d : out std_logic);
end component;
component or4
port ( a,b,c,d
: in std_logic; e :
out std_logic);
end component;
signal Abar, Bbar, Binbar : std_logic;
signal y : std_logic_vector(6 downto 0);
begin
Abar <= not A;
Bbar <= not B;
9
Time (n
Bin
100
200
300
400
500
600
700
800
1
1
1
1000
1100
900
Bo
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the logic gates to
your staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
11
15 points
15 points
1200
3.
4.
5.
6.
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity V4to1mux_s is
Port ( S : in std_logic_vector(1 downto 0);
A, B, C, D : in std_logic;
Y : out std_logic);
end V4to1mux_s;
architecture V4to1mux_s of V4to1mux_s is
component and3
port (A,B,C : in std_logic;
D
: out std_logic);
end component;
component or4
port (A,B,C,D : in std_logic;
E
: out std_logic);
end component;
signal s1_L, s0_L, x1, x2, x3, x4 : std_logic;
begin
s1_L <= not s(1);
s0_L <= not s(0);
u1 : and3 port map (a, s1_L, s0_L, x1);
u2 : and3 port map (b, s1_L, s(0), x2);
u3 : and3 port map (c, s(1), s0_L, x3);
u4 : and3 port map (d, s(1), s(0) ,x4);
u5 : or4 port map (x1,x2, x3,x4,Y);
16
end V4to1mux_s;
100
200
300
400
500
600
700
1111
1101
1011
1001
0111
0101
0011
0001
S[1:0
00
01
10
11
00
01
10
11
Enab
800
// Demultiplexer
// BEHAVIORAL DESCRIPTION OF 1 TO 4 DEMUX
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity V1to4demux_b is
Port ( Din : in std_logic;
E : in std_logic;
S : in std_logic_vector(1 downto 0);
Y : out std_logic_vector(0 to 3));
end V1to4demux_b;
architecture V1to4demux_b of V1to4demux_b is
signal Z : std_logic_vector (0 to 3);
begin
process (Din,E,S)
begin
if Din = '0' then
case S is
when "00" | "01" | "10" | "11" => Z <= "0000";
17
900
1000
1100
1200
end process;
end v1to4demux_b;
// STRUCTURAL DESCRIPTION OF 1 TO 4 DEMUX
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity V1to4demux_s is
Port ( Din : in std_logic;
E : in std_logic;
S : in std_logic_vector(1 downto 0);
Y : out std_logic_vector(0 to 3));
end V1to4demux_s;
architecture V1to4demux_s of V1to4demux_s is
18
end if;
component and4
port (A,B,C,D : in std_logic; E : out std_logic);
end component;
signal S1_L, S0_L : std_logic;
begin
S1_L <= not S(1);
S0_L <= not S(0);
S[1:0
00
Y[3:
100
200
300
400
1
01
0000
10
0010
11
0000
500
600
700
800
900
1000
1100
1200
00
1000
01
0000
10
0010
11
0000
00
0000
01
0000
10
0010
11
0000
00
0000
Lab Report
Each individual will be required to submit a lab report. Use the format specified in the "Lab
Report Requirements" document available on the class web page. Be sure to include the following
items in your lab report:
Lab cover sheet with staff verification sign.
Answer the pre-lab questions
Complete VHDL code design for all logic gates and output signal waveforms
Answer the post-lab questions
19
0000
Grading
Pre-lab Work
Lab Performance
Post-lab Work
Lab report
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the logic gates to
your staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
20
15 points
15 points
Introduction
The purpose of this experiment is to introduce you to the basics of Encoders and Decoders. In this
lab, you have to implement Priority Encoder and the Boolean function using Decoders.
4.2
4.3
Block Diagram
21
entity Oct2Bin_b is
23
D is
when "10000000" => z <= "000";
when "01000000" => z <= "001";
when "00100000" => z <= "010";
when "00010000" => z <= "011";
when "00001000" => z <= "100";
when "00000100" => z <= "101";
when "00000010" => z <= "110";
when "00000001" => z <= "111";
when others
end case;
if E = '1' then Y <= z; else Y <= "XXX"; end if;
end process;
end Oct2Bin_b;
// STRUCTURAL DESCRIPTION OF 8 TO 3 ENCODER
library IEEE;
24
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity oct2bin_s is
Port ( D : in std_logic_vector(0 to 7);
Y : out std_logic_vector(2 downto 0));
end oct2bin_s;
architecture oct2bin_s of oct2bin_s is
component or4
port(A,B,C,D : in std_logic; E : out std_logic);
end component;
begin
u1 : or4 port map (D(4),D(5),D(6),D(7),Y(2));
u2 : or4 port map (D(2),D(3),D(6),D(7),Y(1));
u3 : or4 port map (D(1),D(3),D(5),D(7),Y(0));
end oct2bin_s;
TEST BENCH WAVEFORMS FOR ENCODER
Time (ns)
in[7:0]
out[2:
100
200
300
400
500
600
700
800
00000001
00000010
00000100
00001000
00010000
00100000
01000000
10000000
10000001
000
001
010
011
100
101
110
111
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity V2to4dec_S is
Port ( A, B, E : in std_logic;
Y : out std_logic_vector(3 downto 0));
end V2to4dec_S;
architecture V2to4dec_S of V2to4dec_S is
component and3
port (a,b,c : in std_logic; d : out std_logic);
end component;
signal Abar, Bbar : std_logic;
begin
Abar <= not A;
Bbar <= not B;
100
200
300
400
500
600
700
in[1:0
00
01
10
11
00
01
10
11
out[3:
0001
0010
0100
1000
26
0001
0010
0100
800
1000
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the logic gates to
your staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
27
15 points
15 points
28
Characteristic
Equation
Excitation Table
SR
JK
R Q(next)
Q Q(next) S R
K Q(next)
Q Q(next) J K
0 X
1 X
X 1
X 0
Q(next) = S + RQ
SR = 0
Q(next) = JQ + KQ
Q(next)
Q(next) = D
Q(next)
Q(next) = TQ + TQ
0 X
X 0
Q Q(next)
Q Q(next)
Describe the main difference between a gated S-R latch and an edge-triggered S-R flip-flop.
How does a JK flip-flop differ from an SR flip-flop in its basic operation?
Describe the basic difference between pulse-triggered and edge-triggered flip-flops.
What is use of characteristic and excitation table?
What are synchronous and asynchronous circuits?
How many flip flops due you require storing the data 1101?
What is propagation delays set up time and hold time?
How to generate clock signal in VHDL?
What are the different wait statements?
q<=not(t);
else
q<=t;
end if;
end process;
qbar<=not(q);
end beh;
// D Flip Flop
library ieee;
use ieee.std_logic_1164.all;
Entity dff is
Port(d,clk :in std_logic; q,qbar :inout std_logic) ;
End dff ;
31
// JK Flip Flop
library ieee;
use ieee.std_logic_1164.all;
Entity jkff is
Port(j,k,clk :in std_logic; q,qbar :inout std_logic) ;
End jkff ;
a. JK to T f/f
b. SR to D
6. Write the VHDL code for question no 5.
Lab Report
Each individual will be required to submit a lab report. Use the format specified in the "Lab
Report Requirements" document available on the class web page. Be sure to include the following
items in your lab report:
Lab cover sheet with staff verification for circuit diagram
Answer the pre-lab questions
Complete paper design for all three designs including K-maps and minimized equations and
the truth table for each of the output signals.
Answer the post-lab questions
Grading
Pre-lab Work
Lab Performance
Post-lab Work
Lab report
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the circuits to your
staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
33
15 points
15 points
34
end up_down_counter;
architecture up_down_counter of up_down_counter is
signal z : std_logic_vector(3 downto 0);
begin
process(CLK, enable)
begin
if(CLK='1' and CLK'event) then
if(enable='1') then
if(load='1') then z <= D;
else
if(mode='0') then z <= signed(z)+'1';
elsif(mode='1') then z <= signed(z)-'1';
end if;
end if;
else z <= "0000";
end if;
end if;
end process;
count <= z;
end up_down_counter;
TEST BENCH WAVEFORMS FOR UP-DOWN COUNTERS
Time (ns)
CLK
Data_in[3
up_down
reset
count_en
load
count[3:0]
100
200
300
400
500
600
700
800
900
10
1
0
// Ring Counter
0
1
1
0
2
0
4
36
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity ring_counter is
Port ( CLK : in std_logic;
reset : in std_logic;
enable : in std_logic;
count : out std_logic_vector(7 downto 0));
end ring_counter;
architecture ring_counter of ring_counter is
signal z : std_logic_vector(7 downto 0);
begin
process(reset, CLK)
begin
if(CLK='1' and CLK'event) then
if (reset='1')
else
if(enable='1') then z <= z(6 downto 0) & z(7);
end if;
end if;
end if;
end process;
count <= z;
end ring_counter;
37
Reset
Enable
Count[7:
100
200
300
400
500
6
7
0
00000001
00000010
00000100
// Shift Register
library ieee;
use ieee.std_logic_1164.all;
entity dff is
port(d,clk:in bit;
pre,clr:in bit;
q,qb:buffer bit);
end dff;
00001000
00010000
00100000
end if;
end process;
end dff_bhv;
// SISO
library ieee;
use ieee.std_logic_1164.all;
entity siso is
port(d:in bit_vector(3 downto 0);
din:in bit;
clk,pre,clr:in bit;
q,qb:buffer bit_vector(3 downto 0));
end siso;
// PIPO
library ieee;
use ieee.std_logic_1164.all;
entity pipo is
port(d:in bit_vector(3 downto 0);
--din:in bit;
clk,pre,clr:in bit;
q,qb:buffer bit_vector(3 downto 0));
end pipo;
architecture pipo_str of pipo is
component dff
port(d,clk:in bit;
pre,clr:in bit;
q,qb:buffer bit);
end component;
begin
f1:dff port map(d(0),clk,pre,clr,q(0),open);
f2:dff port map(d(1),clk,pre,clr,q(1),open);
f3:dff port map(d(2),clk,pre,clr,q(2),open);
f4:dff port map(d(3),clk,pre,clr,q(3),open);
end pipo_str;
// SERIAL-IN SERIAL-OUT SHIFT REGISTER USING GENERATE AND GENERIC
STATEMENTS
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
40
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity shift_reg is
generic (length : integer :=4);
Port ( Din, CLK : in std_logic;
Dout : out std_logic);
end shift_reg;
component DFF
port(D,CLK : in std_logic; Q,QN : out std_logic);
end component;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity shifter2 is
Port ( data : in std_logic_vector(3 downto 0);
load, enable, clock : in std_logic;
mode : in std_logic_vector(1 downto 0);
Y : out std_logic_vector(3 downto 0));
end shifter2;
architecture shifter2 of shifter2 is
signal z : std_logic_vector(3 downto 0);
begin
process (clock)
begin
if(clock='1' and clock'event) then
if(load='0') then z <= data;
else
case mode is
when "00" => z <= z(2 downto 0) & '0';
when "01" => z <= '0' & z(3 downto 1) ;
when "10" => z <= z(0) & z(3 downto 1) ;
when "11" => z <= z(2 downto 0) & z(3);
when others => z <= "0000";
end case;
end if;
end if;
end process;
Y <= z when enable='0' else "0000";
end shifter2;
Grading
Pre-lab Work
Lab Performance
Post-lab Work
Lab report
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the circuits to your
staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
15 points
15 points
43
2.
3.
4.
5.
100
200
300
400
500
600
700
800
900
1000
1100
1200
B[3:0
P[7:0
00
01
04
09
10
19
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity braun_array is
Port ( A, B : in std_logic_vector(3 downto 0);
P : out std_logic_vector(7 downto 0));
end braun_array;
46
24
31
40
51
64
59
90
component FA_dataflow
port(A,B,Cin : std_logic; SUM,Cout : out std_logic);
end component;
begin
G0 : and2 port map(A(0), B(0), K(0));
G1 : and2 port map(A(1), B(0), K(1));
G2 : and2 port map(A(2), B(0), K(2));
G3 : and2 port map(A(3), B(0), K(3));
G4 : and2 port map(A(0), B(1), K(4));
G5 : and2 port map(A(1), B(1), K(5));
G6 : and2 port map(A(2), B(1), K(6));
G7 : and2 port map(A(3), B(1), K(7));
G8 : and2 port map(A(0), B(2), K(8));
G9 : and2 port map(A(1), B(2), K(9));
G10 : and2 port map(A(2), B(2), K(10));
G11 : and2 port map(A(3), B(2), K(11));
G12 : and2 port map(A(0), B(3), K(12));
G13 : and2 port map(A(1), B(3), K(13));
47
Time (ns)
A[3:0
100
200
300
400
500
600
700
800
900
1000
1100
1200
B[3:0
P[7:0
00
01
04
09
10
19
24
31
40
51
64
7.6 Postlab:
1. How to design 32bitX32bit multiplier from 8 bit multiplier.
2. Write the VHDL code for the above design.
3. How to perform multiplication for negative numbers?
4. Draw the architecture of 4-BIT Bough-Wooly Multiplier.
Lab Report
Each individual will be required to submit a lab report. Use the format specified in the "Lab
48
79
90
Report Requirements" document available on the class web page. Be sure to include the following
items in your lab report:
Lab cover sheet with staff verification for circuit diagram
Answer the pre-lab questions
Complete paper design for all three designs including K-maps and minimized equations and
the truth table for each of the output signals.
Answer the post-lab questions
Grading
Pre-lab Work
Lab Performance
Post-lab Work
Lab report
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the circuits to your
staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
15 points
15 points
49
1. What is ALU?
2. What are the operations can be done by using ALU?
3. What are the predefined Attributes?
8.5 VHDL Program
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity alu is
Port ( A, B : in std_logic_vector(7 downto 0);
sel : in std_logic_vector(4 downto 0);
F : out std_logic_vector(7 downto 0));
50
end alu;
architecture alu of alu is
begin
process(sel,A,B)
begin
case conv_integer(sel) is
--
when 0 =>
F <=A;
when 1 =>
F <=A+"00000001";
when 2 =>
F <=B;
when 3 =>
F <=B+"00000001";
when 4 =>
F <=A-"00000001";
when 5 =>
F <=B-"00000001";
when 6 =>
F <=A+B;
when 7 =>
F <=A+B+"00000001";
when 8 =>
F <=A-B;
when 9 =>
F <=A-B-"00000001";
when 10 =>
F <=signed(A) * signed(B);
when 11 =>
F <="XXXXXXXX";
when 12 =>
F <=A or B;
when 13 =>
F <=A nor B;
when 14 =>
F <=A and B;
when 15 =>
F <=A nand B;
when 16 =>
F <=A xor B;
when 17 =>
F <=A xnor B;
when 18 =>
F <=not A;
when 19 =>
F <=not B;
51
when 20 =>
F <="XXXXXXXX";
when 21 =>
F <="XXXXXXXX";
when 22 =>
when 23 =>
when 24 =>
when 25 =>
when 26 =>
when 27 =>
when 28 =>
when 29 =>
100
200
300
400
500
600
700
800
900
1000
1100
1200
A[7:0]
00
10
20
30
40
50
60
70
80
90
A0
B0
C0
B[7:0]
F0
D0
B0
90
70
50
30
10
E0
C0
A0
80
60
select[4:0]
00
02
04
06
08
0A
0C
0E
10
12
14
16
18
F[15:0]
0000
00D0
001F
00C0
FFD0
1900
0070
0010
0060
FF6F
0000
0058
00
ALU_zero_
Time (ns)
100
200
300
400
500
600
700
800
900
1000
1100
1200
A[7:0]
00
10
20
30
40
50
60
70
80
90
A0
B0
C0
B[7:0]
F0
D0
B0
90
70
50
30
10
E0
C0
A0
80
60
select[4:0]
01
03
05
07
09
0B
0D
0F
11
13
15
17
19
F[15:0]
ALU_zero_
0001
00D1
00AF
00C1
FFCF
0001
FF8F
FFEF
FF9F
FF3F
0000
0058
003
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the circuits to your
staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments and its truth table
15 points
15 points
53
entity ram_sp_ar_sw is
generic (
DATA_WIDTH :integer := 8;
54
ADDR_WIDTH :integer := 8
);
port (
clk
:in std_logic;
-- Clock Input
:in std_logic;
-- Chip Select
we
:in std_logic;
oe
:in std_logic
-- Output Enable
);
end entity;
architecture rtl of ram_sp_ar_sw is
----------------Internal variables---------------constant RAM_DEPTH :integer := 2**ADDR_WIDTH;
signal data_out :std_logic_vector (DATA_WIDTH-1 downto 0);
type RAM is array (integer range <>)of std_logic_vector (DATA_WIDTH-1 downto 0);
signal mem : RAM (0 to RAM_DEPTH-1);
begin
----------------Code Starts Here------------------- Tri-State Buffer control
-- output : When we = 0, oe = 1, cs = 1
data <= data_out when (cs = '1' and oe = '1' and we = '0') else (others=>'Z');
-- Memory Write Block
-- Write Operation : When we = 1, cs = 1
MEM_WRITE:
process (clk) begin
55
if (rising_edge(clk)) then
if (cs = '1' and we = '1') then
mem(conv_integer(address)) <= data;
end if;
end if;
end process;
-- Memory Read Block
-- Read Operation : When we = 0, oe = 1, cs = 1
MEM_READ:
process (clk) begin
if (rising_edge(clk)) then
if (cs = '1' and we = '0' and oe = '1') then
data_out <= mem(conv_integer(address));
end if;
end if;
end process;
end architecture;
TEST BENCH WAVEFORM FOR RAM
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the circuits to your
staff in-charge.
The lab report will be graded as follows (for the 30 points):
VHDL code for each experiments
Output signal waveform for all experiments
15 points
15 points
10.2
Equipments:
Computer with Modelsim Software
Specifications:
HP Computer P4 Processor 2.8 GHz, 2GB RAM, 160 GB Hard Disk
Softwares: Modelsim - 5.7c, Xilinx - 6.1i.
10.3
State Diagram
57
Present State
Figure 10.2 Mealy Machine
10.4
1
2
3
10.5
VHDL Program
58
process(CLOCK)
begin
if CLOCK=0 then
case Moore_State is
when ST0=>
Z<=1;
if A=1
then Moore_State<=ST2;
end if;
when ST1=>
Z<=0;
if A=1 then
Moore_State<=ST3;
end if;
when ST2=>
Z<=0;
if A=0 then
Moore_State<=ST1;
else
Moore_State<=ST3;
end if;
when ST3=>
Z<=1;
if A=1 then
Moore_State<=ST0;
end if;
59
end case;
end if;
end process;
end Fsm_Example;
entity Mealy_Fsm is
port(A, CLOCK:in bit; Z:out std_logic);
end Mealy_Fsm;
case P_State is
when ST0=>
if A=1 then
Z<=1;
N_State<=ST3;
else
Z<=0;
end if;
when ST1=>
if A=1 then
Z<=0;
N_State<=ST0;
else
Z<=1;
end if;
when ST2=>
if A=0 then
Z<=0;
else
Z<=1;
N_State<=ST1;
end if;
when ST3=>
Z<=0;
if A=0 then
N_State<=ST2;
61
else
N_State<=ST1;
end if;
end case;
end if;
end process COMB_PART;
end Fsm_Example;
20 points
30 points
20 points
30 points
For the lab performance - at a minimum, demonstrate the operation of all the logic gates to
your staff in-charge
The lab report will be graded as follows (for the 30 points):
VHDL code for each state machine
Output signal waveform for both design
62
15 points
15 points