Internship Report Copy (1)
Internship Report Copy (1)
CERTIFICATE
Certified that the internship project (18EC74)work titled Simulation of Digital ciruits
and Embedded Protocols using Verilog HDL is carried out by Bhanu Prakash
Sedamkar (1RV19EC037) who is bonafide student of RV College of Engineering,
Bengaluru, in partial fulfillment of the requirements for the degree of Bachelor of En-
gineering in Electronics and Communication Engineering of the Visvesvaraya
Technological University, Belagavi during the year 2022-23. It is certified that all cor-
rections/suggestions indicated for the Internal Assessment have been incorporated in the
minor project report deposited in the departmental library. The internship project report
has been approved as it satisfies the academic requirements in respect of internship project
work prescribed by the institution for the said degree.
External Viva
1.
2.
DECLARATION
Further I declare that the content of the dissertation has not been submitted previously
by anybody for the award of any degree or diploma to any other university.
I also declare that any Intellectual Property Rights generated out of this project carried
out at RVCE will be the property of RV College of Engineering, Bengaluru and we will
be one of the authors of the same.
Place: Bengaluru
Date:
Name Signature
I express sincere gratitude to our beloved vice Principal, Dr. K. S Geetha and
Principal, Dr. K. N. Subramanya for the appreciation towards this project work.
I thank all the teaching staff and technical staff of Electronics and Communication
Engineering department, RVCE for their help.
Lastly, I take this opportunity to thank my family members and friends who provided
all the backup support throughout the project work.
SYNOPSIS
The primary goal of this project is to provide SPI (Serial Peripheral Interface) connec-
tion between the FPGA (Field Programmable Gate Array), which serves as the master
device, and any slave devices (which can be any device which we want to interface). For
successful communication from the master device (FPGA) to any slave device that we
want to connect, the four SPI communication modes are tested, simulated, and validated
here.
By adjusting Clock Priority (CPOL) and Clock Phase, several modes of SPI can be
activated (CPHA). When the mode is 0, Clock phase is configured such that data is
sampled on the rising edge of the clock pulse and shifted out on the falling edge of the
clock pulse. When it is mode 1, Clock phase is configured such that data is sampled on
the falling edge of the clock pulse and shifted out on the rising edge of the clock pulse.
Whereas, Clock phase is configured such that data is sampled on the falling edge of the
clock pulse and shifted out on the rising edge of the clock pulse, when the mode is 2.
While, Clock phase is configured such that data is sampled on the rising edge of the clock
pulse and shifted out on the falling edge of the clock pulse, when it’s in mode 3.
The results of the UART transmission protocol was verified using Vivado and opti-
mized code for the same was developed. It is observed that UART transmission is slower
then that of SPI. The data rate of the UART devices communicating with each other
must be equal due to the asynchronous type of communication.
i
CONTENTS
Synopsis i
List of Figures iv
3 Tasks Performed 7
3.1 TASK 1: Introduction to verilog . . . . . . . . . . . . . . . . . . . . . . . 8
3.1.1 Very large scale integration . . . . . . . . . . . . . . . . . . . . . 8
3.1.2 Finite State Machine . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 TASK 2: Software and Hardware tools that used in Verilog . . . . . . . . 11
3.2.1 VIVADO: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2.2 FPGA: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 TASK 3: Building Basic circuit using verilog . . . . . . . . . . . . . . . . 12
3.3.1 Combinational Digital Circuits . . . . . . . . . . . . . . . . . . . 13
3.3.2 Sequential Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.4 TASK 4: Development of SPI Master using VHDL . . . . . . . . . . . . 18
3.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.4.2 SPI Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4.3 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4.4 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.4.5 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.4.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ii
3.5 Task 5: Development of UART communication using Verilog . . . . . . . 25
3.5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5.2 Working of UART . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.5.3 Steps involved in UART Transmission . . . . . . . . . . . . . . . 27
3.5.4 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4 Reflections 29
4.1 TASK 1: Introduction to verilog . . . . . . . . . . . . . . . . . . . . . . . 30
4.2 TASK 2: Software and Hardware tools that used in Verilog . . . . . . . . 30
4.3 TASK 3: Building Basic Circuits using Verilog . . . . . . . . . . . . . . . 31
4.4 TASK 4: Development of SPI Master using verilog . . . . . . . . . . . . 31
4.5 TASK 5: Development of UART Communication using Verilog . . . . . . 32
iii
LIST OF FIGURES
iv
RV College of Engineering® , Bengaluru - 560059
Chapter 1
Profile of the organization
CHAPTER 1
PROFILE OF THE ORGANIZATION
Name of the Organization: Vyorius,
mitment to innovation, customer service, and sustainability. The company has a strong
track record of delivering high-quality products and services to its customers and is well-
positioned for continued growth and success in the future.
1.1 Vision
• To be a leader in the VLSI industry and a trusted partner for customers
• To achieve long-term growth and success through a focus on excellence and contin-
uous improvement
1.2 Mission
• To design and manufacture high-quality VLSI integrated circuits (ICs) that meet
the needs of customers and end users
• To continuously improve the performance and efficiency of VLSI ICs through the
development of new technologies and processes
Chapter 2
Activities of the Department
CHAPTER 2
ACTIVITIES OF THE DEPARTMENT
2.1 About the department
A semiconductor foundry with its headquarters in Delhi called Vyorius produces VLSI
integrated circuits (ICs), drones, and robotics. The company subsequently emerged as
a significant semiconductor manufacturer. foundries in the globe, with an emphasis on
new technology research and innovation. It has a research and development staff that
is dedicated to creating new VLSI technology and designs in addition to its production
capabilities. The business is dedicated to providing its VLSI sector clients with top-notch
goods. The business has a proven track record of innovation and is always developing
new technologies and procedures to enhance the functionality and effectiveness of its
integrated circuits (ICs).
2.2 Manpower
Vyorius has current employer profiles, including Co-Founder and Board Member Amit
Kumar Singh.
This training program conducted by Amit Kumar Singh Co-Founder and Board Mem-
ber,Pankaj Kumar Co-Founder and CTO and Nishant Singh Rana Founder and CEO,
was 8 weeks online training with strong fundamental approach towards learning basic fun-
damentals of verilog and FPGA addressing the needs of industry and society along with
development and integration of hardware and software components. The organization
provided the certification after the successful completion of the internship.
2.3 Services
• In vyorius, they make appropriate policies for planning, monitoring and effective
utilization of the grants, from time to time.
• Perform such other functions and constitute committees, as may be necessary and
deemed fit for the proper development, and to fulfill the objectives of the depart-
ment.
• Develop employable human resource to meet the challenges in the field of Robotics
2.4 Products
The training programme was designed to give participants the opportunity to broaden
their knowledge and skills in core vlsi and embedded concepts, hardware, and software-
oriented solutions for a variety FPGA applications. Beginners (students, faculty, and
industry professionals) who are interested in developing a FPGA applications can ben-
efit from the training programme in VLSI. Provide structured training, Bridge the gap
between theoretical knowledge and market requirement.Create a pool of professional en-
gineers employable in a multitude of industries. Enhance multi-disciplinary capabilities.
Chapter 3
Tasks Performed
CHAPTER 3
TASKS PERFORMED
Chapter 3 deals with the various tasks performed in internship. The internship focuses
on implementation of verilog. There were 8 weeks of internship. Week 1 to week 4 was an
introductory course that dealt with understanding the basics of verilog system. Week 5
and week 6 was about implementation of basic circuits using vivado and implementation
on FPGA.Week 7 and Week 8 was about working on project.
The behavior of state machines can be observed in many devices in modern society
that perform a predetermined sequence of actions depending on a sequence of events
with which they are presented. Simple examples are vending machines, which dispense
products when the proper combination of coins is deposited, elevators, whose sequence of
stops is determined by the floors requested by riders, traffic lights, which change sequence
when cars are waiting, and combination locks, which require the input of a sequence of
numbers in the proper order.
Types of Finite State Machine
The finite state machines are classified into two types such as Mealy state machine
and Moore state machine.
one of them.
In this case, the current inputs, as well as current states, will decide the next states.
Thus, depending on further states, this machine will generate the outputs. So, the outputs
of this will be applicable simply after the conversion of the state.Generally, the amount
of required states in this machine is greater than otherwise equivalent to the required
number of states in the mealy state machine.
AS figure 3.4 Vivado Design Suite is a software suite produced by Xilinx for synthesis and
analysis of hardware description language (HDL) designs, superseding Xilinx ISE with
additional features for system on a chip development and high-level synthesis. Vivado
represents a ground-up rewrite and re-thinking of the entire design flow
3.2.2 FPGA:
Field Programmable Gate Array (FPGA) as in Figure 3.5 is an integrated circuit that
consists of internal hardware blocks with user-programmable interconnects to customize
operation for a specific application. The interconnects can readily be reprogrammed,
allowing an FPGA to accommodate changes to a design or even support a new ap-
plication during the lifetime of the part. The FPGA has its roots in earlier devices
such as programmable read-only memories (PROMs) and programmable logic devices
(PLDs). These devices could be programmed either at the factory or in the field, but
they used fuse technology (hence, the expression “burning a PROM”) and could not be
changed once programmed. In contrast, FPGA stores its configuration information in a
re-programmable medium such as static RAM (SRAM) or flash memory.
The concept of the Binary number system is the accurate representation of Digital
Signals. Digital Signals work on the principles of Boolean Algebra, binary mathematics
developed by George Boolean.
Digital Signals operate at high speeds and drive Digital Circuits that contain some
basic components such as Diodes, Inductors, Capacitors, Resistors, Batteries, and Logic
Gates.
The input variables, logic gates, and output variables are the basic components of the
combinational logic circuit. There are different types of combinational logic circuits, such
as Adder, Subtractor, Decoder, Encoder, Multiplexer, and De-multiplexer.
1. Half Adder:The half adder is a basic building block having two inputs and two
outputs. The adder is used to perform OR operation of two single bit binary
numbers. The carry and sum are two output states of the half adder.
2. Full Adder:The half adder is used to add only two numbers. To overcome this
problem, the full adder was developed. The full adder is used to add three 1-bit
binary numbers A, B, and carry C. The full adder has three input states and two
output states i.e., sum and carry.
The sequential circuit is a special type of circuit that has a series of inputs and outputs.
The outputs of the sequential circuits depend on both the combination of present inputs
and previous outputs. The previous output is treated as the present state. So, the
sequential circuit contains the combinational circuit and its memory storage elements.
A sequential circuit doesn’t need to always contain a combinational circuit. So, the
sequential circuit can contain only the memory element[3].
Types of Sequential circuits
The Sequential Circuits are classified into two types such as Asynchronous sequential
circuits and synchronous sequential circuits.
1. S-R flip flop:The S-R flip flop is the most common flip flop used in the digital
system. In SR flip flop, when the set input ”S” is true, the output Y will be high,
and Y’ will be low. It is required that the wiring of the circuit is maintained when
the outputs are established. We maintain the wiring until set or reset input goes
high, or power is shutdown.
2. JK flip flop:The JK flip flop is used to remove the drawback of the S-R flip flop,
i.e., undefined states. The JK flip flop is formed by doing modification in the SR
flip flop. The S-R flip flop is improved in order to construct the J-K flip flop. When
S and R input is set to true, the SR flip flop gives an inaccurate result. But in the
case of JK flip flop, it gives the correct output.
3. D flip flop:D flip flop is a widely used flip flop in digital systems. The D flip flop
is mostly used in shift-registers, counters, and input synchronization.
4. T flip flop:Just like JK flip-flop, T flip flop is used. Unlike JK flip flop, in T flip
flop, there is only single input with the clock input. The T flip flop is constructed
by connecting both of the inputs of JK flip flop together as a single input.
Shift Registers
A group of flip flops which is used to store multiple bits of data and the data is moved
from one flip flop to another is known as Shift Register. The bits stored in registers
shifted when the clock pulse is applied within and inside or outside the registers. To
form an n-bit shift register, we have to connect n number of flip flops. So, the number
of bits of the binary number is directly proportional to the number of flip flops. The flip
flops are connected in such a way that the first flip flop’s output becomes the input of
the other flip flop.
A Shift Register can shift the bits either to the left or to the right. A Shift Register,
which shifts the bit to the left, is known as ”Shift left register”, and it shifts the bit to
the right, known as ”Right left register”.
The shift register is classified into the following types:
Counters
A special type of sequential circuit used to count the pulse is known as a counter, or
a collection of flip flops where the clock signal is applied is known as counters.
The counter is one of the widest applications of the flip flop. Based on the clock pulse,
the output of the counter contains a predefined state. The number of the pulse can be
counted using the output of the counter.
2. Ring counter:A ring counter is a special type of application of the Serial IN Serial
OUT Shift register. The only difference between the shift register and the ring
counter is that the last flip flop outcome is taken as the output in the shift register.
But in the ring counter, this outcome is passed to the first flip flop as an input. All
of the remaining things in the ring counter are the same as the shift register.
3. Johnson counter:The Johnson counter is similar to the Ring counter. The only
difference between the Johnson counter and the ring counter is that the outcome of
the last flip flop is passed to the first flip flop as an input. But in Johnson counter,
the inverted outcome Q’ of the last flip flop is passed as an input. The remaining
work of the Johnson counter is the same as a ring counter. The Johnson counter is
also referred to as the Creeping counter.
3.4.1 Introduction
The Serial Peripheral Interface (SPI) [5]is a synchronous serial communication inter-
face specification used for short-distance communication, primarily in embedded systems.
SPI devices communicate in full duplex mode using a master-slave architecture usually
with a single master (though some Atmel devices support changing roles on the fly de-
pending on an external (SS) pin). The master (controller) device originates the frame for
reading and writing[6]. Multiple slave-devices may be supported through selection with
individual chip select (CS), sometimes called slave select (SS) lines as in Figure 3.8.
• CS /SS: Chip/Slave Select (often active low, output from master to indicate that
data is being sent)
the data. The combinations of polarity and phases are often referred to as modes which
are commonly numbered according to the following convention, with CPOL as the high
order bit and CPHA as the low order bit. Therefore, there are 4 modes of operations,
which we shall explore in this project.
• In Daisy Chain Configuration, only a single Slave Select line is connected to all
the slaves. The MOSI of the master is connected to the MOSI of slave 1. MISO
of slave 1 is connected to MOSI of slave 2 and so on. The MISO of the final slave
is connected to the MISO of the master. Consider the master transmits 3 bytes of
data into the SPI bus. First, the 1st byte of data is shifted to slave 1. When the
2nd byte of data reaches slave 1, the first byte is pushed into slave 2[8]. When the
3rd byte of data arrives into the first slave, the 1st byte of data is shifted to slave
3 and the 2nd byte of data is shifted into 2nd slave as in Figure 3.10.
3.4.3 Methodology
Different mode of SPI can be Activate by setting Clock priority(CPOL) and Clock
Phase(CPHA) as in Table 3.1[9]
1. Mode 0: Clock phase is configured such that data is sampled on the rising edge
of the clock pulse and shifted out on the falling edge of the clock pulse.
2. Mode 1:Clock phase is configured such that data is sampled on the falling edge of
the clock pulse and shifted out on the rising edge of the clock pulse.
3. Mode 2: Clock phase is configured such that data is sampled on the falling edge
of the clock pulse and shifted out on the rising edge of the clock pulse.
4. Mode 3:Clock phase is configured such that data is sampled on the rising edge of
the clock pulse and shifted out on the falling edge of the clock pulse.
the working of the SPI Master. The Clock Division module is necessary to ensure that
SPI communication happens at a proper clock frequency which is usually less than the
typical clock frequency of the FPGA master device ( in our design we have the SPI
clock frequency, SCK, equal to ¼ th of the clock frequency of the Master). Generally, we
have a PS (prescale factor) and the output clock is 2 power (-PS) times the input clock
frequency[10].
PORTS
The Clock Division module has the following ports :
INPUT:
• iclk: This is the input clock frequency fed to the master device (FPGA).
• ps: ps is the Prescale factor, i.e the factor by which we want to reduce the clock
frequency of the input clock so that SPI communication can be established. ps is
configured as an input to this module.
• mode: This is the input which is used to select the mode of operation of SPI
Communication. (There are 4 modes). mode is an input to this module.
OUTPUT:
• oclk: oclk is the output that is obtained from this module which gives the resulting
clock frequency at which SPI communication is destined to happen.
• iclk, rst: iclk is the input clock and rst is the input reset.
• MISO: MISO is the Master In Slave Out input pin which is used to send data to
the master device.
• tv: tv is a single bit input variable that represents a transmission byte valid signal,
which sends a control signal to the fpga board indicating it is ready for transmis-
sion[11].
• mode, ps: mode and ps are the same as defined above in the clock division module.
OUTPUT:
• r: r is an 8 bit vector which represents a received byte to be sent out by the master
device to the slave device.
• rv: rv is the received byte valid output signal which sends a control signal indicating
that the master device is ready to receive the data.
• CSN: CSN is the chip select signal which is active low, and is used to select the
slave device with which communication is to be established.
• MOSI: MOSI is the Master Out Slave In output pin which is used to send data
from the master device.
• SCK: SCK is the Serial clock output which represents the clock frequency at which
the SPI communication takes place.
Mode 2: Clock phase is configured such that data is sampled on the falling edge of
the clock pulse and shifted out on the rising edge of the clock pulse as in Figure 3.14.
Mode 3:Clock phase is configured such that data is sampled on the rising edge of
the clock pulse and shifted out on the falling edge of the clock pulse as in Figure 3.15.
3.4.6 Conclusion
This project was done to test the Serial Peripheral Interfaces (SPI) communication
modes using an FPGA board as an SPI master. The results of the simulation show
that an SPI communication was established from the master device. This shows that by
interfacing with other slave devices, serial communication can be easily and effectively
established. This module is easily portable and this code can be used to test the modes
of SPI communication of any FPGA board and also can be easily used in any design
specification that makes use of SPI communication. SPI finds a lot of applications in
modern day life. It is used in MMC or SD card including SDIO variant, in audio or
video codecs, in digital potentiometers, in flash and EEPROM memories, in real time
clocks and in LCD and LED. SPI can be used to talk to a variety of peripherals such
as sensors i.e. temperature and pressure, analog to digital converter (ADC), digital to
analog converter (DAC).
3.5.1 Introduction
In UART communication, two UARTs communicate directly with each other. The
transmitting UART converts parallel data from a controlling device like a CPU into serial
form, transmits it in serial to the receiving UART, which then converts the serial data
back into parallel data for the receiving device. Only two wires are needed to transmit
data between two UARTs. Data flows from the Tx pin of the transmitting UART to the
Rx pin of the receiving UART as in Figure 3.16
UARTs transmit data asynchronously, which means there is no clock signal to syn-
chronize the output of bits from the transmitting UART to the sampling of bits by the
receiving UART[12]. Instead of a clock signal, the transmitting UART adds start and
stop bits to the data packet being transferred. These bits define the beginning and end
of the data packet so the receiving UART knows when to start reading the bits.
When the receiving UART detects a start bit, it starts to read the incoming bits at a
specific frequency known as the baud rate. Baud rate is a measure of the speed of data
transfer, expressed in bits per second (bps)[13]. Both UARTs must operate at about the
same baud rate. The baud rate between the transmitting and receiving UARTs can only
differ by about 10 Percent before the timing of bits gets too far off.
UART transmitted data is organized into packets. Each packet contains 1 start bit,
5 to 9 data bits (depending on the UART), an optional parity bit, and 1 or 2 stop bits:
START BIT The UART data transmission line is normally held at a high voltage
level when it’s not transmitting data. To start the transfer of data, the transmitting
UART pulls the transmission line from high to low for one clock cycle. When the receiving
UART detects the high to low voltage transition, it begins reading the bits in the data
frame at the frequency of the baud rate.
DATA FRAME The data frame contains the actual data being transferred. It can be
5 bits up to 8 bits long if a parity bit is used. If no parity bit is used, the data frame can
be 9 bits long. In most cases, the data is sent with the least significant bit first.
PARITY Parity describes the evenness or oddness of a number. The parity bit is a way
for the receiving UART to tell if any data has changed during transmission. Bits can
2. The transmitting UART adds the start bit, parity bit, and the stop bit(s) to the
data frame
3. The entire packet is sent serially from the transmitting UART to the receiving
UART. The receiving UART samples the data line at the pre-configured baud rate
4. The receiving UART discards the start bit, parity bit, and stop bit from the data
frame
5. The receiving UART converts the serial data back into parallel and transfers it to
the data bus on the receiving end
The block diagram 3.18which is observed through vivado after writing verilog code.
Using Vivado, the UART transfer protocol’s outcomes were confirmed, and optimised
code was created for it. It has been noted that SPI transfer is faster than UART trans-
mission. Due to the asynchronous nature of the communication, the data rate of the
UART devices interacting with one another must be identical and Above figure 3.19
shows UART transmission between transmitter and receiver, which is observed through
vivado using verilog code.
Chapter 4
Reflections
CHAPTER 4
REFLECTIONS
This chapter talks about the reflections from the internship work undertaken. The
tasks completed reflects on the understanding and working of Verilog Hardware Descrip-
tion Language
[3] G. H. Mealy, “A method for synthesizing sequential circuits,” The Bell System
Technical Journal, vol. 34, no. 5, pp. 1045–1079, 1955.
[4] V. A. Pedroni, Digital electronics and design with VHDL. Morgan Kaufmann, 2008.
[5] B. BM, S. Dattawadkar, and D Ajaykumar, “Design of spi flash controller for spar-
tan6 fpga,”
[6] F. Leens, “An introduction to i 2 c and spi protocols,” IEEE Instrumentation &
Measurement Magazine, vol. 12, no. 1, pp. 8–13, 2009.
[8] T. Liu and Y. Wang, “Ip design of universal multiple devices spi interface,” in 2011
IEEE International Conference on Anti-Counterfeiting, Security and Identification,
IEEE, 2011, pp. 169–172.
[9] C. Spear, SystemVerilog for verification: a guide to learning the testbench language
features. Springer Science & Business Media, 2008.
[10] S Choudhury, G. Singh, and R. Mehra, “Design and verification serial peripheral
interface (spi) protocol for low power applications,” International Journal of Inno-
vative Research in Science, Engineering and Tecgnology, pp. 16 750–16 758, 2014.
[14] S. Sjoholm and L. Lindh, VHDL for Designers. Prentice Hall Englewood Cliffs,
1997, vol. 59.
33
RV College of Engineering® , Bengaluru - 560059
[16] W. A. Triebel and A. Singh, The 8088 and 8086 microprocessors: programming,
interfacing, software, hardware, and applications. Prentice-Hall, Inc., 1991.