Digital System Design Using VHDL
Digital System Design Using VHDL
EC1X66 [3-1-0]
Moore and Mealy State Machine,Moore and Mealy variants, output of state
machine, Moore Machine with clocked outputs, Mealy Machine with
clocked outputs, state coding, residual states,optimum state machine in
VHDL, asynchronous state machine [10L].Total 42 Lectures + 14 hours
tutorial[Hand on practice on Xilinx and ModelSim].
Reference Books:
1. VHDL for Designers, Stefan Sjoholm & Lennart Lindh, Prentice Hall.
2. Principles of Digital System Design using VHDL, Roth John,
CENGAGE Learning,2010.
Digital System Design_Chapter 1_Part 1-Historical Background of IC Technology.
DSD_Chapter 1_Part 1 briefly describes the birth of Integrated Technology and its
evolution from micrometer scale to nanometer scale.
Contents:
1. Historical Journey
2. VLSI Techniques
3. New FPGA Revolution
4. Embedded advantages
Historical Journey:
Just after the invention of transistors in the end of 1947 and the beginning of
1948, Solid State Devices gradually started supplanting Vacuum Tubes .
Vacuum Tubes became obsolete because of large size, large electrical power
consumption and higher cost. This marked the dawn of Solid State Era. Today
by and large Vacuum Tubes have been totally replaced by Solid State Devices
except in RF and Microwave Wave very high power generation and
transmission where we are still using triode, pentode, klystron, magnetron and
travelling wave tube.
No. of ActiveDevices
IC Functions Year
Transistor/FET/BJT
Memory,Computers,Signal
VLSI 10,000-100,000 1975
Processors
U
100,000- 40,000,000 Pentium IV. 2001
LSI
IC in 1960s:
IC in 2010s:
Minimum
Feature Size 0.35 0.25 0.18 0.13 0.10 0.07
(um)
Memory in bits/
64M 256M 1G 4G 16G 64G
chip
Microprocessor
12M 28M 64M 150M 350M 800M
transistor/chip
Power Supply
3.3 2.5 1.8 1.5 1.2 0.9
(V)
Maximum
80 100 120 140 160 180
Power (mW)
Initially up to 10,000 transistors, Microwind software tool was used at layout design
level. As the density of integration improved from10,000 transistors to 500,000
transistors DACK software was used at logic level. From 500,000 transistors to 50
million transistor VHDL is used. This is Register Level integration. VHDL is the
acronym for Very_high _speed_integrated_circuit_Hardware _Description_Language.
With the development of ‘DualCore’ and ‘QuadCore’ processors transistor count is
exceeding 50 million and reaching 50billion integration density. At this level of
complexity System Level Description (SystemC) Language is used.
The introduction of HDLs and SystemC have made possible the design of complete
system on chip (SOC), with the complexities rising from 1 million to 10 million
transistors. Recently system C has been introduced for 100 million to 1000 millions of
transistors.
Figure 3. Increase in Clock Rate with vertical and lateral scaling of the devices by
increased level of packing density.
The clock frequency increased for high performance microprocessor and industrial
microcontroller with vertical and lateral scale down. Here Motorola microcontroller has
been taken as the example, used for high performance automotive industry applications.
IC Microprocessor Growth
Figure 4. Growth in packing density with the new generations of Microprocessors.
First 1 kb memory was produced by Intel in 1971. Since then semiconductor memory
have advanced both in density as well as performances. 256 Mb memories was produced
in 2000 and 1Gb in 2004. According to futuristic estimates , it is expected to increase up
to 16 Gb in 2008. This target has been achieved.
Evolution of Lithography
Figure 6.Improvment in minimum feature size resolution with advancement in
Lithography Technique.
Micron region of lithography is when the smallest feature size is from 10µm to 1µm.
Deep submicron region is when smallest feature size is 0.1µm to 0.01µm(or 100nm to
10nm)
Ultra Deep submicron region is when smallest feature size is 0.01µm to 0.001µm (or
10nm to 1nm).
Over the years Lithography has undergone through phases of development progressively
resolving smaller feature sizes . In 1962 we had contact printing, then we had proximity
printing, next projection printing, followed by Electron-beam lithography, X-Ray
lithography, G-line lithography, I-line Lithography. The smallest feature size had
improved from 7µm to 0.80µm.
In 2003 Deep submicron Technology using DUV193nm but an improved source of ArF
Excimer in place of KrF Excimer a resolution of 0.09µm.
At 0.09µm or 90nm resolution, 100Mgates could be implemented in the same area. In
2005 using the same light source but introducing immersion technique a further
reduction in feature size is achieved namely of 0.04µm. In future with the use of
Extreme UV at wavelength of 100nm, the smallest feature size of 0.03µm or less will be
achieved.
Ultra Deep submicron Technology will be born when we realize the smallest feature size
less than 10nm which is long way off.
As the lateral feature size has reduced so has the vertical junction depth as is evident
from the following Table 3.
Junction
1000 100 70 60 52 40
Depth(xj)nm
Interconnection
2000 600 500 350 245 130
pitch(nm)
Figure shows, how fabrication for simple NAND gate become complex as its feature
size is decreasing almost exponentially.
Figure 7. Phases in lateral scaling with increase in packing density.
When the smallest feature size is 1.2µm then a simple 2 Input NAND gate occupies
600µm2.
When the smallest feature size is 0.35µm then a simple 2 Input NAND gate occupies
230µm2.
When the smallest feature size is 0.12µm then a simple 2 Input NAND gate occupies
100µm2.
When the smallest feature size is 0.09µm then a simple 2 Input NAND gate occupies
40µm2.
Thus linear lateral scaling leads to exponential increase in packing density and
performance but at a much higher cost because of the complexity of processing involved
at smaller and smaller feature size.
Lithography mask cost doubles for every next generation and design team becomes
larger.
Figure 8. Silicon Chip mounting on the ceramic header and ceramic dual-in-line package
plugged in IC socket which in turn is connected to the Printed Circuit Board.
In other words, the minimum feature size must decrease by a factor of 0.7 every three
years.
IC Process Plant
Figure 10. An ultra- clean room of IC manufacturing plant where all the workers
are covered in Nylon Aprons from top to bottom to keep out the dust they may be
carrying.
One of them is Memristor as a circuit element whose resistance drops as current flows
through it. HP and South Korean Firm Hynia are expected to launch next year the first
memristor based Memory Chips as a replacement of Flash Memory which has the least
access time presently. Toshiba has announced the availability of its 0.165m page-mode
64Mb and 128Mb NOR Flash memories that feature a random access time of 60ns and
page access time of 20ns. Suitable for use in mobile phones, PDAs, and other wireless
handheld applications that require high-performance memory, the devices operate from
2.3V to 3.6V, and draws 55mA when reading, 15mA for program/erase functions, and
1mA during standby. The memristor will provide the alternative to Flash Memory in the
coming days.
The second possibility is that Graphene based Device may be marketed as the displays
in Smart Phones. Graphene though a product of low-tech has high-tech performance.
Flatland of Graphene is Alice’s Wonderland.
But in graphene devices comparable or even better results can be achieved at a much
lower cost. 1 Å thick graphene: scientists have a material that is relatively defect free
and whose electrons have a respectable mean-free path naturally, without materials
manipulation and processing. Graphene can hardly be more low tech, and yet it still
exhibits high conductivities. “It’s really counterintuitive and remains to be understood,”
comments Geim, “but the electron wavefunction appears to localize only parallel to the
sheet and does not interact with the outside world, even a few angstroms away.”
Android Operating System based Gadgets drive the Consumer Electronics Market
Excerpted from “Android baked into Rice Cookers in move past Phones:Tech”. The
Economic Times, Kolkota, 9th February 2013, Wednesday.
Today Gadgets controlled via Internet have become the trend in Knowledge-based
Society. During Agriculture Phase we had Labour-intensive Society. During Industrial
Phase we had Capital-intensive Society. In the present Industrial Phase we have
Knowledge-intensive Society.
Google Inc’s Android Operating System(OS) has become the most widely used Smart
Phones OS. They hold 72% of the market in the third quarter(Q3) of the financial year
2012-13. While APPLE OS has 14% of the market according to Gartner Inc.
Annual Consumer Electronics Show in Las Vegas in 2013 is show casing Android based
consumer and entertainment Gadgets such as:
1. Pico Pix Pocket Projector introduced by Royal Phillips Electronics NV. 2. Smart
Thinq Refrigerators introduced by LG Electronics Inc. 3. Asteroid Car Systems
introduced by Parrot S.A. 4. Galaxy Cameras marketed by Samsung.
Google by extending its OS free to new devices help Google collect data by which it can
build more powerful and lucarative Search Engines.
Since Android-based Phones went into sale in 2008, devices based on the mobile OS
have surged in popularity.
Building Android directly into Devices can help control these devices directly via
Internet with minimal human intervention.For example TV may show a pop-up message
from a clothes dryer in the basement indicating the status of the laundry.An Internet-
connected rice cooking machine or cooker could set the cooking instructions itself once
it is told the type of rice which has been loaded.
Google tried to push into the living room via Google TV product.
The set-top boxes and software for TV made by Sony and Logitech did not meet the
sales goal after their introduction in 2010.
Hisense and Vizu plan to demonstrate models that use an updated version of Android for
TV in Las Vegas Annual Consumer Electronics Show.
Digital System_Design_Chapter 1_Part 2_Introduction to VLSI
DSD_Chapter 1_Part 2_ introduces us to the EDA tools for implementing large and complex
Digital Systems on IC chip at VLSI level
Introduction to VLSI
“It is the process of integrating millions of transistors on tiny silicon chips to perform a multitude
of logic operation”
Programmable Logic Devices(PLDs) offer a practical way of implementing large and complex
Digital Systems on IC chip.
When a particular Digital System is required in very large quantity it may become more
economical to develop an optimized system dedicated to one particular application. IC chip
implementation of such an optimized, dedicated PLD is called Application Specific Integrated
Circuits (ASIC).
For design & development of PLDs and ASIC we have sophisticated Electronic Design
Automation (EDA) tools.
EDA design tools have reasonably kept pace with designers need as shown in the following chart:
Transistors
Gate Level
ROM and MPGA are programmed only once in the semiconductor fab itself whereas field
programmable can be programmed and reprogrammed according to the need. ROM is thought to
be a Memory Device but it can used as combinational circuit also as already seen in Digital
Electronics Theory Classes. MPGAs are popular ways of achieving ASICs.
PLAs contain programmable AND array and programmable OR array. This allows users to
implement combinational functions in two levels of gates.
In PAL, OR array is fixed and AND array is programmable. PALs also contain flip-flops.
Ultraviolet Erasures did not permit field programming. Only with the development of Electrically
Erasable Technology that field programmable PLDs became technically feasible.
500 to 12000
Density Few hundred gates 3000 to 5M gates
gates
Major
Lattice Sem.;Cypress;AMD; Xilinx;Altera; Xil;Alt;Lat.Sem;Actel;
Vendors
Device L.S..GAL16LV8,GAL22V10; Xil..cool Xil..Virtex,Spartan;
families runner,XC9500;
Electrically erasable CMOS PLD replaced PAL and PLA. PLDs contain macroblocks with array
of gates, multiplexers,Flip Flops or other standard Building Blocks.
Lattice Semiconductor created similar devices with easy programmabilitty and called its line of
devices generic array logic or GAL.
PLAs, PALs, GALs, PLDs and PROM are collectively called Simple Programmable Logic
Devices or SPLD.
When multiple PLDs are put together in the same chip with crossbar interconnection and have the
sizes of 500 to 16000 gates then we achieve Complex Programmable Logic Devices.
In 1980 Xilinx created FPGAs using Static RAM. This integrates a large number of logic. FPGAs
donot have gate array but they have bigger and complex blocks of Static RAM and multiplexers.
Seeing the performance of Xilinx, several PLD vendors and Gate Array Companies jumped into
the market. A variety of FPGA architecture were developed and used. Some are reprogrammable
and some are one-time programmable fuse technologies. In last 15 years FPGAs have grown up to
a size of 5 million gates.
Why VLSI ?
Building complex electronic circuit using discrete components are difficult and expensive -
Cost depends on quantity of devices.
Integrated circuits solved much of the problems
CPLD stands for Complex Programmable Logic Device, Advanced version of PLD’s.
Here new resources are available such as Flip-Flops, Gates in high number and are able to give
functionality of circuits consisting of few thousand gates and few hundred flip-flops.
FPGA (Field Programmable Gate Arrays) is another programmable resource having very
higher programmability than CPLD.
Then there are other higher technology resources (ASIC’s) which can be used to design many
complex circuit like microprocessors or bus controllers.
Applications requiring user defined functions like bit processing or DSP algorithm combined
with other computational capabilities.
Thus you are actually designing for emerging and complex Technologies.
VLSI Advantages
1. Reduction in size, power, design, cycle time.
2. Design security.
3. Easy up-gradation.
4. Low cost.
5. Remote Programmability.
6. Long time in market.
VLSI Techniques
VLSI stands for Very Large Scale Integration. This is the technology of putting millions of
transistors into one silicon chip.
Tools (for VLSI):
Simulation is used for testing the behavior of outputs on the waveform according to their input
given.
Synthesis tool is used for looking the hardware according to the program written in their language
like, VHDL/ VERILOG.
PLD Trend
Figure 13.Volume of Application versus the building block
2. In terms of No. of Transistors per chip, FPGA Venders have increased its capacity and
astounding results are achieved as time pass through.
3. Inclination towards FPGA is increasing day by day.
4. Leverage existing design / chipset to support multiple display types.
5. Faster time to market.
6. Improve inventory control.
7. Customize products for different geographies.
8. Reduce exposure to supply issues
Embedded Advantage
FABRICATION PROSPECT:
Figure 16. Actual No. of Transistors in millions per IC design. This data illustrates that there
is little correlation between transistors count and engineering effort.
Figure 17. Normalized Transistors count Vs. Persons week.
According to Indian Semiconductor Association (ISA) quoting the ISA-IDC Report of 2008, by
that year the Semi Conductor activity in India had a turn over of $ 7.37 billion employing over
150,000 highly qualified professionals. Embedded Software Design constituted a whopping 81%
of this activity with VLSI design being 13% and hardware / board design being 6%. The growth
rate of this sector is some 20% annually, so we can expect a turnover in excess of $ 12 billion by
the end of Year 2010 (employing 180,000+ professionals) of which embedded system design
would have a turnover of 10 billion. It is believed that the global embedded design activity is
worth some $25 billion annually. This roughly amounts to India producing a quarter of the world’s
embedded design systems. The growth in the design business to the rapid growth of the Indian
Electronics Industry from $363 billion by 2015 at a compounded annual growth rate of some
30%, accounting for 11% of the global market by 2015, projected to grow to $ 155 billion by
2015.
As fabrication unit requires minimum 1500 crore rupees investment, it’s not feasible for many
small Indian companies to make sustained investments for a long period of time, which is required
for product development (including the area of chips design/ manufacturing).
The actual problem is that quality talent with the right skills is becoming scarce. The skills
required are in vertical domains (DSP, TELECOM, etc.) along with in depth understanding of chip
design challenges like designing for high speed, low power, small size, handling large
complexities, accounting for deep sub-micron effects like signal integrity.
1. System Level Integration: there is requirement of system engineers who can understand the
complete system. The trend towards coding is to write code in C/C++, Matlab/ Java and
converted into HDL/ VERILOG, is not suitable.
2. Chip Design Limits: Chip Design, reported by New York Times by at Paul Packan, a
scientist with Intel Corp., the world largest chipmaker, said semiconductor engineers have
not found ways around basic physical limits beyond the generation of silicon chips that will
begin to appear next year. Packan called the apparent impasse “the most difficult changes the
semiconductor industry has ever faced.”
These fundamental issues have not previously limited the scaling of transistors,” Packan wrote in
the Sept. 24 issue of Science. “There are currently no known solutions to these problems.”
According to Dennis Allison, a Silicon Valley physicist and computer designer, if the
miniaturization process for silicon based transistors is halted, hopes for continued progress would
have to be based on new materials, new transistor designs and advances like molecular
Unprecedented manufacturing success has been achieved by enhancing the ability of number
crunching, executing enhanced FLOPS(floating point operations per second)/Instructions per
second and by enhanced data storage capability.
Historically we have moved from labour intensive techniques to capital intensive techniques.
Presently we are witnessing a movement towards knowledge intensive techniques.
Agricultural labour were replaced by proletariate(industrial labour) and proletariate are being
replaced by cognetariate(knowledge worker).
Introduction of computerization, automation and robotization has changed the bench marks of life.
Silicon Industry has become the largest and most influential industry.
Major innovation will be required to reach 10nm feature size. Finding alternative technologies
that can further shrink computing devices is crucial to maintaining technological progress.
Alternative technology could be ‘Quantum Computing’ and ‘Cross-Bar Architecture’.
In Cross-Bar Architecture, one set of nano-wires cross another set of nano-wires at right angles. A
special material is sandwiched at the intersection between the crossing wires. This sandwiched
material could switch on and off. Logic functions as well as memory functrions could be achieved
using the intersections.
As the packing density increases, atomic defects become a serious problem. This problem could
be circumvented by building redundancy and by using coding technique. By using Error
Correcting Codes the error rates at the intersection could be drastically reduced. By introducing
40% redundancy the yield of manufacturing could improve from 0.0001 to 0.9999 if the defect
rate is 0.01.
Today Cross Bar Architecture has emerged as the principal contender for a new computing
paradigm. For this success, architecture, device physics and nano-manufacturing techniques need
to simultaneously develop.
Cross Bare Architecture is ideal for implementing strategies based on finding and avoiding defect
areas and using coding theory to compensate for mistakes.
In Chapter 1_ Part 2 we saw that PLAs, PALs, GALs, PLDs and PROM are collectively called Simple
Programmable Logic Devices. Here we will examine PLA, PAL and PROM closely to understand how exactly
Sum of Products Boolean Function is achieved.
All these programmable devices are based on the philosophy of M-bit Code Input being converted to N-bit Code
output.
2M = µ and 2N = α.
Here α may be less than µ. In that case each of the M-bit code does not have a corresponding unique N-bit code.
Many of the M-bit codes may have the same N-bit code.
Therefore:
A DECODER is realized by Multiplexer also known as MUX. MUX is nothing but a combination of AND gates.
In Figure 2 we show a 4-bit binary to decimal decoder:
Figure 2. 4-bit binary to decimal decoder.
0 0 0 0 W0 0
0 0 0 1 W1 1
0 0 1 0 W2 2
0 0 1 1 W3 3
0 1 0 0 W4 4
0 1 0 1 W5 5
0 1 1 0 W6 6
0 1 1 1 W7 7
1 0 0 0 W8 8
1 0 0 1 W9 9
In Figure 3, for every BCD code one of the 10 Word lines will go HIGH and the remaining lines will be LOW.
Figure 2 tells us that every Word Line is a PRODUCT of 4 Variables A,B,C,D and their complements A′ , B′,C′,D′
.
Keyboard of a Computer generates 8-bit ASCII Code on pressing one of the keys. Hence Keyboard is ENCODER
ARRAY. For simplicity of presentation we present 10Key - 4bit Encoder. The customer will have to decide and
specify the 4-bit codes corresponding to 10 keys. That is the Customer will provide the Truth Table.
W9 W8 W7 W6 W5 W4 W3 W2 W1 W0 Y3 Y2 Y
0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0 1
0 0 0 0 0 0 1 0 0 0 0 0 1
0 0 0 0 0 1 0 0 0 0 0 1 0
0 0 0 0 1 0 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0 0 0 0 1 1
0 1 0 0 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 0 0 0 1 0 0
Figure 4. 10 Key to 4-bit Encoder Array.
If W1 is pressed, 5V is applied to the corresponding Word line or to the corresponding ROW. The Row crosses the
four bit-lines at the four intersections. Which ever intersection is shorted on that bit line ‘1’ is generated as seen in
Figure 4. Where intersections are not shorted there we get ‘0’ on the bit line. For W1, Y3=0,Y2=0,Y1=1, Y0 = 0
binary code is generated as desired by the customer.
For W6, 0-1-1-0 is generated. Now let us examine the bit lines:
Therefore Y0 = W1 + W3 + W5 + W7 + W9;
Similarly Y1 = W2 + W3 + W6 + W7;
Similarly Y2 = W4 + W5 + W6 + W7;
Similarly Y3 = W8 + W9;
Y3 = DC′B′A′ + DC′B′A;
The AND terms are generated by shorting the A,B,C,D and A′, B′, C′, D′ lines or Columns with the Rows of Input
of Ten AND gates.
The OR terms are generated by shorting the intersection of Word-line(rows) and bit-lines(columns)
The shorting of intersection can be done putting a DIODE from the Word-line to bit-line as shown in Figure 6.
The shorting of intersection can be done by using multi-emitter BJT as shown in Figure 7.
Diodes are the memory elements. Diode transfers ‘1’ of Word-line to the corresponding Bit-line. The output
WORD for any input code may be read as many times as possible. But the stored relationship between Input Code
and Output Word cannot be modified. The Diode Matrix is fabricated at the factory level. Hence this is Read-Only-
Memory (ROM).
Figure 7. Multiemitter BJTs are used for transferring ‘1’ from Word-line to Bit-line with which the intersection is
shorted.
Multiemitter BJT has four emitters. When an Emitter is shorted to Bit-line, BJT behaves like Emitter Follower and
as soon as the WORD-line goes HIGH the shorted bit-line ( shorted with the given high Word-line) goes HIGH
and all other bit-lines remain LOW.
According to customer requirement, the manufacturer shorts or opens the intersection by the use of proper MASK.
This is Custom Programming or Mask Programming or Hardware Programming. This is ‘One-Time Factory
Programming’.
Static ROMs can be built of BJT or NMOS. These have no clock input. These are non-volatile. They never lose
data. They are available in 1 to 64kb range. NMOS StaticROM have access time 0.1 to 1 µsec. This access time is
one order of magnitude longer than that of BJT StaticROM.
In a NMOS or BJT StaticROM we have a DECODER as shown in Figure 8. It has address input or select input. In
this case address word is 10-bit wide. Hence it can access 1024 locations of memory. At every location a 4-bit
wide binary word can be stored as shown in Figure 9. When an address word arrives , one of the 1024 Word-lines
goes HIGH. At any instant only one Word-line can go high.
B9 B8 B7 B6 B5 B4 B3 B2 B1 B0
0 0 0 0 0 0 0 0 0 0
Then W0 line goes HIGH. This selects the DATA WORD ‘0110’ in Figure 9.
Q3 and the NMOSs in that ROW are Load FETs. Here Drain and Gate of NMOS have been shorted. Hence Q3 and
its corresponding elements act as loads of the bit-lines Y0,Y1,Y2,Y3.
All Bit-lines are at HIGH level. Because Vdd = 5V is being applied to all Bit-lines and all bit-lines at the other end
is simply hanging.
When W0 goes HIGH, the intersections of Y1, Y2 and W0-line have no NMOS. Y1 = ‘1’ and Y2 = ‘1’ state
continues as it was before.
At the intersection of Y0 and Y3 we have Q2 and Q4 NMOSs. Their Gates are connected to W0-line which is
presently held HIGH at 5V > Threshold Voltage of NMOS. Hence Q2 and Q4 turn ON and provide a short to
Ground. Therefore Y0 = ‘0’ and Y3= ‘0’.
Here we are following ACTIVE-LOW Logic. Ordinarily bit-lines are at ‘1’ and when ACTIVE they go LOW or
go to ‘0’.
Thus with 0000000000 address word applied to the address bus of the given ROM, W0 gets selected and ‘0110’
,which is stored in the ROM memory space, gets READ out.
The following Table 1 gives the binary bits stored in locations selected by W0,W1,W2 and W500 word-lines.
WORD-
B9 B8 B7 B6 B5 B4 B3 B2 B1 B0 Y0′ Y1′
line
0 0 0 0 0 0 0 0 0 0 W0 0 1
0 0 0 0 0 0 0 0 0 1 W1 1 0
0 0 0 0 0 0 0 0 1 0 W2 0 1
0 1 1 1 1 1 0 1 0 0 W500 1 1
Here the Bits stored are pre-programmed and cannot be changed unless we find some methods to construct NMOS
and omit NMOS at the 1024×4 ROM Memory Cells.
What we have shown is a Factory programmed ROM. Field programmed ROM had to wait for several years
before it was introduced as Field Programmable Devices.
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
In Figure 10 we have shown the construction and the composite structure of 7-SEGMENT DISPLAY. In Figure 10
it is also shown as to which LED should glow corresponding to a decimal value. From this knowledge we can
construct the following Table 3 for code conversion.
DCBA g′ f′ e′ d′ c′ b′ a′
0101 W5=D′CB′A 0 0 1 0 0 1 0
Since input code is 4 bits therefore there are 24 = 16 word lines hence Table 3 must have 6 extra Word-lines i.e.
W10, W11, W12, W13, W14, W15. Corresponding to these 6 Word-lines there are some arbitrary SYMBOL
displays depending upon the convenience of the Designer.
If all 16 Word-lines are considered then the bit-line Y0 will be by inspection of the Table:
Similarly minimized expressions can be obtained for all the remaining 6 bit-lines.
If using the minimized expressions for Y0, Y1, Y2, Y3 Y4, Y5, Y6 we build the decoder-driver then almost 20%
saving in component count takes place as compared to a decoder-driver built by ROM. It can be even more. But
this will require extra man-hours for minimizing and designing. If the demand can justify this extra cost then one
could go for these especially designed and optimized circuits. These circuits are called ‘Application Specific
Integrated Circuits’(ASIC). The ‘BCD to 7 Segment decoder-driver’ presently available in the market by the
component code 74HC4511 is one such ASIC circuits.
Digital System Design_Chapter 2_Section 2_Wishlist of Digital System Designer.
DSD_Chapter 2_Section 2 describes the technological development which led to the realization of
Electrically Erasable Programmable ROM. EEPROM became the basis of SPLD,CPLD,FPGA.
The wishlist of Digital System Designer is to create a PLD where he downloads a programme and gets the
PLD configured for a certain number of functions. With passage of time a few more functions are to be
added and some existing functions are to be omitted. He would like to modify his programme and reload it
on the same PLD. Economy-wise this would make sense. But this requires that he has Electrically Erasable
and Reprogrammable PLD. This requires that it should be field-programmable.
In 1956, at the request of US Air-Force, Scientists of ARMA Division of American Bosch Arma
Corporation, Garden City, New York, developed a User Programmable ROM akin to Diode Matrix shown
in Figure 6 of Chapter 2_Section 1. The fresh ROM had a diode connected at all intersections. It implied
state HIGH or ‘1’ in all memory cells. The user could retain or omit the DIODE at the intersection as his
design need be. By applying a High Voltage Pulse of 30V which is not used in Digital Systems, the user
could burn the whiskers of the Diode and thereby “burn” / “Zap” / “blow” open the given diode. This
would give ‘0’ state in that particular Memory Cell which lies at the given intersection. This way by
burning the requisite set of memory elements namely the diodes at the intersections, the desired functional
relationship can be achieved. Once the requisite diodes are blown out, the functional relationship is
unalterable. Hence this was called One-Time User Programmed ROM.
In1971, Intel Scientists at Santa Clara, California, developed Erasable Programmable ROM (EPROM).
This new device was based on a special double-gate NMOS referred to as Floating-Gate Avalanche-
Injection MOS(FAMOS). This double-gate NMOS is shown in Figure 11.
In Figure 9 of Chapter 2_Sec 1, we place such Double-Gate NMOS at all intersections as shown in Figure
12.
Figure 12. EPROM using Double-Gate NMOS.
Before user programming, FAMOS (Double-Gate NMOS) is present at all intersections. Any Word-line
going HIGH will place 0s at all the four Bit-lines. Hence effectively EPROM comes with 0s stored in all
memory cells. When the user applies 25V pulse between Gate2 and Drain, a high electric field is created in
the depletion region of the p-n junction of the Drain-substrate. This electric field is in excess of the critical
field. This results in Avalanche Breakdown. This creates a large reverse current. The electron component of
this breakdown current is accelerated towards Gate2. It penetrates the thin oxide region and gets
accumulated on Gate1. Gate 1 effectively becomes negatively charged hence 5V at Gate2 is no more able to
turn this transistor ON. Hence effectively the NMOS at that intersection is disabled and state ‘1’ is
permanently stored in that cell. Thus by application of 25V at the requisite intersections’ FAMOS, the
transistor is disabled and state ‘1’ is permanently stored giving rise to the desired Boolean Function.
Because of SiO2, charges accumulated on Gate2, do not discharge for 10years and longer. The ‘1s’ stored
by application of 25V at Gate2s can be easily erased by exposing the ROM to Ultra-Violet light. UV light
makes the SiO2 slightly conducting thereby providing a path for leakage of charge accumulated on Gate1.
Thus all disabled NMOSs are enabled and this restores EPROM to all ‘0s’ states . This can once again be
reprogrammed and reconfigured. But this requires long exposure time in excess of 2 minutes for complete
eraser. Hence Electrically erasable and programmable ROM(EEPROM) became the need of the hour.
In 1978, once again the Scientists of INTEL developed and commercialized EEPROM. They reduced the
thickness between Gate1 and Channel from 1000A° (100nm) to 100A° (10nm). Now 10V electric voltage
pulse was sufficient to writ ‘1s’ in a given cell. The same voltage reversed could erase ‘1’ and reset the
whole ROM to ‘0s’.
Thus we see the Digital Designer’s wish list was fulfilled. Now he had a ROM which could be
reprogrammed and reconfigured umpteen times as the need arose.
In the following Table 4 we tabulate the chronological development in the field of PLD devices with
particular reference to Company ALTERA.
1984 First PLD in the marketFP300, 320 gates, 3µmCMOS,10MHz, 20 I/O pins
1985-
TTL libraries for PLDEP 1200 First High Density PLD.EPB 1400 Embedded PLD
87
1993-
Low Power 150MHz CPLD, 3.3V, 12000Gates
94
First FPGA with embedded RAM100k gates, 0.4-0.3µm technology,> 10M components,
1995
50-100Mhz, First PCI integratedPCI(Peripheral Component Interconnect)
1996-
SOPC(system on a programmable chip)
98
2000-
First embedded FPGAWorld’s first soft core microcontroller
2001
Table 5. 90nm Technology, 300 mm die size, normalized to 4M gates , 4Mbit Memory.
Die
20.8×20.8 14.8×14.8 10.7×10.7 8.7×8.7 5.9×5.9
Size(µm×µm)
Dies per
41 143 274 415 2030
wafer(×106)
Figure 13. The Wafer Size, Technology used and Gates realized.
In Table 5 for calculating the number of dies per wafer we use the following equation taken from
connexions module m33385, Part-9_Journey of IC Technology:
–(
Figure 14. Sectoral Composition of $173.6b sales estimate by Altera in 2003 in terms of Consumption.
Figure 15. Sectoral Composition of $173.6b sales estimate by Altera in 2003 in terms of Function.
As shown in Figure 16 , Programmable Array Logic (PAL) is formed from a programmable AND and fixed
OR array.
Figure 16. Programmable Array Logic (PAL) formed from programmable AND Array and fixed OR Array.
We see in Figure 16 all intersections on decoder side that is on AND array side are shorted. By applying
10V Voltage pulse as we did in EEPROM, the NMOS can be disabled. The rest shorts are retained. Since
here we have full options for removing the shorts we say that AND Array is programmable.
On the encoder side we have no such option. Some intersections are shorted and remaining are kept open.
Here the OR Array is fixed. User has no options.
As seen in the figure, on decoder as well as encoder side all intersections are shorted. User can remove the
short on the AND array side(decoder side) as well as on OR array side(encoder side) according to his
Boolean function requirement. Hence we say that AND array is programmable as well as OR array is
programmable.
“Principles of Digital Systems Design using VHDL”, by Roth and John, CENGAGE Learning, 1998.
DSD_Chapter 3_VHDL._introduction and content
This gives the introduction and content of VHDL.
Contents
VHDL: An Introduction
Why VHDL
Characteristics
Basic Structure
Data Objects
Data Types
Combinational Logic Statements
Sequential Logic Statements
Concurrent Statements
Function
Procedure
Packages
Configurations
The codes written for a VHDL can be verified in simulator by writing the
test bench. Here input time signals are given and output response signals are
obtained. Thus we obtain the functional verification. At a later stage time
verification of the design is also possible.
i. ViewLogic;
ii. Mentor Graphics;
iii. Synopsys.
Benefits
Executable specification
Validate spec in system context (Subcontract)
Functionality separated from implementation
Simulate early and fast (Manage complexity)
Explore design alternatives
Get feedback (Produce better designs)
Automatic synthesis and test generation (ATPG for ASICs)
Increase productivity (Shorten time-to-market)
Technology and tool independence (though FPGA features may be
unexploited)
Portable design data (Protect investment)
Study of VHDL.
Its characteristics are:
1. Abstraction;
2. Modularity;
3. Concurrency;
4. Hierarchy.
ABSTRACTION.
Synthesis:
Synthesis is defined for the following different classes:
Process (sel, a, b)
Begin
Else
C<= a;
End if;
End process;
Result of a synthesis:
Figure 2. The result of MUX synthesis.
HDL: Modularity.
HDL: Concurrency.
Digital systems are DATA Driven. A change in one signal will lead to
change in another signal.
HDL: Hierarchy.
Figure 4. Behavioral description and structural description of the entity.
Entity Declaration.
Entity adder is
[generic(generic_declaration);]
End [adder]
ENTITY DECLARATION.
a0, b0, cin are input ports and data type BIT.
Sum and cout are output ports and again data type BIT.
Entity FULL_ADDER is
Port( A0, B0, CIN: in std_logic;
End FULL_ADDER;
GENERIC DECLARATION:
This declares constants that can be used to control the structure or behavior
of the entity.
Generic(
constant_name:type[:=initial value]
{;constant_name:type[:=initial_value]}
);
Port Declaration:
Port(
Port_name:[mode] type[:=init_value]
{;port_NAME:[MODE] TYPE[:=INIT_VALUE]}
);
Example:
Entity example_program is
B:in std_logic;
C:out std_logic;
D:inout std_logic;
E:buffer std_logic);
End assign;
Begin
Process(A,B)
Begin
C<=A; ----this is valid. Input value can be assigned to output.
End process;
End assign;
We can control the structure and timing of an entity using generic constants.
For example in an adder we add two BCD. Depending on the word length
of BCD, adder will have to be chosen. If BCD is 4-bit wide then both inputs
of Adder named A and B will not be a standard in std_logic. Instead it will
be 4-bit wide “in std_logic_vector(3 downto 0)”. Also a constant N will
have to declared which will give the word size.
Entity ADDER is
Generic( N: INTEGER:=4;
M:TIME:= 10 ns);
CIN:in std_logic;
COUT:out std_logic);
End ADDER;
ARCHITECTURE
An architecture provides an “internal” view of an entity. An entity may
have more than one architecture. It defines the relationships between inputs
and outputs of a design entity which may be expressed in terms of:
1. Behavioural style;
2. Dataflow style;
3. Structural style.
Example:
Begin
Process(A, B, CIN)
Begin
SUM<= ‘0’;
COUT<= ‘0’;
SUM<= ‘1’;
COUT<= ‘0’;
SUM<= ‘0’;
COUT<= ‘1’;
SUM<= ‘1’;
COUT<= ‘1’;
End if;
End process;
End behavior;
Example:
Begin
S<= A xor B;
End DATAFLOW;
COUT= A.B+A.Cin+B.Cin
Example:
Component HALF_ADDER
Component OR_GATE
O: out BIT);
End component;
Begin
End STRUCTURE;
Figure 6. Structural Style Architecture of Full Adder.
This does not use process. By assigning the correct port map the
components get instantiated into Full_Adder.
DATA OBJECTS.
Data Object hold a value of specific type. There are three classes of data
object namely:
1. Constants;
2. Variables;
3. Signals.
CONSTANTS.
VARIABLES.
These data objects hold temporary data. They can be declared in a process
or a subprogram.
Variable X, Y: std_logic;
SIGNALS.
DATA TYPES:
Data object must defined with a data type and the range of values it can
assume.
1. Enumeration types;
2. Integer types;
3. Predefined VHDL data types;
4. Array Types;
5. Record types;
6. STD_LOGIC data type ;
7. Signed and unsigned data types;
8. Subtypes.
Enumeration Types
Integer types
VHDL Data types
Array Types
Record Types
Std_logic types
Subtypes.
LOGICAL OPERATORS
Logical operators are “ AND, OR,NAND, NOR, XOR and NOT” accept
operands of same type and same length.
Example:
RELATIONAL OPERATORS
Example;
Signal C: BOOLEAN;
C<= B <= A;(same as C<=(B<=A);)
Example:
Begin
Else ‘0’;
End arch_andgate;
Y<= “X X” when “1 1”
SEQUENTIAL STATEMENTS
The statements within a process may be sequential but the process may be
concurrent.
The current value of a variable is replaced with a new value specified by the
expression. The variable and the result of the expression must be the same
type and same length.
Target_variable:= expression;
Variables declared within a process cannot pass values outside the process.
Example:
Process(S1,S2)
Variable A, B : INT16;
Constant C: INT16:=100;
Begin
A:=S1+1;
B:=S2*2-C;
End process;
Assignment will not take place immediately. There can be two kinds of
delays that can be applied when scheduling signal assignments:
TRANSPORT DELAY.
……
Process(…..)
Begin
As we see in the above example, Inertial Model; does not allow the glitches
to appear at the output but in transport model it does appear.
Variable assignments are executed in zero time. However VHDL uses delta
time concept for signal assignments. Each signal assignment statement is
executed after a delta time.
process (CLK)
signal A : integer := 5 ;
B, C : integer := 0 ;
variable D : integer := 0 ;
begin
A <= 1;
A <= 2;
B <= A;
D := 3;
C <= D;
end process ;
The process is activated by any change in the CLK signal. The CLK
changes in zero time. 0- and 0+ are both 0 for a simulator. The interval, two
delta (2D) is a virtual concept. A signal assignment is executed after a delta
delay however variable assignments are executed in zero time. The first
assignment is a signal assignment, therefore A will be assigned “1” after a
delta time. The second assignment is also a signal assignment so A will be
“2” after two delta time. Third assignment assigns signal B, the initial value
of A (the value at 0- time) because delta time concept is virtual. So B takes
“5” after a delta time. Fourth assignment is a variable assignment, so it will
be executed without delta delay. The last assignment is again a signal
assignment ; signal C takes the value of D after a delta time. Since D is “3”
at zero time C is assigned to “3”.
IF STATEMENTS.
Example:
Process (A,B)
Begin
Y<= ‘0’;
Y<= ‘1’;
End if;
End process;
CASE STATEMENTS.
Example:
Signal S1: INTEGER range 0 to 7;
Begin
Case S1 is
OU<= ‘0’;
When 1 =>
OU<= I1;
When 3 to 5 =>
OU<=I2;
OU<= I3;
End case;
End process;
LOOP STATEMENTS.
If LOOP not used and repetitive statement is used then we use WAIT and
EXIT STATEMENTS.
Example of two nested loops without iteration.
Count_down: process
Begin
L1: loop
L2: loop
Sec := sec-1; --------every decrement takes place at the leading edge of the
CLOCK.
Min:= min – 1;
Sec := 60;
This iterates over a number of values. The loop index is integer value by
default.
Example:
For i in 1 to 10 loop
A(i) := i*I;
End loop;
A(I) := i*i;
End loop;
A WHILE LOOP executes the loop body by first evaluating the condition.
If the condition is true the loop is executed.
Example:
Process
Variable a, b, c, d : integer;
Begin
…………………
A :=a-1;
C:=c+b;
B := b – d;
End loop;
…………..
End process;
NULL STATEMENTS.
Example:
Case A is
When 0 to 12 =>
B := A;
Null;
End case;
Assertion Statements.
Next Statement
Exit Statement.
Wait Statement.
Procedure Statement.
Concurrent Statement.
Process Statement.
Example.
Architecture A2 of example is
Begin
Begin
Pr2: process(i1,i2,i3,i4)
Begin
Or_out<= i1 or i2 or i3 or i4;
End A2;
Block Statements.
Block Statement.
Example: Block B1-1 is nested within block B1. Both B1 and B1-1 declare
a signal named S. The signal S used in Block B1-1 will be the one declared
within B1-1 while S is used in block B2 is the one declared in B1.
Begin
B1: block
Signal S : bit;
Begin
B1-1: block
Signal S: integer;
Begin
Out1<= S;
B2: block
Begin
Out2<= S;
End BHV.
1. Procedure;
2. Functions.
FUNCTIONS
Example:
Process
Begin
F:c*9.0/5.0+32.0;
Return(f);
End c_to_f;
Begin
Temp:= c_to_f(5.0)+20.0;(temp=61)
End process;
Here class of a object refers to constant or signal and the mode is ‘in’.
Default value of MODE is ‘in’. Default value of CLASS is ‘constant’.
PROCEDURES
Variable temp:bit;
Begin
Temp:= ‘0’;
For I in 0 to 7 loop
End loop;
Result1:= temp;
End;
Example 2.
Begin
Process
Variable TOP,BOTTOM,ODD,dummy:bit;
Begin
End process;
End BHV;
PACKAGES.
The package body specifies the actual behavior of the package. It has the
same name as the declaration.
Example>
Library IEEE;
Use IEEE.NUMERIC_BIT.all;
Package PKG is
End PKG;
V1:= L+BCD5_1;
V2:=L+BCD5_7;
Case V2(4) is
End case;
Return (V);
End BCD_INC;
End PKG;
GENERATE STATEMENT.
{concurrent_statement}
There are two kinds of generation_scheme : the for scheme and the if
scheme. A for scheme is used to describe a regular structure. It declares a
generate parameter and a discrete range just as the for_scheme which
defines a loop parameter and a discrete range in a sequential loop statement.
The generate parameter needs not to be declared. Its value may be read but
cannot be assigned or passed outside a generate statement.
Example:
Architecture IMP of FULL_ADDER4 is
Component FULL_ADDER
End component;
Begin
TMP(0)<= ‘0’;
G : for I in 0 to 3 generate
End generate;
End IMP;
Figure 10. 4-bit Adder with 4 Full Adder Components.
CONFIGURATION STATEMENT
forinstantiation_list : component_name
library IEEE ;
use IEEE.STD_LOGIC_1164.all ;
entity FULL_ADDER is
component XOR_gate
end component ;
component AND2_gate
end component ;
component OR2_gate
end component ;
begin
end IMP ;
DSD_Chapter 4_VHDL application to combinatorial logic synthesis
DSD_Chapter 4_Section 1 deals with Combinatorial Logic Synthesis using
VHDL.
Two design approach can be used while writing the VHDL codes for a
system namely behavioral and data-flow design approach.
Begin
_________y<= a and b;
end behavioral;
Begin
end behavioral;
How to use ISE for writing the codes and checking for syntax errors?
Click ISE. Project Navigator opens. Tip of the Day will come. OK it.
Speed: -6
This imples that Enable Enhanced Design Summary is enabled and Enable
Message Filtering+ Display Incremental Message are disabled.
Click NEXT.
Creating a new source and adding to the Project is optional. Existing source
can be added on the next page.
Click NEXT.
Click NEXT.
DEVICE
Device Family_______________Spartan2
Device_____________________XC2S15
Package____________________TQ144
Speed______________________-6
Synthesis Tool________________XST
Simulator____________________ModelSim XE VHDL
Preferred Language___________VHDL.
Finish.
⌂ ANDGate1
File Name____________ANDGate1
Select_______________VHDL Module
Click_______________NEXT
Define Module
Entity Name____________ANDGate1
Architecture Name_______Behavioral
Port Name_____________Direction
A____________________in
B____________________in
Y____________________out
Click _____________NEXT
Project Navigator will create a new skeleton source with the following
specifications:
Add to Project: Yes
Port Definition
A_______________Pin________in
B_______________Pin________in
Y_______________Pin________in
Click ________________FINISH
-------------┌┐└┘┌┐_ ANDGate1.Behavioral
On the right, Note Pad and initial part of VHDL Program will appear.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity ANDGate1 is
Port(A:in std_logic;
____B:in std_logic;
____Y:out std_logic);
End ANDGate1;
____Begin
End behavioral;
Once the codes are written we will carry out the syntax check.
Synthesize-XST
Implement Design
We correct the program,save it and repeat syntax check until we get the
message
Process “Synthesis” completed successfully.
+ Synthesize-XST
Select_______________VHDL TestBench
Click_______________NEXT
Click_______________NEXT
Project Navigator will create a new skeleton source with the following
specifications:
Association: ANDGate1
Click ________________FINISH
On the right hand side in the Note-Pad we write the test bench program.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity TbANDGate1 is
End TbANDGate1;
Component ANDGate1
____Port(a:in std_logic;
________b:in std_logic;
________y:out std_logic);
End component;
- - - -inputs.
- - - outputs.
Signal y:std_logic;
Begin
(a => a,
b => b,
- - - - -constant<clock>_period:= 1 ns;
- - - - -<clock>_process:process
- - - - -begin
- - - - -end process;
- - - - stimulus process
________stim_proc:process
________begin
____________a<= ‘1’;
____________b<= ‘1’;
____________a<= ‘1’;
____________b<= ‘0’;
____________wait for 10 ns;
____________a<= ‘1’;
____________b<= ‘1’;
____________a<= ‘1’;
____________b<= ‘0’;
_________wait;
_________end process;
End;
Click TbANDGate1-Behavioral
ModelSim appears.
ModelSim runs and input and output time patterns appear validating the
AND Logic Operation in this case.
Figure 1. Input Time Patterns and Output Response.
Y = A.B + C(XOR)D
⌂ Logic_system1
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity AND_Gate is
Port(A:in std_logic;
____B:in std_logic;
____Y:out std_logic);
End AND_Gate;
Begin
End behavioral;
Select ANDgate as TOP MODULE and do the syntax check here itself.
Second we define XOR_Gate by right clicking #xc2s15-6tq144 and adding
a new source named XOR_Gate.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity XOR_Gate is
Port(A:in std_logic;
____B:in std_logic;
____Y:out std_logic);
End XOR_Gate;
Begin
End behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity OR_Gate is
Port(A:in std_logic;
____B:in std_logic;
____Y:out std_logic);
End OR_Gate;
Begin
End behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity logic_system is
______Port(A: in std_logic;
__________B: in std_logic;
__________C: in std_logic;
__________D: in std_logic;
______Signal P:std_logic;
______Signal Q:std_logic;
______________Port(A,B: in std_logic;
______________________);
______End component;
______Component Or_gate is
____________Port(A,B: in std_logic;
___________________);
______End component;
____________Port(A,B: in std_logic;
___________________);
_______End component;
Begin
End arch_logic_sysytem1;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity logic_system2 is
Port(A: in std_logic;
____B: in std_logic;
____C: in std_logic;
____D: in std_logic;
____E: in std_logic;
____F: in std_logic;
____G: in std_logic;
____Y:out std_logic);
Architecture Arch_logic_system2 of logic_system2 is
______Signal P: std_logic;
______Signal Q: std_logic;
______Signal R: std_logic;
______Signal S: std_logic;
______Component And_gate is
____________Port(A,B: in std_logic;
__________________Y:out std_logic);
____________End component:
______Component Or_gate is
____________Port(A,B: in std_logic;
____________End component;
______Component NAND_gate is
____________End component;
______Component NAND_gate is
_______Component XNOR_gate is
____________End component;
_______Begin
______End arch_logic_system2;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity AND_gate2 is
___________B: in std_logic;
End AND_gate2;
Begin
End arch_AND-gate2;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity AND_gate3 is
End AND_gate3;
______Begin
__________Process (A, B)
__________begin
__________end if;
__________End process;
End arch_AND_gate;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity OR_gate is
___________B: in std_logic;
End OR_gate;
Begin
End behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity XNOR_gate is
_______Port (A: in std_logic;
____________B: in std_logic;
End XNOR_gate;
Begin
______Process(A, B)
______Begin
______end if;
______end process;
End behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity XOR_gate is
___________B: in std_logic;
End XOR_gate;
_______Begin
End behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity NAND_gate is
___________B: in std_logic;
___________C:in std_logic;
End NAND_gate;
Begin
_________Process(A,B)
_________Begin
_________end if;
_________end process;
End behavioral;
DSD_Chapter 4_VHDL application to sequential logic synthesis
DSD_Chapter 4_Section2 describes the codes for sequential systems and
the method for validating the codes by building Testbenches and given
Time Input patterns and checking the output patterns.
How to use ISE for writing the codes and checking for syntax errors?
Click ISE. Project Navigator opens. Tip of the Day will come. OK it.
Speed: -6
This imples that Enable Enhanced Design Summary is enabled and Enable
Message Filtering+ Display Incremental Message are disabled.
Click NEXT.
Creating a new source and adding to the Project is optional. Existing source
can be added on the next page.
Click NEXT.
Click NEXT.
DEVICE
Device Family_______________Spartan2
Device_____________________XC2S15
Package____________________TQ144
Speed______________________-6
Synthesis Tool________________XST
Simulator____________________ModelSim XE VHDL
Preferred Language___________VHDL.
Finish.
⌂ ANDGate1
File Name____________ANDGate1
Select_______________VHDL Module
Click_______________NEXT
Define Module
Entity Name____________ANDGate1
Architecture Name_______Behavioral
Port Name_____________Direction
A____________________in
B____________________in
Y____________________out
Click _____________NEXT
Project Navigator will create a new skeleton source with the following
specifications:
Port Definition
A_______________Pin________in
B_______________Pin________in
Y_______________Pin________in
Click ________________FINISH
-------------┌┐└┘┌┐_ ANDGate1.Behavioral
On the right Note Pad and initial part of VHDL Program will appear.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity ANDGate1 is
__________Port(A:in std_logic;
_______________B:in std_logic;
_______________Y:out std_logic);
End ANDGate1;
Begin
End behavioral;
Once the codes are written we will carry out the syntax check.
Synthesize-XST
Implement Design
We correct the program,save it and repeat syntax check until we get the
message
+ Synthesize-XST
Click__________________NEXT
Click__________________FINISH
______________________┌┐└┘┌┐TbANDGate1-Behavioral appears.
______________________┌┐└┘┌┐ TbANDGate1-Behavioral
On the right Note Pad opens with the initial part of VHDL.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity TbANDGate1 is
End TbANDGate1;
______Signal y:std_logic;
Component ANDGate1 is
______Port(a,b: in std_logic
__________y:out std_logic);
End component;
End Behavioral;
Click TbANDGate1-Behavioral
ModelSim appears.
ModelSim runs and input and output time patterns appear validating the
AND Logic Operation in this case.
Figure 10. Input Time Patterns and Output Response.
Design of Flip-Flops
Figure 11. Interface Description of D-Flip Flop.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity D_FF1 is
_____CLK: in std_logic;
End D_FF1;
_______Begin
____________Process(CLK, Din)
____________Begin
__________________Then
__________________Y<= Din;
__________________End if;
__________________End process;
End behavioral;
Entity D_FF2 is
_____CLK: in std_logic;
_____CLEAR: in std_logic;
End D_FF2;
_______Begin
____________Begin
__________________Then
__________________Y<= ‘0’;
__________________Then
__________________Y<= Din;
__________________End if;
__________________End process;
End behavioral;
Entity D_FF3 is
_____CLK: in std_logic;
_____CLEAR: in std_logic;
End D_FF3;
________Begin
____________Begin
__________________Then
__________________Y<= ‘0’;
__________________Then
__________________Y<= Din;
__________________Else z <= y;
__________________End if;
__________________End process;
End behavioral;
DESIGN OF MULTIPLEXER.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity mux4_1_A is
end mux4_1_A;
begin
end behavioral;
Design of Decoder
Design of Decoder
Entity decoder_2to4_version1
_______begin
__________process(s)
__________begin
_____________case s is
_____________d<= “0001”;
_____________case s is
____________d<= “0010”;
____________case s is
____________d<= “0100”;
____________case s is
____________d<= “1000”;
_____________end case;
__________end process;
end behavioral;
Figure 14. Decoder 2 to 1.
S1 S0 D3 D2 D1 D0 Dec
0 0 0 0 0 1 0
0 1 0 0 1 0 1
1 0 0 1 0 0 2
1 1 1 0 0 0 3
“Look Ahead” systems. In Look Ahead Adders ‘carry out’ bit is being
simultaneously
generated for all bits. Hence LSB , intermediate bits and MSB are
simultaneously being added
Whereas in sequential Adders, carry-out bit is first generated for LSB and
then it is inputted to
next significant bit.Thus the final result comes after ‘n gate delays’ if n bits
are being added.
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity mux4-1concurrent is
end mux4-1concurrent;
begin
process(d,s)
begin
_____case s is
_____when “00” =>
_____y<= d(0);
_____y<= d(1);
_____y<= d(2);
_____y<= d(3);
_____end case;
______end process;
end behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity mux4-1sequential is
end mux4-1sequential;
begin
process(d,s)
______begin
_________if (s = “00”)
_________elsif (s = “01”)
__________elsif (s = “10”)
________end if;
end process;
end behavioral;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity 2:1MUX is
____D2: in std_logic;
____S: in std_logic;
____Y: out std_logic);
End 2:1MUX;
______Signal T: std_logic;
______Signal Q: std_logic;
______Signal R: std_logic;
Component inverter is
End component;
Component and_gate is
End component;
Component Or_gate is
Port(A,B : in std_logic;
End component;
End arch_2:1MUX;
Library IEEE
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity 2:1MUX is
_____D2: in std_logic;
_____S: in std_logic;
End 2:1MUX;
Begin
Begin
____Else
____Y<= D2;
____End if;
End process;
End Behavioral;
XC------3001-FPGA
4000-FPGA
Threebit_updowncounter
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity threebit_updowncounter is
______reset : in STD_LOGIC;
______count_en : in STD_LOGIC;
______up : in STD_LOGIC;
end threebit_updowncounter;
begin
______process(clk,reset)
______begin
____________count<=(others=>'0');
____________case up is
____________end case;
____________end if;
____________end if;
______end process;
______sum<=count;
______else '0';
end Behavioral;
Threebit_updowncounter_TEST_BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_threebit_updowncounter IS
END Tb_threebit_updowncounter;
COMPONENT threebit_updowncounter
PORT(
___clk : IN std_logic;
___reset : IN std_logic;
___count_en : IN std_logic;
___up : IN std_logic;
);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
--Outputs
BEGIN
);
begin
end process;
-- Stimulus process
stim_proc: process
begin
__________________reset<= '1';
________________________count_en<= '1';
________________________up<= '1';
________________________up<= '0';
_____wait;
_____end process;
end;
1st line_____clk
2nd line_____reset
3rd line______count_en
4th line______up
5th line_______sum
6th line_______[2]___QC
7th line_______[1]___ QB
8th line_______[0]___ QA
A time span of 1700ns is being covered. Time period of the clock is 100 ns.
Threebit_Counter
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity threebitcounter is
______reset : in STD_LOGIC;
______count_en : in STD_LOGIC;
end threebitcounter;
begin
______process(clk,reset)
______begin
______if reset = '0' then
______count<=(others=> '0');
______count<= count+1;
______end if;
______end if;
______end process;
______sum<=count;
end Behavioral;
Threebit_counter_TEST_BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_threebitcounter2 IS
END Tb_threebitcounter2;
PORT(
___clk : IN std_logic;
___reset : IN std_logic;
___count_en : IN std_logic;
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
);
clk_process :process
begin
end process;
-- Stimulus process
stim_proc: process
begin
__________________count_en<= '1';
__________________count_en<= '0';
wait;
end process;
END;
First line_________Clock
Second Line_______Reset
Third Line_________Count_en
Fourth Line________SUM
entity threebitcounter_two is
______reset : in STD_LOGIC;
______count_en : in STD_LOGIC;
end threebitcounter_two;
begin
________________process(clk,reset)
________________begin
________________count<=(others=> '0');
----count is null
________________else
__________________count<=(others=> '0');
__________________end if;
________________end if;
________________end if;
________________end process;
________________sum<=count;
________________else '0';
end Behavioral;
Threebit_counter_TEST_BENCH
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_threebitcounter_two IS
END Tb_threebitcounter_two;
PORT(
__clk : IN std_logic;
__reset : IN std_logic;
__count_en : IN std_logic;
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
);
clk_process :process
begin
end process;
-- Stimulus process
stim_proc: process
begin
________________________count_en<= '1';
________________________count_en<= '0';
________________________wait;
end process;
END;
First line_________Clock
Second Line_______Reset
Third Line_________Count_en
Fourth Line________SUM
During count_en <= ‘1’ 1600 ns elapse hence counter counts up two times
and resets two times. Two times counter reaches “111” and generates cout =
‘1’.It gets a chance to count the third time. Just then count_en <= ‘0’.Hence
we see only “000” and up count stops.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity mux4_1 is
end mux4_1;
begin
______y<= d(0) when s = "00" else
______d(3);
end Behavioral;
MUX2_1
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity mux2_1 is
Port ( d1 : in STD_LOGIC;
d2 : in STD_LOGIC;
s : in STD_LOGIC;
y : out STD_LOGIC);
end mux2_1;
architecture Behavioral of mux2_1 is
begin
process(d1,d2,s)
begin
else
y<=d2;
end if;
end process;
end Behavioral;
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_mux2_1 IS
END Tb_mux2_1;
COMPONENT mux2_1
PORT(
____d1 : IN std_logic;
____d2 : IN std_logic;
____s : IN std_logic;
);
END COMPONENT;
--Inputs
--Outputs
signal y : std_logic;
BEGIN
____s => s,
____y => y
);
-- No clocks detected in port list. Replace <clock> below with
--
-- <clock>_process :process
-- begin
-- end process;
--
-- Stimulus process
stim_proc: process
begin
__________________d1<= '0';
__________________d2<= '0';
__________________s<= '0';
__________________d1<= '1';
__________________d2<= '0';
__________________s<= '0';
__________________d1<= '0';
__________________d2<= '1';
__________________s<= '0';
__________________d1<= '1';
__________________d2<= '1';
__________________s<= '0';
__________________d1<= '0';
__________________d2<= '0';
__________________s<= '0';
__________________d1<= '1';
__________________d2<= '0';
__________________s<= '1';
__________________d1<= '0';
__________________d2<= '1';
___________________s<= '1';
__________________d1<= '1';
__________________d2<= '1';
__________________s<= '1';
__________________d1<= '0';
__________________d2<= '0';
__________________s<= '1';
__________________d1<= '1';
__________________d2<= '0';
__________________s<= '1';
__________________d1<= '0';
__________________d2<= '0';
__________________s<= '0';
wait;
end process;
In next 100 ns, select input is kept at ‘0’ for 50 ns and for ‘1’ for the
remaining part of 100 ns.
MUX2_1version4
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_mux2_1_version4 IS
END Tb_mux2_1_version4;
COMPONENT mux2_1_version4
PORT(
___s : IN std_logic;
);
END COMPONENT;
--Inputs
--Outputs
signal y : std_logic;
BEGIN
-- Instantiate the Unit Under Test (UUT)
____s => s,
____d => d,
____y => y
____);
--
-- <clock>_process :process
-- begin
-- end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100ms.
____________d<= "00";
____________s<= '0';
____________d<="01";
____________s<= '0';
____________d<="10" ;
____________s<= '0';
____________d<="11";
____________s<= '0';
____________d<="00";
____________s<= '0';
____________d<="01";
____________s<= '1';
____________d<="10";
____________s<= '1';
____________d<="11";
____________s<= '1';
____________d<="00";
____________s<= '1';
____________d<="01" ;
____________s<= '1';
____________d<= "00";
____________s<= '0';
_______wait;
end process;
END;
The simulation is carried out for 225 ns.
In next 100 ns, select input is kept at ‘0’ for 50 ns and for ‘1’ for the
remaining part of 100 ns.
MUX4_1
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.All;
USE ieee.numeric_std.ALL;
ENTITY Tb_mux4_1 IS
END Tb_mux4_1;
COMPONENT mux4_1
PORT(
____);
END COMPONENT;
--Inputs
--Outputs
signal y : std_logic;
BEGIN
____s => s,
____d => d,
____y => y
_____);
--
-- <clock>_process :process
-- begin
-- end process;
-- Stimulus process
stim_proc: process
begin
____________d<= "0101";
____________s<= "00";
____________s<= "01";
____________s<= "10";
____________s<= "11";
____________d<= "0000";
____________s<= "00";
___________wait;
end process;
END;
____________Next subtrace is s(1) which is ‘0’ for 50ns, ‘1’ for 100ns, ‘0’
for the remaining time;
____________Next subtrace is s(0) which alternates between ‘0’ a nd ‘1’
for 200ns;
_______Lowest Trace is y: y samples d(0) for 50ns, d(1) for 50ns, d(2) for
50ns and d(3) for last 50ns of the 200ns active time.
Chapter 5_ DSD_Moore and Mealy State Machines.
This chapter gives the central philosophy of State Machines. Moore and Mealy Machines are an
effective way of overcoming von Neumann bottle neck which the conventional Personal Computer
faces.
In 1942, Manhatten Project was launched by US Government in Los Alamos National Laboratory in
absolute secrecy. J. Robert Oppenheimer, the renowned nuclear scientist from University of California
Berkeley, was heading this Project. The aim of this Project was to develop the nuclear fission bomb
more commonly known as Atom Bomb. [Two atom bombs named ‘Little Boy’ and ‘Fat Man’ were
subsequently dropped on Hiroshima and Naqasaki, Japan, respectively on 6th August 1945 and this
catastrophe forced Japan to surrender bringing an end to World War II ]
In course of this development huge amount of theoretical calculations were required for which Stored
Program Digital Computers were required. The concept of stored program digital computer was first
proposed by Allan Turing in 1936. Inspired by the lectures of Max Newman at the University of
Cambridge on Mathematical Logic, Allan Turing wrote a paper on On Computable Numbers, with an
Application to the Entscheidungsproblem, which was published in the Proceedings of the London
Mathematical Society. This gave birth to Universal Turing Machine. Huge amount of Data Crunching
requirement in Manhatten Project necessitated the development of Stored Program Computer called
EDVAC(Electronic Discrete Variable Automatic Computer).
John von Neumann became involved with Manhatten Project for the sake of development of Stored
Program Digital Computer. Von Neumann was a Hungarian American Mathematician who was
considered to be the last of the great mathematicians and who subsequently won the title of Father of
Modern Digital Computer. He submitted First Draft of a Report on the EDVAC dated 30 June 1945.
This was inspired by Universal Turing Machine and this was known as von Neumann Architecture.
Stored-program computers were an advancement over the program-controlled computers of the 1940s,
such as the Colossus and the ENIAC, which were programmed by setting switches and inserting patch
leads to route data and to control signals between various functional units. ENIAC used to take 3 weeks
to write a new program and get it run.
In Figure 1, the proposed architecture is shown. In this new architecture , Memory and
CPU(ALU+Control Unit) are separated. Memory stores both data and instructions. This works
sequentialy. Through Data Buses the data is sent to and fro between the memory and CPU. CPU works
much faster than the availability of data. This is because CPU processing speed is being scaled up with
each new generation of technology but the rise in bus speed is not commensurate. Hence we face a
limited throughput between memory and CPU as compared to the size of the memory. Because of the
limited throughput CPU is continuously waiting for data after completing its number crunching. This
considerably slows down the Instructions per second execution. This slowing down of computer is due
to “von Neumann Bottleneck” and it can be removed by matching the bus speed with CPU processing
speed. Several methods have been suggested to overcome this problem.
In the initial phase three standard methods were suggested to overcome von Neumann bottle neck:
i. A cache memory between the main memory and CPU. This cache memory stores the current data
and makes it readily available to CPU. For rapid exchange of Data between cache and CPU, cache
is made of SRAM whereas the main memory is DRAM. SRAM is made of BJT and has a much
faster access time as compared to that of DRAM which is made of CMOS.
ii. Providing separate Caches and separate access paths for data and instructions. This is known as
Harvard Architecture.
iii. Using Branch predictor and logic.
a. Systolic Architecture.
b. Data-flow Architecture.
c. Pipeline Architecture.
This has eased the bottleneck but not eradicated the problem. Construction of ‘State Machines’ is a step
in that direction. Here it may be mentioned in passing that all these architectures are based on
‘Algorithmic Programming’ which use ‘Boolean Logic’. This is in contrast to ‘Heuristic Programming’
which is based on ‘Rules of Thumb’ and which uses ‘Predicate Logic’. The Fifth Generation
Computers more commonly known as Artificial Intelligence Machines are based on heuristic
programming and use ‘LISP’ and ‘PROLOG’ programming languages. These have already come in the
market and are being used as Knowledge Expert Systems in Health, Care and Delivery.
To appreciate the superiority of State Machines over the present Desk Top Computers we must look at
the following VHDL example which can be run on both State Machine and CPU:
Else
___State <= running;
End if;
This program defines two states: ‘ALARM’ state and ‘RUN’ state. When condition 1 namely ‘a > 37
and c < 7’ is fulfilled the machine is put in Alarm state and if condition 2 namely ‘a < 37 and c > 7’ is
fulfilled then machine is put in Run state.
If this program is implemented on CPU, the program will be translated into 10 to 20 machine
instructions taking more than 10 to 20 clock cycles time to execute the program. But if the same
program is implemented in gates and flip-flops as it is done in State Machine then the whole program
will be executed in one clock cycle. Hence State Machines implemented in logic gates and flip-flops is
much more powerful than CPU.
As seen in Figure 2, Register has the code of a given state. This code is applied to the Logic Network.
In accordance with the current state code, Logic Network responds. It takes some time to respond to the
applied state code. Once Logic Network has settled to the new state as dictated by the state code
applied to it, it defines and applies a new state code to the Register. At the next clock pulse this new
code is written and stored in the register. This is called sampling. Register samples the new state code.
In between the clock pulses, a new state code is applied to Logic Network. In this way through a series
of clocks pulses, Logic Machine moves through all the states defined by the program and accomplishes
it tasks. This is achieved in a much shorter time. As can be seen in the state diagram, the logic machine
should have settled to a stable state before a clock pulse is applied and before the new state code is
sampled into the register. Thus a State Machine is a clocked sequential circuit and it goes through finite
number of states hence it is called Finite State Machines (FSM).
Mealy Machine:
In a Mealy Machine, the outputs are a function of the present state and the value of the current
inputs as shown in Figure 3.
Accordingly the outputs of a Mealy Machine can change asynchronously in response to any
change in the inputs. The output need not change at a Clock Pulse.
Moore Machine:
In Moore Machine outputs depend only on the present state as shown in Figure 4.
Combinational logic block 1 maps the inputs and the current state into the necessary flip-flop
inputs. The flip-flops act as memory elements. The outputs of the memory elements are the present
state code and impressed on the second combinational logic circuit.
The second combinational logic circuit generates the outputs corresponding to the present state.
The outputs change synchronously with the state transition triggered by the active clock edge
applied to the memory elements.
5.3. Design and Construction of Finite State Machine by Mealy Design Approach and Moore Design
Approach.
The customer wants a Motor Rotation Sensor. The sensor should indicate if the Motor is spinning in
Anti-Clockwise (POSITIVE) or Clockwise (NEGATIVE) direction.
As can seen from Figure 5 there are two Sensors 1 and 2 which are so spatially placed that they
generate a square wave with 90 degree phase shift corresponding to P1 and P2. When both are ‘00’ then
Negative Rotation changes this to ‘01’ and Positive Rotation changes this to ‘10’.
5.4. Comparison of Mealy and Moore Machines while designing ‘10’ pattern detector.
Figure 6. The state diagrams of Mealy and Moore Machines designed for detecting ‘10’ pattern.
Problem 1 : Our customer has asked for ‘10’ Sequence Detector . This should give an output HIGH
only when ‘10’ sequence is detected.
We will design a FSM(Finite State Machine) which checks for ‘10’ pattern and when such a pattern is
detected it gives an output HIGH otherwise output is maintained LOW.
We can take both Mealy Machine approach as well as Moore Machine approach.
First let us consider Mealy Machine State Diagram given on the left of Figure 6.
Mealy Machine State Diagram lists the input/associated_output on the state transition arcs.
Let us consider Moore Machine State Diagram given on right hand side of Figure 6.
A Moore Machine produces an unique output for every state irrespective of inputs.
Accordingly the state diagram of the Moore Machine associates the output with its respective state in
the form state-notation/output-value.
State transition arrows of Moore Machine are labeled with the input value that triggers the transition.
As seen in the state diagram Figure 6, there are three distinct states: ‘initial’ , ‘1’ and ‘11’.
In the state ‘initial’, output is LOW. If the first input is 0 , machine remains in ‘initial’ state.
If the first input is 1 then this input triggers the transition to the second state ‘1’ and since the
desired pattern is not achieved therefore output remains LOW but we have moved one step in the
direction of desired detection.
If the second input is 1, we remain in state ‘1’ and output remains LOW. We continue to remain in
state ‘1’ because we can hope to detect ‘10’ pattern at the third input.
But if second input is 0, we have hit the Jack Pot. Hence we move to the third state ‘10’ which
corresponds to output HIGH.
If the third input is 1, we revert to state ‘1’ because at fourth input = 0 we can again hit the Jack
Pot.
But if the third input is 0 at the fourth input we can never hit the Jack Pot hence we reset to ‘initial
‘state.
Problem 2 : My customer has asked for ‘111’ Sequence Detector . This should give an output HIGH
only when ‘111’ sequence is detected.
In Figure 7 we describe the state diagram of a Mealy Machine which will be a ‘111’ sequence detector.
This Finite State Machine has three distinct states: Initial State, Got-1 state and Got-11 state.
Initial state should clearly be a reset state where input is 1 and output is 1.
When first input is 0, machine remains in initial state with output LOW.
When first input is 1, output remains LOW but FSM makes a transition to Got-1 state. The
machine is one step nearer the Jackpot.
When second input is 0, output remains LOW and machine reverts back to Initial State.
When second input is 1, output remains LOW but now it is two steps nearer the Jackpot hence
FSM makes a transition to Got-11 state.
When third input is 0, output remains LOW and the FSM resets as there is no chance of hitting the
Jackpot at the fourth input.
But when third input is 1, the Jackpot is hit and output is HIGH but FSM remains at Got-11 state
because at the fourth input , if 1, it can again hit the Jackpot.
Initially A and B are in reset condition. Hence Qa and Qb are LOW and Qa* and Qb* (the
complements) are HIGH. Initially X= 0. So initial condition is defined as X=0, Da=0,Db=0Qa=0 , Qb
=0 and Z=0. This is ‘initial state AB=00’.
And Z = X.Qa
Hence first input HIGH makes Db HIGH but Da remains LOW. Therefore in second state we have
AB=01 and Z=0.
Now as soon as Clock appears, at the lagging edge of the Clock(since Clock has a bubble) Db=1 is
entered into Db Flip Flop. Hence Qb =1 and Qb* =0.
So Da = 1 and Db = 0.
At the next clock A_FF is set and B_FF is reset. Therefore Third state is ‘Got-11_AB=10’. And if X
continues to be HIGH then Z= 1.
Initial 0 0 0 0 0 0 0 0
Got-
1 0 1 0 0 0 1 0
1_AB=01
Got-
1 1 0 0 1 1 0 0
11_AB=10
Got-
1 1 0 1 1 0 0 1
11_AB=10
As can be seen in Figure 9 , X remains HIGH for some time when A_FF is SET and B_FF is RESET at
the third Lagging Edge of the Clock. This gives a ‘FALSE HIGH’ known as ‘OUTPUT GLITCH’.
Initial Initial/0 0
Got-1 ‘1’/0 0
Got-11 ‘11’/0 0
Got-111 ‘111’/1 1
X=0 X=1 Z
We will use J-K FF and D-FF for the implementation Moore Machine as ‘111’ string detector. Table 4
and Table 5 give the excitation table for J-K_FF and D_FF.
[Q(N) is the output before the clock and Q(N+1) is the output after the clock]
When K=1 then J=1 gives TOGGLE and J=0 gives RESET.
× 1 1 0
Hence O/P is 0 in either case if Q(N)=1;
When K=0 then J=1 gives SET and J=0 gives NOCHANGE.
× 0 1 1
Hence O/P is 1 in either case if Q(N)=1;
Table 5. Excitation Table of D_FF
D Q(n) Q(n+1)
0 0 0
1 0 1
0 1 0
1 1 1
These excitation tables have been derived from Truth-Table of J-K_FF and D_FF.
J K Q(N+1) D Q(N+1)
No change 0 0 Q(N) 0 0
RESET 0 1 0 1 1
SET 1 0 1
TOGGLE 1 1 Q(N)*
A B X A B Ja Ka Db Z
0 0 0 0 0 0 × 0 0
0 0 1 0 1 0 × 1 0
0 1 0 0 0 0 × 0 0
0 1 1 1 0 1 × 0 0
1 0 0 0 0 × 1 0 0
1 0 1 1 1 × 0 1 0
1 1 0 0 0 × 1 0 1
1 1 1 1 1 × 0 1 1
Simplifying Table 7 using Karnaugh’s Map we get the following Logic Functions.
Ja = X.B
Ka = X*
Db = X(A+B)
Z = A.B
Figure 11. A Moore Machine Logic Circuit and FF configuration for ‘111’ sequence detector.
The Timing Diagram for Moore Machine is shown in Figure 12. There is no output glitch in Moore
Model. This is because the output depends on clearly defined states of the Flip-Flop which are
synchronized with clock. The outputs remain valid through out the logic state.
Figure 12. Timing Diagram for Moore Model of string detector.
State Machine implementation of string detector of any size ‘11’ or ‘111’ involves much less clock
cycles as compared to the same string detector implemented on CPU of a Personal Computer.
DSD_Chapter 5_StateMachines_Part3_MooreMachine Motor Rotation
Sensor Design and Synthesis.
Chapter 5 , Part 3 describes the VHDL Synthesis of Electric Motor Rotation
Sensor.This SENSOR gives GREEN LED output for Clockwise sense of
rotation and RED LED output for anti-Clockwise sense of rotation.
DSD_Chapter 5_StateMachines_Part2_MooreMachineDesign
The customer wants a Motor Rotation Sensor. The sensor should indicate if
the Motor is spinning in Anti-Clockwise (Negative) or Clockwise (Positive)
direction.
As can seen from Figure 1 there are two Sensors 1 and 2 which are so
spatially placed that they generate a square wave with 90 degree phase shift
corresponding to P1 and P2. When both are ‘00’ then Negative Rotation
changes this to ‘01’ and Positive Rotation changes this to ‘10’.
We will take Moore Machine Design approach. Figure 2 gives the state
diagram:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
--library UNISIM;
--use UNISIM.VComponents.all;
entity MooreMachine_Rot_Sens is
______reset : in STD_LOGIC;
end MooreMachine_Rot_Sens;
signal state:state_type;
begin
process(clk,reset)---clocked process
begin
____________case state is
____________when s0=>
_______________________state<=s1;
_________________end if;
____________when s1=>
________________________state<=s2;
________________________state<=s3;
________________________state<=s0;
__________________end if;
____________end case;
______end if;
end process;
begin
case state is
end case;
end process;
end Behavioral;
After we have made VHDL codes SYNTAX ERROR free, we click LEFT
HAND CORNER of Synthesis -XST. We get the following.
2) HDL Compilation
4) HDL Analysis
5) HDL Synthesis
8) Partition Report
9) Final Report
While doing the actual simulation, we can see the detailed Synthesis
Report.
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- that these types always be used for the top-level I/O of a design in order
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY mooremachineTB IS
END mooremachineTB;
COMPONENT mooremachinerotation_sensor
PORT(
clk : IN std_logic;
reset : IN std_logic;
out1 : OUT std_logic_vector(1 downto 0)
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
);
begin
end process;
-- Stimulus process
stim_proc: process
begin
reset<= '0';
in1<= "00";
in1<= "01";
reset<= '1';
reset<= '0';
wait for 20ns;
in1<= "00";
in1<= "10";
reset<= '1';
wait;
end process;
“00” is followed “01” and the machine transit to S3/”11” at the leading
edge of the Clk Pulse. This is decoded as Positive Rotation.
Now “00” is followed by “10” the output is S2/“10” at the leading edge of
the Clk Pulse. This is decoded as Negative Rotation.By enabling the
RESET the second time , we again RESET the Machine to S0/”00” stste.
DSD_Chapter 5_Part 3_Design of a Mealy Machine_Rotation_Sensor
Part 3 of State Machines implements Moter Rotation Sensor using Mealy
State Machine Design approach.
Moore Machine’s output depends only on the state code whereas Mealy
Machine’s output depends on the inputs + the current state code.
LED denoting
POSITIVE
0 00→“01” S1→S3 “11”
ROTATIN will light
up
Through Process P0, current state + IN1 generate the next state.
Simultaneously current state through Process P2 generates its unique
OUT1.
At Clk’event, the next state is entered into the REGISTER and is made
available for ‘n+1’ event.
When RESET is activated then Register always initializes to S0. Then
RESET must be disabled.
Only after disabling RESET, the system will respond to the Clk’event.
LED denoting
‘00’→ NEGATIVE
0 S1→S2 “10”
‘10’ ROTATION will light
up
LED denoting
‘00’→
0 S1→S3 “11” POSITIVE ROTATIN
‘01’
will light up
‘00’→
0 S1→S0 “00” No output
‘11’
The arcs contain the input which causes the transition between the
respective states as shown.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--use UNISIM.VComponents.all;
entity MealyMachine_Rot_Sens is
end MealyMachine_Rot_Sens;
begin
process(clk,reset)
begin
____________state<=s0;
____________case state is
__________________when s0=>
______________________________end if;
__________________when s1=>
______________________________end if;
____________end case;
end if;
end process;
begin
case state is
_____________________________out1<= "00";
_____________________________end if;
______________________________end if;
______________________________end if;
end case;
end process;
end Behavioral;
We carry out Synthesize XST until we get syntax error free GREEN sign.
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_MealyMachine_Rot_Sens IS
END Tb_MealyMachine_Rot_Sens;
COMPONENT MealyMachine_Rot_Sens
PORT(
clk : IN std_logic;
reset : IN std_logic;
);
END COMPONENT;
--Inputs
signal clk : std_logic := '0';
--Outputs
BEGIN
);
clk_process :process
begin
end process;
-- Stimulus process
stim_proc: process
begin
____________reset<= '0';
____________in1<= "00";
____________in1<= "01";
____________in1<= "11";
____________in1<= "10";
____________in1<= "00";
____________wait for 10 ns;
____________in1<= "01";
____________in1<= "11";
____________in1<= "10";
__wait;
__end process;
END;
We are having Positive Rotation hence out1 = “11” when in1 is “01”
following “00”.
DSD_Chapter 5_Supplement_Optical TERA BUS
This Chapter 5_Supplement describes TERA BUS which has gone a long
way in easing the bandwidth bottleneck existing between the Processor and
Data Bus.
[“Get on the Optical Bus”, IBM’s light powered links overcome the greatest
speed bump in supercomputing: interconnect bandwidth, by Clint Schow,
Fuad Doany and Jeffrey Kash, September 2010, IEEE SPECTRUM, pp 30-
35]
Apart from this there is severe cross-talk among the metallic interconnects
leading to excessive bit-error rate (BER). At 10 gigabits per second bit
rates, cross talk blurs the signal after 1 meter of propogation down the
copper bus. With the increase in processing speed the problem of
attenuation and cross-talk is becoming more acute. Several methods were
adopted to overcome the bandwidth bottleneck problem. The foremost
method amongst these is storing the current data in Cache Memory.
Multigigahertz Clock rate has been achieved within the microprocessor
between processing core and on-chip cache memories but the data exchange
between the chip and external components ( say external memories) has
been one order of magnitude slower.
This bandwidth gap between the processor and the buses will continue to
widen as processor performance improves with scaling and improved
processor architecture.
In 1988, TAT-8 optical fiber cables were laid across the bottom of Atlantic
Ocean for trans-oceanic voice-video-data cable transmission.
By 1990s, fiber-optic links were being used in local area networks (LANS)
and in Storage Area Networks, interconnecting systems hundreds of meter
apart. Optically linked LANS made Video-conferencing possible within a
campus.
In 2008 IBM introduced RoadRunner using 40,000 optical fiber link buses.
This reached Peta FLOPS capability. Peta means 1015. Hence Road runner
had almost 2 orders of magnitude of performance improvement over that of
Blue Gene L.
In IBM Blue Waters machine 1 million optical interconnects are being used.
This is expected to reach 10 PFLOPS capability. To achieve 1000-PFLOPS
we will need 400 million optical links.
Year Capability
2012 10PFlops
2016 100PFLOPS
the optical signals from the optical BUS and launches the optical signals
into the optical BUS. The opto-chip is shown in Figure 1. At the front side
of the opto-chip is CMOS Transceiver which receives electrical signals
from and transmits electrical signals to the Processor of the parallel
machine.
In future we see that electrical connections will supply the power to the
processor, it will provide the ground and it will provide the control signals.
Data will always move in and out of the processor as photons and they will
travel at the speed of light down the TERA BUS connecting the numerous
processors.
DSD_Chapter 6_Mighty Spartans in Action_Introduction.
In Chapter 6, real life problems will be handled using Digital System
Design based on VHDL. In Introduction we give som of the recent
advances in FPGA architecture and we implement BCD-to-Seven Segment
Decoder to drive a Seven-Segment Display.
Sparta was unique in the ancient times for its social system and constitution,
which completely focused on military training and excellence and it
dominated Greece peninsula up to 300BC. Subsequently by 100BC it was
conquered by Romans. Its inhabitants were classified as Spartan citizens,
who enjoyed full rights, non-Spartan free men raised as Spartans, freedmen
and state-owned serfs (enslaved non-Spartan local population). Spartans
underwent rigorous military training and education regimen, and Spartan
soldiers were widely considered to be among the best in battle. Spartan
women enjoyed considerably more rights and equality to men than
elsewhere in the classical world. Spartans remained a city state which
fascinated the people of all cultures and of all times. Thus we have FPGA
named Spartan2 and Spartna3.
Examples of ASSPs are integrated circuits that perform video and/or audio
encoding and/or decoding.
This is available as a MSI_IC chip by the TTL code name 7447. This
converts a binary code into its equivalent decimal magnitude and drives a
Seven-Segment LED Display to display the corresponding decimal
magnitude. We will give the behavioral architecture description and
implement it on Spartan2.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
--library UNISIM;
--use UNISIM.VComponents.all;
entity BCD_to_Seven is
__Port ( bcd : in STD_LOGIC_VECTOR(3 downto 0);
end BCD_to_Seven;
begin
_________process(bcd)
_______________begin
____________________case bcd is
________________________when"0000"=>seven<="0111111";
________________________when"0001"=>seven<="0000110";
________________________when"0010"=>seven<="1011011";
________________________when"0011"=>seven<="1001111";
________________________when"0100"=>seven<="1100110";
________________________when"0101"=>seven<="1101101";
________________________when"0110"=>seven<="1111101";
________________________when"0111"=>seven<="0000111";
________________________when"1000"=>seven<="1111111";
________________________when"1001"=>seven<="1101111";
____________________end case;
_________end process;
end Behavioral;
Since this is not a FSM (finite state machine), we need not define the Clock.
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY Tb_BCD_to_Seven IS
END Tb_BCD_to_Seven;
COMPONENT BCD_to_Seven
PORT(
);
END COMPONENT;
--Inputs
--Outputs
BEGIN
);
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 10 ns.
bcd<="0000";
bcd<="0001";
bcd<="0010";
bcd<="0011";
bcd<="0100";
bcd<="0101";
bcd<="0110";
bcd<="0111";
bcd<="1000";
wait;
end process;
END;
When INC is TRUE the score is incremented. When DEC is TRUE the
score is decremented. When INC and DEC, both, are true then no change
occurs.
There will be two-digit BCD counter which can count from decimal 00 to
decimal 99. To display the two-digit decimal number we wil have two 7-
segment displays.
There will be two ‘BCD to 7-segment decoder driver’ which will drive the
two ‘7-segment displays’.
6.1.2. Controller.
Initial state
Count State S1(count state)For every clock
S0(initialization
cycle incrementing or decrementing is done.
state)
The unsigned vector is used so that overload ‘+’ operator is used for
incrementing the counter by 1 and ‘-‘ operator is used for decrementing the
counter by 1.
Table 2.
‘seg7disp0<= seg7rom(to_integer(BCD0))’;
Here ‘to_integer(BCD0)’ converts BCD0(4-bit vector) to integer type data
which is the row index of the array of 7-bit vectors stored in seg7rom.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.numeric_bit.all;
entity Cricket_scoreboard is
rst : in bit;
inc : in bit;
dec : in bit;
end Cricket_scoreboard;
("0111111","0000110","1011011","1001111","1100110","1101101",
begin
______process(clk)
______begin
_______________________case state is
____________________________________state <= 0;
____________________________________else
____________________________________end if;
____________________________________rstcnt <= 0;
____________________________________end if;
____________________________________rstcnt <= 0;
____________________________________if BCD0 > "0000" then
____________________________________end if;
______________________________end if;
__________________________when others=>null;
_____________________end case;
_______________end if;
__________end process;
end behavioral;
We carry out the syntax check. After it becomes error free we use Xilinx
Synthesis Tool to synthesize my system.
LIBRARY ieee;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use IEEE.numeric_bit.all;
ENTITY TB_Cricket_Scoreboard IS
END TB_Cricket_Scoreboard;
COMPONENT Cricket_scoreboard
PORT(
____clk : IN bit;
____inc : IN bit;
____dec : IN bit;
____);
___END COMPONENT;
______constant seg7rom:sevsegarray :=
("0111111","0000110","1011011","1001111",
______"1100110","1101101","1111100","0000111","1111111","1100111");
--Inputs
--Outputs
BEGIN
____);
clk_process :process
begin
___end process;
-- Stimulus process
___stim_proc: process
___begin
______________________________rst<= '0';
______________________________inc<= '1';
______________________________dec<= '0';
______________________________rst<= '0';
______________________________inc<= '0';
______________________________dec<= '0';
______________________________rst<= '0';
______________________________inc<= '1';
______________________________dec<= '0';
______________________________rst<= '0';
______________________________inc<= '0';
______________________________dec<= '0';
______________________________rst<= '0';
______________________________inc<= '1';
______________________________dec<= '0';
______________________________rst<= '0';
______________________________inc<= '0';
______________________________dec<= '0';
______________________________wait;
_____end process;
END;
Then there are seven traces corresponding to the seven inputs to Display1.
Again there are seven traces corresponding to the seven inputs to Display0.