Expt 5 Final Amisha
Expt 5 Final Amisha
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entitylcd is
Port ( clk,reset : in std_logic;
RS,EN,RW : out std_logic;
data : out std_logic_vector(7 downto 0));
endlcd;
architecture Behavioral of lcd is
type state_type is (s0,s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,
s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23);
signalstate:state_type;
SIGNAL count:std_logic_vector(22 downto 0);
SIGNAL clk1:std_logic;
begin
process(Clk,Reset)
begin
if(Clk' event AND Clk='1')then
count<=count+"0001";
end if;
clk1<=count(20);
end process;
RW<='0';
process(clk1, reset)
begin
if reset = '1' then
state<= s0;
elsifrising_edge(clk1) then
if state = s0 then
state<= s1;
RS<='0'; -- Write commonds to LCD.
EN <= '1';
data <= "00110000"; -- Function set for 8 bit interface, 1 line mode and
5x7 dot matrix.
end if;
if state = s1 then
state<= s2;
EN <= '0';
end if;
if state = s2 then
state<= s3;
EN <= '1';
data<= "00001111"; -- Display cursor and blinking ON.
end if;
if state = s3 then
state<= s4;
EN <= '0';
end if;
if state = s4 then
state<= s5;
EN <= '1';
data<= "00000001"; -- Clear display.
end if;
if state = s5 then
state<= s6;
EN <= '0';
end if;
if state = s6 then
state<= s7;
EN <= '1';
data<= "10000100"; -- Display address.
end if;
if state = s7 then
state<= s8;
EN <= '0';
end if;
if state = s8 then
RS <= '1'; -- Write data to LCD.
state<= s9;
EN <= '1';
data<= "00101010"; --(*)
end if;
if state = s9 then
state<= s10;
EN <= '0';
end if;
if state = s10 then
state<= s11;
EN <= '1';
data<= "01010011"; --S
end if;
if state = s11 then
state<= s12;
EN <= '0';
end if;
if state = s12 then
state<= s13;
EN <= '1';
data<= "01001011"; --K
end if;
if state = s13 then
state<= s14;
EN <= '0';
end if;
if state = s14 then
state<= s15;
EN <= '1';
data<= "01001110"; --N
end if;
if state = s15 then
state<= s16;
EN <= '0';
end if;
if state = s16 then
state<= s17;
EN <= '1';
data<= "01000011"; --C
end if;
if state = s17 then
state<= s18;
EN <= '0';
end if;
if state = s18 then
state<= s19;
EN <= '1';
data<= "01001111"; --O
end if;
if state = s19 then
state<= s20;
EN <= '0';
end if;
if state = s20 then
state<= s21;
EN <= '1';
data<= "01000101"; --E
end if;
if state = s21 then
state<= s22;
EN <= '0';
end if;
if state = s22 then
state<= s23;
EN <= '1';
data<= "00101010"; --(*)
end if;
if state = s23 then
EN <= '0';
end if;
end if;
end process;
end Behavioral;
Testbench:
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY lcdtest IS
END lcdtest;
COMPONENT lcd
PORT(
clk1 : IN std_logic;
reset : IN std_logic;
RS : OUT std_logic;
EN : OUT std_logic;
RW : OUT std_logic;
data : OUT std_logic_vector(7 downto 0)
);
END COMPONENT;
--Inputs
signal clk1 : std_logic := '0';
signal reset : std_logic := '0';
--Outputs
signal RS : std_logic;
signal EN : std_logic;
signal RW : std_logic;
signal data : std_logic_vector(7 downto 0);
BEGIN
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
reset<='0';
wait;
end process;
END;
UCF:
NET data(0) LOC =P62;
NET data(1) LOC =P63;
NET data(2) LOC =P64;
NET data(3) LOC =P65;
NET data(4) LOC =P67;
NET data(5) LOC =P68;
NET data(6) LOC =P71;
NET data(7) LOC =P72;
NET Clk LOC =P183;
NET reset LOC =P102;
NET RS LOC =P57;
NET EN LOC =P61;
NET RW LOC =P58;
TABLE OF CONTENTS
1) Synthesis Options Summary
2) HDL Compilation
3) Design Hierarchy Analysis
4) HDL Analysis
5) HDL Synthesis
5.1) HDL Synthesis Report
6) Advanced HDL Synthesis
6.1) Advanced HDL Synthesis Report
7) Low Level Synthesis
8) Partition Report
9) Final Report
9.1) Device utilization summary
9.2) Partition Resource Summary
9.3) TIMING REPORT
=========================================================================
* Synthesis Options Summary *
=========================================================================
---- Source Parameters
Input File Name : "lcd.prj"
Input Format : mixed
Ignore Synthesis Constraint File : NO
---- Target Parameters
Output File Name : "lcd"
Output Format : NGC
Target Device : xc3s400-4-pq208
=========================================================================
=========================================================================
* HDL Compilation *
=========================================================================
Compiling vhdl file "C:/.Xilinx/lcd/lcd.vhd" in Library work.
Architecture behavioral of Entity lcd is up to date.
=========================================================================
* Design Hierarchy Analysis *
=========================================================================
Analyzing hierarchy for entity <lcd> in library <work> (architecture <behavioral>).
=========================================================================
* HDL Analysis *
=========================================================================
Analyzing Entity <lcd> in library <work> (Architecture <behavioral>).
WARNING:Xst:819 - "C:/.Xilinx/lcd/lcd.vhd" line 36: One or more signals are missing in the process
sensitivity list. To enable synthesis of FPGA/CPLD hardware, XST will assume that all necessary signals
are present in the sensitivity list. Please note that the result of the synthesis may differ from the initial
design specification. The missing signals are:
<count>
Entity <lcd> analyzed. Unit <lcd> generated.
=========================================================================
* HDL Synthesis *
=========================================================================
=========================================================================
HDL Synthesis Report
Macro Statistics
# Counters :1
23-bit up counter :1
# Registers :3
1-bit register :2
8-bit register :1
=========================================================================
=========================================================================
* Advanced HDL Synthesis *
=========================================================================
=========================================================================
Advanced HDL Synthesis Report
Macro Statistics
# FSMs :1
# Counters :1
23-bit up counter :1
# Registers : 10
Flip-Flops : 10
=========================================================================
=========================================================================
* Low Level Synthesis *
=========================================================================
WARNING:Xst:2677 - Node <count_21> of sequential type is unconnected in block <lcd>.
WARNING:Xst:2677 - Node <count_22> of sequential type is unconnected in block <lcd>.
Macro Statistics
# Registers : 55
Flip-Flops : 55
=========================================================================
=========================================================================
* Partition Report *
=========================================================================
-------------------------------
=========================================================================
* Final Report *
=========================================================================
Final Results
RTL Top Level Output File Name : lcd.ngr
Top Level Output File Name : lcd
Output Format : NGC
Optimization Goal : Speed
Keep Hierarchy : No
Design Statistics
# IOs : 13
Cell Usage :
# BELS : 92
# GND :1
# INV :2
# LUT1 : 20
# LUT2 :1
# LUT2_L :3
# LUT3 :3
# LUT3_D :1
# LUT4 : 14
# LUT4_D :1
# LUT4_L :4
# MUXCY : 20
# VCC :1
# XORCY : 21
# FlipFlops/Latches : 55
# FD : 21
# FDC : 22
# FDCE :1
# FDE : 10
# FDP :1
# Clock Buffers :2
# BUFG :1
# BUFGP :1
# IO Buffers : 12
# IBUF :1
# OBUF : 11
=========================================================================
---------------------------
Partition Resource Summary:
---------------------------
---------------------------
=========================================================================
TIMING REPORT
Clock Information:
------------------
-----------------------------------+------------------------+-------+
Clock Signal | Clock buffer(FF name) | Load |
-----------------------------------+------------------------+-------+
count_201 | BUFG | 34 |
Clk | BUFGP | 21 |
-----------------------------------+------------------------+-------+
Timing Summary:
---------------
Speed Grade: -4
Timing Detail:
--------------
All values displayed in nanoseconds (ns)
=========================================================================
Timing constraint: Default period analysis for Clock 'count_201'
Clock period: 6.071ns (frequency: 164.717MHz)
Total number of paths / destination ports: 193 / 33
-------------------------------------------------------------------------
Delay: 6.071ns (Levels of Logic = 3)
Source: state_FSM_FFd4 (FF)
Destination: EN (FF)
Source Clock: count_201 rising
Destination Clock: count_201 rising
=========================================================================
Timing constraint: Default OFFSET IN BEFORE for Clock 'count_201'
Total number of paths / destination ports: 10 / 10
-------------------------------------------------------------------------
Offset: 4.921ns (Levels of Logic = 2)
Source: reset (PAD)
Destination: EN (FF)
Destination Clock: count_201 rising
=========================================================================
Timing constraint: Default OFFSET OUT AFTER for Clock 'count_201'
Total number of paths / destination ports: 10 / 10
-------------------------------------------------------------------------
Offset: 7.241ns (Levels of Logic = 1)
Source: EN (FF)
Destination: EN (PAD)
Source Clock: count_201 rising
Data Path: EN to EN
Gate Net
Cell:in->out fanout Delay Delay Logical Name (Net Name)
---------------------------------------- ------------
FDE:C->Q 2 0.720 0.877 EN (EN_OBUF)
OBUF:I->O 5.644 EN_OBUF (EN)
----------------------------------------
Total 7.241ns (6.364ns logic, 0.877ns route)
(87.9% logic, 12.1% route)
=========================================================================
-->