Vlsi Report
Vlsi Report
Internship Report
Submitted by
Bachelor of Technology
in
Electronics and Communication Engineering
November, 2024
Department of Electronics and Communications Engineering
Velagapudi Ramakrishna Siddhartha Engineering College
Kanuru, Vijayawada - 520007
CERTIFICATE
SUBBAIAH) DATE:
DATE:
ii
Department of Electronics and Communications Engineering
Velagapudi Ramakrishna Siddhartha Engineering College
Kanuru, Vijayawada - 520007
DECLARATION
Place:
Date: D.ANUSREE
(218W1A04E6)
iii
Table of Contents
Certificate ii
Declaration iii
Table of Contents iv
List of Figures vi
Abstract vii
1 Introduction 1
1.1 Background ..................................................................................................... 1
1.2 Overview of the I2C Protocol ......................................................................... 1
1.2.1 Protocol Basics ................................................................................... 1
1.2.2 Master-Slave Architecture .................................................................. 2
2 Proposed Approach 4
2.1 Introduction ..................................................................................................... 4
2.2 Methodology ................................................................................................... 4
2.2.1 State Machine Design......................................................................... 4
2.2.2 Clock Synchronization ....................................................................... 5
2.2.3 Data Transfer Management ................................................................ 6
2.2.4 Bidirectional SDA Management ........................................................ 7
2.2.5 Error Handling and Debugging .......................................................... 7
2.2.6 Simulation and Testing....................................................................... 7
iv
3.2 Evaluation and Discussion .............................................................................. 8
4 Conclusion 10
v
List of Figures
vi
Abstract
This project explores the design and implementation of an I2C master controller using
Verilog, a Hardware Description Language (HDL) ideal for synthesizing communication
protocols at the hardware level. The I2C protocol is widely used in embedded systems
for its simplicity and efficiency, allowing multiple slave devices to communicate with
a master over just two lines (SDA and SCL). This project focuses on creating a robust,
state-machine-driven Verilog design that manages the full I2C transaction cycle, includ-
ing start and stop conditions, slave addressing, data transfer, clock synchronization, and
acknowledgment signaling. Simulation results validate the I2C master’s effectiveness
in handling both read and write operations with accurate timing, and bidirectional data
control. The outcomes highlight Verilog’s strength in realizing complex protocol behav-
iors on hardware, making this design suitable for various embedded applications, such
as microcontrollers and SoC designs, where efficient and reliable serial communication
is essential.
vii
About The Company
viii
Chapter 1
Introduction
1.1 Background
The I2C protocol, developed by Philips, is widely used in embedded systems to enable
communication between various integrated circuits, such as microcontrollers, sensors,
and memory devices, using only two bidirectional lines—SDA (data line) and SCL
(clock line). Due to its simplicity, it has become essential for applications requiring
low-speed, short-distance communication. However, implementing the I2C protocol re-
quires precise timing control, acknowledgment handling, and reliable state transitions
to maintain data integrity and synchronization.
1
Chapter 1 – Introduction
in wiring reduces the overall cost and complexity, making it ideal for applications where
multiple devices need to communicate efficiently over a shared bus.
• SDA (Serial Data Line): This line carries the actual data being transmitted be-
tween devices. It is bidirectional, meaning it can switch between reading and
writing as necessary to enable data flow in both directions.
• SCL (Serial Clock Line): The clock line is generated by the master device to
synchronize the data transfer. Since the communication is synchronous, each data
bit is transmitted with a corresponding clock pulse, ensuring timing consistency
across the network.
The combination of these two lines allows I2C to operate efficiently in multi-device
configurations. To prevent conflicts on the shared bus, both lines are typically connected
to a pull-up resistor, setting the lines to a high state when idle. When devices transmit
data, they actively pull the line low, creating a sequence of high and low voltages that
represent binary data.
• Master Device: The master is responsible for initiating and controlling data trans-
fer. It generates the clock signals on the SCL line, defines the direction of data
flow (read or write), and initiates communication with slaves by issuing a start
condition. The master also terminates communication with a stop condition, sig-
naling the end of a transaction.
2
Chapter 1 – Introduction
• Slave Devices: Each slave device has a unique 7-bit address, which allows it to
respond only to communications that match its address. Once addressed by the
master, a slave will either transmit data back to the master (in read operations) or
receive data from the master (in write operations). The slave follows the master’s
timing signals, ensuring synchronous communication on the bus.
This master-slave arrangement supports up to 128 unique addresses (with 7-bit address-
ing), enabling multiple devices to coexist on the same I2C bus. In cases where additional
devices are needed, I2C supports 10-bit addressing, extending the address range for more
complex systems.
3
Chapter 2
Proposed Approach
2.1 Introduction
The proposed architecture for the I2C protocol implementation using Verilog consists of
several key components that work together to facilitate communication between a master
device and multiple slave devices. The architecture is designed to handle various states
of the I2C communication cycle, ensuring efficient data transfer and synchronization.
Below is a detailed overview of the proposed architecture.
2.2 Methodology
The I2C master module is implemented using Verilog HDL to create a reliable commu-
nication interface for controlling and exchanging data with multiple slave devices. This
design allows the master device to initiate and manage data transactions over the I2C
bus by implementing the start, stop, address, acknowledgment, and data phases of the
protocol. Each of these phases is controlled by a state machine that synchronizes with
the clock to ensure correct timing and orderly data transfer.
• IDLE: The module starts in the IDLE state, where it waits for the start signal. In
4
Chapter 2 – Proposed Approach
this state, SDA and SCL lines are both high, indicating that the bus is idle and
ready for communication.
• START: When the start signal is asserted, the FSM transitions to the START state,
pulling the SDA line low while keeping the SCL line high to signify the start of a
data transfer.
• ADDRESS: In this state, the master sends a 7-bit address of the target slave device
along with a read/write (R/W) bit. Each bit is clocked out on the rising edge of
SCL. The state machine monitors a counter that decrements for each transmitted
bit until all 8 bits are sent.
• ACK: After sending the address, the master releases SDA to allow the slave to
respond. If the slave pulls SDA low, it signals acknowledgment (ACK), indicating
it is ready to communicate. The master checks SDA on the SCL clock edge to
determine if the acknowledgment is received.
• STOP: The STOP state concludes the communication sequence. Here, the SDA
line is pulled high while SCL is high, signaling the end of data transfer. After this,
the state machine returns to IDLE.
• Clock Divider: An internal scl_counter divides the main system clock down to
match the desired I2C bus speed.
5
Chapter 2 – Proposed Approach
• Address and R/W Transmission: The 7-bit slave address is combined with the
R/W bit into an 8-bit register (addr_rw). This register shifts out one bit per SCL
clock pulse during the ADDRESS state.
• Write Operation: When the R/W bit is 0, indicating a write operation, data from
data_in is shifted out bit by bit on SDA. The FSM controls data-count to track the
number of bits transmitted.
• Read Operation: When the R/W bit is 1, the master receives data on SDA. The
received data bits are sequentially stored in the read-data register, accumulating
to form the complete 8-bit byte.
6
Chapter 2 – Proposed Approach
• SDA as Output: During the ADDRESS, DATA (write), and STOP states, the
module actively drives SDA, setting it high or low based on the data being sent.
• SDA as Input: During the ACK and DATA (read) states, the master releases
SDA, allowing the slave to control it. This is achieved by enabling or disabling
SDA_OUT, effectively switching SDA between input and output modes.
The Verilog code implements this functionality through a conditional assignment, where
SDA is high-impedance (1’bz) when not being driven, allowing other devices to control
it when necessary.
• Basic Read/Write Transactions: The module’s ability to perform simple read and
write operations was tested by simulating the response of a slave device.
• Address Acknowledgment: The module was tested with various slave addresses
to confirm that it correctly waits for and responds to acknowledgments.
• Error Handling: Scenarios where the slave fails to acknowledge or does not re-
spond within expected clock cycles were simulated to test error-handling behavior.
7
Chapter 3
3.1 Introduction
The simulation waveform demonstrates the I2C master module’s performance across
key phases of the I2C protocol, including start, address transmission, acknowledgment,
data transfer, and stop conditions. By examining signals such as ‘SCL‘ (clock), ‘SDA‘
(data line), ‘data_in‘, ‘address‘, and control flags like ‘done‘ and ‘rst‘, we validate the
module’s correct operation. The transitions observed in the waveform confirm that the
module effectively manages communication initiation, slave acknowledgment, and data
synchronization with the clock. This analysis supports that the I2C master module suc-
cessfully adheres to protocol specifications, ensuring reliable communication with slave
devices on the I2C bus.
8
Chapter 3 – Results and Discussion
it low, which it does successfully to acknowledge the address. This response validates
proper slave communication.
In the data transfer phase, the module shifts out data from ‘data_in‘ in synchronization
with ‘SCL‘, confirming correct transmission. The stop condition, shown as a transition
of ‘SDA‘ from low to high while ‘SCL‘ is high, marks the end of the communication
cycle, releasing the bus. The ‘done‘ signal indicates successful completion of the oper-
ation, ensuring reliable I2C communication.
This evaluation confirms that the module functions as expected, handling each protocol
phase accurately and supporting stable data exchanges with I2C-compatible devices.
9
Chapter 4
Conclusion
10