Implementation of Digital Clock On FPGA: Industrial Training Report ON
Implementation of Digital Clock On FPGA: Industrial Training Report ON
ON
By
Sonam Singhal (2014BEC1161)
Finally, I would like to thank each member of Tech Adityaa family for making me
feel comfortable and helping me in every possible manner.
Index
1 General Description
2 System Requirements
2.1 General Requirements
2.2 Functional Requirements
2.3 Memory Requirements
3 Overview of FPGA
3.1 Introduction
3.2 Features
5 Design Summary
5.1 Block Diagram
5.2 RTL Schematic
6 Working
7 Appendix
7.1 Verilog Code-Alarm.v
8 Conclusion
9 Refrences
1. General Description
The Digital Alarm Clock system has the following general requirements:
• It should use low power
• The cost of production should be low
• The software architecture must be modular
The Digital Alarm Clock system should have following Functional Requirements:
The clock timing should be accurate i.e. no glitches should be present.
The design should use power judiciously.
The speaker should play the sound clearly and should be synchronized.
No permanent storage is required. All the data is stored on the programming stack
3. Overview of the FPGA
3.1 Introduction
The Spartan-3 family is a superior alternative to mask programmed ASICs. FPGAs avoid the
high initial cost, the lengthy development cycles, and the inherent inflexibility of
conventional ASICs. Also, FPGA programmability permits design upgrades in the field with no
hardware replacement necessary, an impossibility with ASICs.
3.2 Features
These elements are organized as shown in Figure below. A ring of IOBs surrounds a regular
array of CLBs.
The Configurable Logic Blocks (CLBs) constitute the main logic resource for implementing
synchronous as well as combinatorial circuits. Each CLB comprises four interconnected slices.
These slices are grouped in pairs. Each pair is organized as a column with an independent
carry chain.
Local routing provides feedback between slices in the same CLB, and it
provides routing to neighboring CLBs
A switch matrix provides access to general routing resources
Each slice has four outputs
Two registered outputs, two non-registered outputs
Two BUFTs associated with each CLB, accessible by all 16 CLB outputs
Simplified Slice Structure
The RAM-based function generator — also known as a Look-Up Table or LUT — is the main
resource for implementing logic functions. Furthermore, the LUTs in each left-hand slice pair
can be configured as Distributed RAM or a 16-bit shift register.
The storage element, which is programmable as either a D-type flip-flop or a level-sensitive
latch, provides a means for synchronizing data to a clock signal, among other uses.
The storage elements in the upper and lower portions of the slice are called FFY and FFX,
respectively. Wide-function multiplexers effectively combine LUTs in order to permit more
complex logic operations.
4.3 Input-output Blocks (IOB)
The Input-Output Block (IOB) provides a programmable, bidirectional interface between an
I/O pin and the FPGA’s internal logic. There are three main signal paths within the IOB: the
output path, input path, and 3-state path. Each path has its own pair of storage elements
that can act as either registers or latches.
The three main signal paths are as follows:
•The input path carries data from the pad, which is bonded to a package pin, through
an optional programmable delay element directly to the I line. There are alternate
routes through a pair of storage elements to the IQ1 and IQ2 lines. The IOB outputs I,
IQ1, and IQ2 all lead to the FPGA’s internal logic. The delay element can be set to
ensure a hold time of zero.
•The output path, starting with the O1 and O2 lines, carries data from the FPGA’s
internal logic through a multiplexer and then a three-state driver to the IOB pad. In
addition to this direct path, the multiplexer provides the option to insert a pair of
storage elements.
•The 3-state path determines when the output driver is high impedance. The T1 and
T2 lines carry data from the FPGA’s internal logic through a multiplexer to the output
driver. In addition to this direct path, the multiplexer provides the option to insert a
pair of
storage elements. When the T1 or T2 lines are asserted High, the output driver is
high-impedance (floating, Hi-Z). The output driver is active-Low enabled.
All signal paths entering the IOB, including those associated with the storage elements, have
an inverter option. Any inverter placed on these paths is automatically absorbed into the
IOB.
There are three pairs of storage elements in each IOB, one pair for each of the three paths. It
is possible to configure each of these storage elements as an edge-triggered D-type flip-flop
(FD) or a level-sensitive latch (LD). The storage-element-pair on either the Output path or
the Three-State path can be used together with a special multiplexer to produce Double-
Data-Rate (DDR) transmission. This is accomplished by taking data synchronized to the clock
signal’s rising edge and converting them to bits synchronized on both the rising and the
falling edge.
4.4 Block RAM
All Spartan-3 devices support block RAM, which is organized as configurable, synchronous
18Kbit blocks. Block RAM stores relatively large amounts of data more efficiently than the
distributed RAM feature described earlier. (The latter is better suited for buffering small
amounts of data any-where along signal paths) The aspect ratio — i.e., width vs. depth — of
each block RAM is configurable. Furthermore, multiple blocks can be cascaded to create still
wider and/or deeper memories.
Summary
ALARM Project Status
/alarm Implemented
Logic Distribution
Performance Summary
Routing Results: All Signals Completely Routed Clock Data: Clock Report
Detailed Reports
Synthesis Report Current Mon 15. Nov 16:26:50 2010 0 4 Warnings 3 Infos
Place and Route Report Current Mon 15. Nov 16:28:23 2010 0 2 Warnings 2 Infos
Static Timing Report Current Mon 15. Nov 16:28:27 2010 0 0 2 Infos
Bitgen Report
Secondary Reports
Xplorer Report
5.1 Block Diagram
seg 0
seg 1
22 bits [6:0]
display
seg 2
seg 3
CS[4:0]
alarm alarm
min sec
at 1 KHz
alarm
at 1 second
speaker
½ second clock
Clk
4MHz
5.2 RTL Schematic
Level 1
Level 2
6. Working
Alarm:
Total 12 input ports have been used in this to set alarm. Six ports to set seconds and
other six to set minutes. After setting values on this input port by pressing set key we
are fixing the alarm value in order to make it activated. Now at every second the
logic will check whether the set value matches with the current time of the digital
clock. When match happens an LED will become on and the speaker starts generating
volume of two different frequencies.
Speaker:
When the alarm match take place, a variable starts toggling at the desired frequency
rate for 0.5 second and for other 0.5 second that same variable changes its toggling
frequency to some other value. By this, we get two different values of frequency and
it sounds like a beep or siren. It goes on until we press reset alarm button.
7. Appendix
reg [5:0]min,sec;
reg [5:0]amin,asec;
wire [3:0]predisplay;
parameter clkdivider = 4000000/440/2;
always@(posedge set)
begin
amin = alarmmin;
asec = alarmsec;
end
end
if(rst == 0)begin seg0 = 0; seg1 = 0; seg2 = 0;seg3 = 0;end
else if(seg0 == 9)
begin
seg1 = seg1+1;
seg0 = 0;
end
end
Design Steps:
Completed:
Digilent Inc.
http://www.digilentinc.com/
The original code for this project was written by Xilinx and can be found at the following
website:
http://www.xilinx.com/products/boards/DO-SPAR3-DK/reference_designs.html