Mohini Akhare Thesis 2019
Mohini Akhare Thesis 2019
Testbench Approach
Dissertation submitted to
Shri Ramdeobaba College of Engineering and Management, Nagpur
in partial fulfillment of requirement for the award of
degree of
Master of Technology
In
VLSI Design
By
Mohini Akhare
(17ENV1006)
Guide
(An Autonomous Institute affiliated to Rashtrasant Tukadoji Maharaj Nagpur University, Nagpur)
Date:
Place: Nagpur
ii
DECLARATION
I, hereby declare that the thesis titled “Design and Verification of FIFO
work is original and has not been submitted earlier as a whole or part for
University.
Date:
Place: Nagpur
Mohini Akhare
17ENV1006
iii
Approval Sheet
Date:
Place: Nagpur
iv
ACKNOWLEDGEMENT
First and foremost I wish to thank God almighty for showering his blessings
upon me and granting me his divine wisdom and knowledge to complete the research
project.
I would like to express my sincere and heartfelt thanks to my guide, Dr. Nitin
Narkhede, for providing excellent guidance, encouragement, and inspiration
throughout the project work.
I have great pleasure to express my gratitude to Dr. R. S. Pande, Principal,
RCOEM, Nagpur for his constant encouragement and motivation.
I express my deep sense of gratitude to to Mr. Ankit Somani, MGR I ASIC
Digital Design, Synopsys India Pvt. Ltd. Pune for his guidance and technical
support for completing the said research work.
I would also like to give thanks and want to express my gratitude to Prof.
Pravin Dwaramwar and Prof. V. E. Khetade for their valuable advice and suggestions
throughout the project duration.
I also express my thankfulness to Dr. (Mrs.) A. A. Khurshid, Head of the
Department, Electronics Engineering, and Dr. N. P. Narkhede, M.Tech Coordinator
for their support and help which encouraged me a lot in completing this project.
I also thank Ms. Sumedha Game for all the help, guidance and suggestions and
all my colleagues for their help throughout this project.
I want to record my deep feelings of love, affection, and gratitude to my family
for their encouragement, love and constant moral support in achieving the present
work.
Mohini Akhare
v
ABSTRACT
A hardware design mostly consists of several Verilog (.v) files with one top
module, in which all other sub-modules are instantiated to achieve the desired behavior
and functionality. An environment called testbench is required for the verification of a
given verilog design and is usually written in SystemVerilog. The idea is to drive the
design with different stimuli to observe its outputs and compare it with expected values
to see if the design is behaving the way it should.
vi
TABLE OF CONTENTS
CERTIFICATE...............................................................................................................ii
DECLARATION............................................................................................................iii
ACKNOWLEDGEMENT..............................................................................................v
ABSTRACT....................................................................................................................vi
LIST OF TABLES........................................................................................................xii
1. INTRODUCTION.......................................................................................................2
1.2 VERIFICATION.....................................................................................................2
2. LITERATURE SURVEY.........................................................................................11
vii
3.3 WRITE AND READ LOGIC BLOCK.................................................................18
4.1.1 TRANSACTOR.............................................................................................20
4.1.2 GENERATOR................................................................................................21
4.1.3 DRIVER........................................................................................................22
4.1.4 MONITOR.....................................................................................................24
4.1.5 SCOREBOARD.............................................................................................25
4.1.6 ENVIRONMENT...........................................................................................26
4.2 RANDOMIZATION...........................................................................................28
5.1 COVERAGE.........................................................................................................31
viii
6.3 SIMULATION WAVEFORM OF CONTROL UNIT.....................................41
7.2.1 ASSERTIONS..............................................................................................51
8.1 CONCLUSION.....................................................................................................57
LIST OF PUBLICATIONS..........................................................................................60
ix
LIST OF FIGURES
1.1 Functional Diagram of 6
FIFO…………………………………………………….
1.2 FIFO evolution using memory example……………………………. 7
…………
3.1 Block Diagram of Synchronous FIFO …………….. 16
………………………….
3.2 Functional Diagram of Dual Port 17
RAM………………………………………..
4.1 Verification 20
Plan……………………………………………………………………
4.2 Code for 21
Transaction……………………………………………………………….
4.3 Code for 22
Generator…………………………………………………………………
4.4 Functional block of 23
Driver…………………………………………………………
4.5 Code for 24
Driver…………………………………………………………………….
4.6 Code for 25
Monitor…………………………………………………………………...
4.7 Functional block of 26
Driver…………………………………………………………
4.8 Code for 26
Scoreboard……………………………………………………………….
4.9 Code for 28
Environment…………………………………………………………….
5.1 Functional Coverage Model Development Flow 34
……………………………..
6.1 Write operation of Dual port RAM ……. 39
………………………………………
6.2 Read operation of Dual port RAM 39
……………………………………………..
6.3 Reset condition for read_write_block 40
………………………………………….
6.4 Write condition for read_write_block 40
…………………………………………
6.5 Read condition for read_write_block... 41
…………………………………............
6.6 Write conditions operated by control unit 41
…………………………………….
6.7 Write and Read conditions operated by control 42
unit………………………….
6.8 Reset condition waveform of synchronous 42
FIFO……………………………..
6.9 Read and write condition waveform of synchronous 43
FIFO………………….
x
7.1 Code Coverage 45
Report…………………………………………………………...
7.2 Hit Statements in 45
Testbench……………………………………………………..
7.3 Coverage Report of 47
Covergroup………………………………………………..
7.4 Bins Generation of 49
Covergroup…………………………………………………
7.5 Functional Coverage 49
Report…………………………………………………….
7.6 Coverage Report Summary data by 50
file………………………………………..
7.7 Code for condition “check_reset_empty” 51
……………………………………..
7.8 Code for condition “check_reset_notfull” 52
…………………………………….
7.9 Code for condition “Fifo_Full_WPTR_stable” 52
………………………………
7.1 Code for condition “Fifo_Empty_RPTR_stable” 52
0 …………………………….
7.1 Code for condition “Full_NOT_Empty” 53
1 ………………………………………
7.1 Code for condition “Empty_NOT_Full” 53
2 ………………………………………
7.1 “Empty_NOT_Full” 54
3 Condition………………………………………………….
7.1 “Check_reset_empty”, “Check_reset_notfull” and 54
4 “Fifo_Empty_RPTR_stable”
Condition………………………………………..
7.1 “Fifo_Full_WPTR_stable” and “Full_NOT_Empty” 55
5 Condition……………
7.1 Cover Directives 55
6 Window……………………………………………………….
xi
LIST OF TABLES
xii
LIST OF ACRONYM
xiii
1
INTRODUCTION
1
CHAPTER 1
INTRODUCTION
1.2 VERIFICATION
2
existence [3]. “Methodology” lays a foundation for a robust verification environment
which is capable of handling complex verification needs and speed up the verification
process [3].
When a verification environment is needed for a new design, or for a design
revision with significant changes, it is important to objectively look at the shortcomings
of the existing verification environment and expected productivity gain with the new
methodology and determine the best solution [3].
The Verification Plan is the focus for precisely identifying what requires to be
checked and drives the requirements for Coverage. A validation project's success
depends strongly on the completeness and accuracy of a verification plan being
implemented. The excellent strategy includes comprehensive objectives using
measurable metrics, as well as optimum use of resources and accurate measurements of
schedule. Verification strategy provides a chance to display and evaluate the functional
verification checking approach before the evaluation engineer goes into depth to
execute it. It also sets up adequate interaction. It also provides an understanding of the
fields that will be hard to verify if needed measures are to be taken. It is used to
determine the verification phase's advancement and closure. Verification planning
should begin soon with the evaluation stage of the system / architecture. Once the
verification group has the functional spec, they will begin their growth [4].
A verification plan, like a spreadsheet, a document or a simple text file, could
come in many forms. Templates are useful if they are continuously used in your
business as they create a popular data environment, readers understand where to search
for certain data even in a enormous paper they want to understand at the time, because
distinct readers want distinct data at distinct times [4].
4
speeds because free running devices can be used to operate them. Asynchronous FIFOs
needed to generate read and write pulses as information is transferred through the part,
and it is hard to generate these pulses at high speed. Synchronous FIFOs can be used
just as their asynchronous counterparts by tying the read and write strobes to the RCLK
and WCLK lines respectively. This makes migration to synchronous FIFOs very easy,
even for designers who are mostly familiar with asynchronous FIFOs [6].
The FIFO element will represent a layout written in System Verilog with System
Verilog assertions. The FIFO usually interfaces to a control unit for the synchronous
pushing and popping of facts. This plan consists of characteristic extraction and test
approach, check verification method [7]. Testing as a word has now been replaced by
checking. Confirmation specialists must ensure that what goes to the assembly plant is
an accurate representation of the configuration specification [8]. The modem,
systematic and automated approaches has been required because of the continuous
growth and complexity for creating test benches [9], given that up to 70% of the
design period is spent in the authentication process [10].
The FIFO (First in First Out) is a genus of memory that is ordinarily used to
holds the information, has to utilize consistently between various systems at distinct
deferrals. The FIFO model permits the transmitter to send information and its
collector is used to take out data. The data or information is filled the FIFO memory
until the recipient starts emptying it. An overflow occurs as soon as the transmitter
fills up the FIFO model and attempts to store more data before the receiver has read
the data out. An underflow occurs when the receiver attempts to read data from the
FIFO structure, but the transmitter did not fed any data into it. The Full and empty
signals are used by the logic to strangle the transmitter and receiver respectively, in
order to avoid these critical conditions. The Figure 1.1 shows the functionality of
the FIFO. We can depict the FIFO as a pipe which implies that we can think a FIFO as
a pipe where the first component that enters the pipe is the first component that exits the
pipe. [11].
5
Figure 1.1 Functional Diagram of FIFO [13]
6
Figure 1.2 FIFO evolution using memory example [13]
Now let the FIFO record three components as shown in Figure 1.2(b). Wr ptr =
3, point to the next rd prt = 0, wr ptr = 3-0 = 3. If we read an element from the FIFO
zero memory address shown in Figure 1.2(c), Elem1 is read from FIFO and rd prt = 1 ;
in this case, the number of elements in FIFO is 3-1 = 2.
Now fill in the FIFO with up to 6 elements as shown in Figure 1.2(d) wr ptr=7
and rd ptr=1 and wr ptr ptr = 7-1 = 6. Then we need to write 2 additional components
(Figure 1.2(e)) wr ptr-rd ptr = 7-3 = 4. If we write another 2 components, then wr ptr =
7adding 2 components will be 7 + 2=9 higher than the depth of FIFO! We must handle
the storage as a circular buffer, of necessity, so the read pointer is shown in Figure
1.2(f), (7 + 2) section 8 = 1[13 ].
For wr ptr-rd ptr = 1-3 = -2 data accessible in the FIFO. So what if we have got
-2 data? As we stated the memory is circular buffer so the correct expression is:
(wr_ptr - rd_ptr + FIFO_DEPTH) % FIFO_DEPTH = (1-3+8)%8 = (6) % 8 = 6 If we
count inside the FIFO the number of elements is 6. The number of data into a FIFO of
depth FIFO_DEPTH is N = (wr_ptr - rd_ptr + FIFO_DEPTH) % FIFO_DEPTH When
N<FIFO_DEPTH and N>0 FIFO contains data, N in the equation above is 0 (zero)
both when FIFO is empty and when FIFO is full. We have to check if write pointer is
going to the read pointer or vice versa:
If write pointer implies FIFO FULL to the read pointer = > N=0
7
If the read pointer is requested = > N=0 implies FIFO EMPTY
In order to comprehend how FIFO operates, this is the fundamental architecture you
need to know. The FIFO can be applied with customized precision in the application
application without any specific restriction. [13].
In case of condition :
(1-3+8) % 8 = (6) % 8 = 6
wr_ptr - rd_ptr =
"001" (+1d) +
"101" (-3d) =
-----------------
"110" = 6
8
1.4 ORGANIZATION OF THE THESIS
The first chapter is the introduction and it covers the fundamentals. It highlights
the history of System Verilog language. It includes the information about Verification,
Verification plan, Verification Testbench components and Synchronous FIFO. It also
includes project objective and the basic architecture of Synchronous FIFO and itds
memory.
Chapter 3 describes the design and working of synchronous FIFO and its various
blocks using Verilog.
Finally the thesis is concluded in the last chapter which gives a brief report
about the work done along with the future scope for the project work. References are
included in the end.
9
2
Literature Survey
10
CHAPTER 2
LITERATURE SURVEY
Initial objective of this paper was to design and implement a FIFO module. This
task is successfully completed as the FIFO module is designed and implemented using
the Verilog language. This FIFO module has been used for building the verification
environment. The last and most crucial target of this work was to implement the
verification plan of realized FIFO Design using System Verilog Framework. The test
cases which are the input data that need to be given have been randomized and
11
automated using the implemented verification model. The system Verilog functional
coverage methodology is adopted that verifies the functionality of the design in most
effective way. All the blocks of the verification plan are implemented using system
Verilog language. The outcomes were obtained as functional Coverage and the
scoreboard reports using verification methodology. 100 % coverage has been achieved
for the constraints that were applied to the design. Also the scoreboard report is
generated using the scoreboard block of the verification plan [8].
The Synchronous & Asynchronous FIFO is run at 500MHZ range, which is its
2ns clock period of time. The design is safe of infringement of LVS & DRC. But the
Asynchronous FIFO needs more area & power, as it needs two clocks. Using Synopsys
instruments, the full ASIC flow is worked out. A FIFO is used as a memory buffer
"First In First Out" between two asynchronous systems with simultaneous write and
read access from and to the FIFO, these accesses being independent of each other. FIFO
has a port for entry (write) and a port for display (read). Each port has its own related
pointers pointing to a place in the memory, the write and read pointers will be at the
first memory location inside the FIFO after a FIFO restart. Each write operation causes
the write pointer to increase to the next memory location ; likewise each read operation
causes the print pointer to increase to the next location. Either FIFO can be synchronous
or asynchronous. The fundamental distinction between them is that the full operation of
synchronous FIFO depends completely on the clock where asynchronous FIFO writing
and reading operation are asynchronous to one another. The complete ASIC
(Application Specific Integrated Circuit) flow is performed using Synopsys tools [12].
12
International Journal of Engineering Research and Development, Volume 13, Issue 7,
July 2017, PP.06-12.
13
operations occur simultaneously. Using the Universal Verification Methodology
(UVM), its verification is performed after designing the Synchronous FIFO. A thorough
discussion of the verification plan and test results is included. [18].
14
3
15
CHAPTER 3
DESIGN AND WORKING OF SYNCHRONOUS FIFO
The dual port RAM which is examined in this work is synchronous and has a
single clock for both ports, as depicted in Figure 3.2. At the rising or positive
edge of clock both the reading and writing of data has been occurred. The
synchronous FIFO has an exclusive clock port for both the Read and Write
operations. The data which is given on the data input port is written on the next
empty location. This happens only on the positive edge of the clock, when “write”
signal of the write control logic block is high.
The functionality of the dual port RAM can be articulated with three conditions,
the first condition transpire when the reset signal is high and all the output signals i.e.
output data (dataout), write address (wr_addr) and read address (rd_addr) reset to zero
value. The next condition occur when write enable (write) signal is high and the
incoming input data (datain) is written in the memory block generated by the write
address. But this will take place only on the next rising edge of the clock. The write
17
enable signal is only generated when the FIFO is not full so as to avoid corruption of
data. The third stage show up when read enable (read) signal is high, then the data that
is written in the memory is read out form the memory. The signal “rd_addr” will
generate the read address through which the data can be read, this stage can only
exists at the next rising edge of the clock. The Read enable signal is only generated
when the FIFO is not empty so that any corrupted data could not be read out from
the memory [16, 17, 18].
The written memory data is read out from the Read control logic. This
program steps forward when the “read” signal of the block is high. Whenever there
is unavailability for writing data in the FIFO, Full signal goes high and indicates
that the memory is full and there is no space for writing further data. The Empty
signal indicates that there is no single data filled in the memory and vacant
locations are available in the memory. Whenever any single data will get into the
memory, Empty signal goes low. These flags are controlled by Write and Read
block.
18
write_control_en and read_control_en are connected to the inputs of Read and Write
logic block.
19
4
20
CHAPTER 4
VERIFICATION PROCESS USING SYSTEM VERILOG
4.1.1 TRANSACTOR
The very first component comes under verification environment is Transactor.
Transaction class is used to declare fields required generating the stimulus, so first step
is to declare the 'Fields' in the transaction class. Different transactions depending on the
test case configurations field selection has been generated in the transaction class. For
21
the FIFO design which has to be implemented, the transactions are RESET, WRITE and
READ operations and the fields which has been declared here are D_in, Write, Read,
Full, Empty, D_out. Also the input signal (D_in) is randomized so that to drive
Random stimulus to DUT by changing the characteristics of data. The code for
transaction written in the layered testbench is Figure 4.2.
4.1.2 GENERATOR
The components of generator produces stimulus that driver sends to DUT.
Stimulus generation is patterned on the requirement to produce the stimulusFor the easy
generator of storage stimulus, read, write operations, information and data are generated
to be placed in the address when writing. In case generator, scenarios such as generating
additional read / write activities are indicated. SystemVerilog given the design to
regulate the flow and random generation distribution and transmission. Stimulus-
defined constraints are combinatioural in design where as on other hand constraints
defined in stimulus generators are sequential in nature. Stimulus generation can be
directed or directed random or automatic and user should have proper controllability
from test case. It should also regard stimulus generation that relies, for instance, on the
state of the DUT, generating read cycle as quickly as interrupt is seen. Error injection is
a process for verifying the DUT by returning entry stimulus for mistake. In this module,
it is also usually made advantage of. Overall, generator should be prepared to produce
22
every feasible situation and the user should be allowed to handle the generation from
directed and directed random testcases [23].
4.1.3 DRIVER
The driver is the block that deciphers the transactions in to random inputs
i.e. test cases. These are given to the DUT and the DUT performs specific operation
depending upon the input given. The transaction generator generates a high level
transaction like read, write or reset. The driver basically converts these transactions
23
into actual inputs. A driver gets the information from the generator and drives it to
the DUT by inspecting and driving the DUT signals [24]. It contains the hidden
validation to drive the pins of the DUT as indicated by situation gave to it from the
sequencer. The function of driver is shown in Figure 4.4 and the code written for
driver is shown below it in Figure 4.5.
24
Figure 4.5 Code for Driver
4.1.4 MONITOR
Monitor records the breach of the protocol and all operations or transactions are
identified. Two kinds of monitors are passive and active. No signals are driven by
passive sensors. The DUT parameters may be driven by active monitors. This is also
related to as a receiver sometimes. Monitor transforms the design state and its inputs to
an abstraction level of the product so that it can be placed in a database of ' scoreboards '
to be verified subsequently. Monitor converts the operations at the pin level to the high
level [23]. So this block monitors the design input-output ports to capture design
activity. The code written for monitor is shown below in Figure 4.6.
25
Figure 4.6 Code for Monitor
4.1.5 SCOREBOARD
The scoreboard is used to record the operations of the driver and then
displays these operations systematically. A screen, a distant commodity, is just to
monitor the examples of the DUT signals [25] but cannot be used to drive them. A
monitor collects information, extracts occasions, performs checking, scope and
optionally prints follow data. It utilized the screen to sign sent to the pins of the
DUT from the driver. As the name suggests, it basically monitors the operations
performed by the driver and then it passes its data to the scoreboard to display the
information.
Figure 4.7 depicts the Functional bock of scoreboard. The scoreboard can
also be named as tracker as it tracks all the operations. The dynamic data types and
dynamic memory allocation makes the task much easier to implement scoreboard in
the system Verilog. Normally, a scoreboard confirms whether there has been fitting
26
operation of the configuration at a practical level. The scoreboard basically stores
the data and address when the write operation is done and displays the results.
Furthermore, it also records the data and addresses that had been previously read. It
matches the similarity of the data and display the outcome [8]. The code for
scoreboard for the layered testbench is given below in Figure 7.8.
4.1.6 ENVIRONMENT
Further the Environment class comes which is a container class contains
Mailbox, Generator and Driver. It creates the mailbox, generator and driver, shares
the mailbox handle across the Generator and Driver. Then Test class is present
27
which is responsible for creating the environment. Also it configures the testbench
i.e. setting the type and number of transactions to be generated as well as initiate
the stimulus driving. The Interface block is one of the essential modules throughout
the verification plan. In this particular block all the commonly used signals in both
the design and the verification environment. The interconnect block bridge as an
interfaced to the design under-test and the check environment. The interface
assimilates all the pin-level associations that are made to the DUT [26]. Basically
an interface is a bundle of nets or variables. The coverage collector mainly covers
the coverage related issues of the block. This block has covers the groups and cover
points that are used to estimate the functional coverage of the design. Figure 7.9
depict the code for environment block.
28
Figure 4.9 Code for Environment
4.2 RANDOMIZATION
Randomization is the process of making something random; SystemVerilog
randomization is the process of generating random values to a variable. Verilog has a
$random method for generating the random integer values. This is good for
randomizing the variables alone, but it is hard to use in case of class object
randomization. For easy randomization of class properties, SystemVerilog provides
rand keyword and randomize() method [27].
29
compact, declarative way. The constraints are then processed by a solver that generates
random values that meet the constraints [29].
30
5
31
CHAPTER 5
5.1 COVERAGE
Coverage is a generic term for measuring progress to complete design
verification. The coverage tools gather information during a simulation and then post-
process it to produce a coverage report. You can use this report to look for coverage
holes and then modify existing tests or create new ones to fill the holes. This iterative
process continues until you are satisfied with the coverage level [30]. Coverage is used
to evaluate parts of the structure that are tried and untested. Coverage is defined as the
percentage of verification goals achieved [31].There are two kind of coverage metrics:
Code coverage and Functional Coverage.
The easiest way to measure verification progress is with code coverage. Here
you are measuring how many lines of code have been executed (line coverage), which
paths through the code and expressions have been executed (path coverage), which
single-bit variables have had the values 0 or 1 (toggle coverage), and which states and
transitions in a state machine have been visited (FSM coverage). You don’t have to
write any extra HDL code. The tool instruments your design automatically by analyzing
the source code and adding hidden code to gather statistics. You then run all your tests,
and the code coverage tool creates a database [32].
32
Coverage is a measure for evaluating the advancement of functional verification
activities. This performs an important part in obtaining a transparent picture of how well
the design was checked and in identifying the regions uncovered in the review [33].
There are different categories of code coverage.
Statement coverage
Block coverage
Conditional/Expression coverage
Branch/Decision coverage
Toggle coverage
FSM coverage
This indicates how many statements (lines) are covered in the model by
excluding lines such as module, endmodule, comments, time scale, etc. This is essential
in all types of design and for test completion it must be 100 percent. Statement coverage
includes procedural statements, continuous assignment statements, conditional
statement and Branches for conditional statements etc [33].
This gives an indication how well variables and expressions (with logical
operators) in conditional statements are evaluated. Conditional coverage is the ratio of
number of cases evaluated to the total number of cases present. If an expression has
Boolean operations like XOR, AND, OR, the entries which is given to that expression
to the total possibilities are indicated by expression coverage [33].
33
5.2.4 BRANCH COVERAGE
Toggle coverage gives a report that how many times signals and ports are
toggled during a simulation run. It also analyses design exercise such as inactive inputs
or signals that stay constant or less change in significance [33].
FSM coverage reports, whether the simulation run could reach all of the states
and cover all possible transitions or arcs in a given state machine. This is a complex
coverage type as it works on behavior of the design that means it interprets the synthesis
semantics of the HDL design and monitors the coverage of the FSM representation of
control logic blocks [33].
34
The automatic generation of each stage in the test plan is performed in CRV
(Constrained Random VerificationSince there are points generated automatically, we
need a mechanism that tells us not to exercise all the points in the test plan. If all the
points in the test plans are verified and the code coverage is 100 percent, we can stop
verification. There will be a separate testcase file for each feature to be verified in
Directed Verification. So count the test cases to know how many features are verified.
Verification is done when all tests are coded and passed with 100 percent code coverage
alone. SystemVerilog provides a mechanism to use functional coverage to know the
untested feature. Functional coverage is an "instrumentation" that is added manually to
the TestBench. This strategy is easier than checking test cases. Functional coverage is
more significant than code coverage where the code coverage records what has been
performed instead of what has been tried [36].
Functional Coverage is the metric of how much design functionality has been
covered by the testbench or verification environment which is explicitly defined by the
verification engineer in the form of a functional coverage model. In its simplistic form,
it is user defined mapping of each functional feature to be tested to a so called ‘cover
point’ & these coverage point used to have certain conditions (ranges, defined
transitions or cross etc.) to fulfill before its announced 100% covered during simulation.
All these conditions for a cover point are defined in form of ‘bins’.
Those bins (conditions) are discussed during simulation, as & when certain
circumstances of a coverpoint hit, and it provides us the assessment of verification
35
advancement. A graphical report can be generated after executing a number of test cases
to analyze the functional coverage report and a plan can be made to cover up the holes.
Number of cover items can be caught under one ' covergroup ' and the range of cover
groups set is generally called a ' functional coverage model ' [37].
A bin coverage point associates a name and count with a value set or a value
transition sequence. If the bin specifies a set of values, each time the coverage point
matches one of the values in the set, the count is increased. If the bin designates a value
transition sequence, the count increases each time the coverage point matches the entire
value transition sequence. The bins for a coverage point can be automatically created by
SystemVerilog or explicitly defined using the bins construct to name each bin. If the
bins are not explicitly defined, they are automatically created by SystemVerilog. The
number of automatically created bins can be controlled using the auto_bin_max
coverage option [38]. Hence bins can be created implicitly or explicitly.
36
can be controlled by auto_bin_max parameter [40]. A 2^n number of instant bins will
be developed for an essential coverpoint varying "n" bit [34].
Explicit bin creation is recommended method. Not all values are interesting or
relevant in a cover point, so when the user knows the exact values he is going to cover,
he can use explicit bins [41]. For each value in the given variable range, a separate bin
is created, or a single / multiple bins for the value rage. “bins” keyword is used to
declare the bins explicitly to a variable. Within curly braces { }, bins are explicitly
defined along with the bins keyword followed by bin name and varying value / range
instantly after the coverpoint identifier [34].
37
are the most valuable and most widely used type of assertion. Concurrent assertions
activate properties (rules) that typically sample design signals or sequences of
design signals just before each new active clock edge to determine if the design is
behaving as it was claimed that it should behave. The most valuable assertion style
that can be used in design and verification environments is the concurrent assertion.
Concurrent assertions are little monitors that sit down inside of a block of code to
periodically sample and test signals and generate error messages if the assertion
ever fails. Concurrent assertions are typically sampled once per clock period at the
end of the clock cycle, just before the next active clock edge. Concurrent assertions
require the assertion of a property, where a property is basically a design rule that
should always be true [43].
38
6
39
CHAPTER 6
SIMULATION ANALYSIS OF MODULES AND DUT
40
6.2 SIMULATION WAVEFORM OF READ_WRITE_BLOCK
The purpose of the Read and Write logic block is to update the write counter,
write memory data (DPRAM) and read counter every time the data is read from the
RAM. Write counter has been used to address the write section of the memory
(DPRAM) and read counter to address the read section of the memory (DPRAM).
Initially at reset all the output signals set to zero as shown in Figure 6.3. Then at reset
low (reset = 0) and write_control is 1, The wr_ptr which is write pointer signal has
been binary coded, gets incremented as it goes on filling the memory locations. As
many times the rising edge of the clock is coming, the wr_wire gets incremented
and the incoming data gets written into the FIFO memory on that write pointer
location. Figure 6.5 represent the read condition waveform. In this case, now the
rd_ptr that is the read pointer signal gets incremented by 1 value. Now the read
pointer will traverse through all those locations on which the data was written by
the write pointer.
41
Figure 6.5 Read condition for read_write_block
42
Figure 6.7 Write and Read conditions operated by control unit
43
The Figure 6.9 shows the scenario in which all data is written in the FIFO the
incoming data is read out from the FIFO through waveform generated by the
QuestaSim tool. As exhibited in the figure the first signal is the clock signal that is a
free running signal. All other signals will change the values on the rising edge of
the clock. The reset signal in this case has forced to zero. The depth of the memory
is 8 i.e. up to eight locations FIFO can write the data in the memory. The 16 bit data
is given on the D_in signal. This data is the input data that is given in the FIFO
memory. For write operation the internal signals write and write_control are set to 1
to activate the write control logic of the design. This block is responsible for writing
the data in the memory. The FIFO full signal becomes 1 as the FIFO memory is
filled with all the locations of memory and no space has been available to write
more data.
As depicted through the waveform, the first signal is the clock signal as
convoluted in the write status explanation. The data that was written in the memory
with the help of D_in signal is now read out form the FIFO memory. For read
operation the internal signals read and read_control are set to 1 so to activate the
read control logic of the design. This block is fundamentally responsible for reading
data from the memory. The FIFO empty signal is 1 and FIFO full signal becomes 0
in this circumstances as the FIFO is not full in this scenario. When all the data
written would be read out then the FIFO will again be completely empty. The
written data is read out from the FIFO with the help of D_out signal.
44
7
CHAPTER 7
VERIFICATION RESULTS AND ANALYSIS
45
7.1 VERIFICATIONTHROUGH LAYERED TESTBENCH
Initially code coverage has been checked of testbench for analyzing the
missed branches, statements, blocks. Code Coverage of the testbench and design
before adding covergroup is shown in Figure 7.1 which demonstrates the code
coverage of top module i.e. testbench is 68.5% whereas the code coverage of DUT
is 93.1%. Here we have analyzed which Branches and Statements have been
covered in the design. Also the missed Statements and Conditions have been
detected.
cg cg_inst = new();
begin
47
end
The scoreboard report [46] is the next portion explained in this section. With
the help of Scoreboard block of the verification plan, the scoreboard report has been
generated. The scoreboard report generated in this case records the transactions that
are taking place in the verification environment. For the above design it records the
Reset, Write or Read scenario are being executed by the verification environment. It
records the random test case data that is generated by the Write control logic to be
written in the FIFO memory. It also records the test case data that is read out form
the memory with the help of Read Control Logic. In addition, it compares both the
data being written matches with the data read out. The Driver requests are given to
the scoreboard through the monitor block. The generated scoreboard report for the
design has been given as follows:
# -------------------------
48
# - [Scoreboard ]
# -------------------------
# - D_in = 1
# -------------------------
# -------------------------
# - [Scoreboard ]
# -------------------------
# - D_in = 1
# -------------------------
# - [Scoreboard ]
# -------------------------
# - D_in = 2
#-------------------------
49
Figure 7.4 Bins Generation of Covergroup
50
Figure 7.6 Coverage Report Summary data by file
51
7.2 VERIFICATION USING ASSERTIONS
7.2.1 ASSERTIONS
SystemVerilog Assertions (SVA) forms an important subset of SystemVerilog,
and as such may be introduced into existing Verilog and VHDL design flows.
Assertions are primarily used to validate the behavior of a design. They may also be
used to provide functional coverage information for a design. Assertions may also be
used as a formal specification language, making the requirements clear and
unambiguous, and making it possible to automate validation of the design against the
specification [47].
These are checks which are used to verify that your design meets the given
requirements. Assertions are primarily used to validate the behaviour of a design.
("Is it working correctly?") They may also be used to provide functional coverage
information for a design ("How good is the test?"). In SystemVerilog there are two
kinds of assertions: Immediate (assert) and Concurrent (assert property). In order to
monitor sequences and other behavioural aspects of a design for functional
coverage, cover property statements can be used [48].
52
#2 Check_reset_notfull : This property checks to see that the FIFO should not be
full when you reset the FIFO.
#6 Empty_NOT_Full : This property checks to see that if FIFO is empty (i.e. signal
Empty =1) at the same time signal “Full” should not be 1. This means that both full
and empty signal should not assert at the same time.
Firstly the sixth property “Empty_NOT_Full” have been activated (i.e. Pass)
is shown in Figure 7.12. As at the starting, FIFO is empty and hence “Full” cannot
be high at the same time. Then the first, second and fourth property
“Check_reset_empty”, “Check_reset_notfull” and “Fifo_Empty_RPTR_stable”
respectively got activated and pass as depicted in Figure 7.13. As the first two
properties are based on check on reset condition, when the reset is high Empty
should be high and FIFO is not full and hence these properties got activated. At the
same read pointer should be stable as FIFO is yet empty and it could not read any
data from it. Hence the forth property got activated or pass. Figure 7.14 shows the
54
third and fifth property i.e. “Fifo_Full_WPTR_stable” and “Full_NOT_Empty” got
activated or pass. Here when FIFO is full, write pointer should be stable and when
full is high, empty could not be high at the same time. Cover Directives Window is
shows in Figure 7.15 which depicted about whether the given scenario ever
happened in simulation or not.
55
Figure 7.15 “Fifo_Full_WPTR_stable” and “Full_NOT_Empty” Condition
56
8
57
CHAPTER 8
CONCLUSION AND FUTURE SCOPE
8.1 CONCLUSION
The initial objective was to design and implement the FIFO using Verilog language.
The said DUT was simulated and analyzed for various input conditions, read
and write logic and for its status flags like Full, Empty, Last, Second Last First.
Further, the next step was to verify the DUT i.e. the FIFO module has been verified
through layered testbench verification environment and using assertion techniques
using SystemVerilog language which was the last and most crucial target of this
work [49].
The layered testbench components were designed using system verilog Hardware
Verification Language (HVL). The DUT and layered testbench components were
connected together to develop verification environment. The test cases which are
the input data that need to be applied have been randomized and automated using
the implemented verification model so as to reach to each and every corner cases to
detect the bugs. The scoreboard report was analysed for various test cases against
the predicted outputs and it is found that for all the test cases the response of the
DUT was matching to the predicted results. The system verilog functional coverage
methodology verifies the functionality of the design in most effective way. 80%
code coverage has been achieved for the constraints that were applied to the design.
The applied random constrained inputs and the transactions that took place achieved
90% functional coverage for the DUT.
The functional coverage of the DUT has been substantially increased by adding
assertions in the design [7], [50]. By using assertions all the possible conditions of
FIFO have been checked which is required to check the functional behaviour of
design. The benefit of using assertions is it improved the observability of the design
and thereby reduced the overall debug effort. Also the system verilog coding
knowledge got enumerated through this research.
58
8.2 FUTURE SCOPE
The UVM is another form of functional verification that we can use for verifying
designs as it has reusable verification components and assembling powerful test
environment [51].
59
List of Publications
60
LIST OF PUBLICATIONS
61
1.Accepted Research Article:
62
63
64
65
66
67
68
69
References
70
REFERENCES
[3] Design And Reuse, System Verilog based Generic Verification Methodology for
IPs/ASICs/SOCs: A Case Study. [online] Available at: https://www.design-
reuse.com/articles/23742/systemverilog-verification-methodology.html
[8] Navaid Z. Rizvi, Rajat Arora and Niraj Agrawal,“ Implementation and Verification of
Synchronous fifo using system verilog verification methodology ”, School of ICT, Gautam
Buddha University Greater Noida, India, Journal of Communications Technology, Electronics
and Computer Science, Issue 2, 2015.
[9] Chris Spear,”System Verilog for Verification”, Springer, Vol 1 pp. 1-5, 2005.
[10] Janick Bergeron,” Writing Testbenches Using SystemVerilog”, Springer, Vol I pp. 1-10,
2006.
[11] Bergeron, Janick, Writing testbenches: functional verification of HDL models, Springer,
Edition 2003.
[15] Hemant Kaushali, Tushar Puri,” Design of synthesizable asynchronous FIFO and
implementation on FPGA”, School of Electronics, M.Techvlsi CDAC–Noida, International
Journal of Engineering Research and Development, Volume 13, Issue 7, July 2017, PP.06-12.
71
[16] Shilpa Maurya,” Design of RTL Synthesizable 32-Bit FIFO Memory”, International
Journal of Engineering Research & Technology (IJERT), Vol. 5 Issue 11, November-2016.
pp. 591-593.
[17] Gengting Liu, James Garside, Steve Furber, Luis A. Plana, Dirk Koch,” Asynchronous
Interface FIFO Design on FPGA for High-throughput NRZ Synchronisation”, IEEE Xplore,
Science and Information Conference (SAI), London, UK, 03 September, 2015.
[18] V. Nagarajan,” The Design and Verification of a synchronous First-In First-Out (FIFO)
Module Using SystemVerilog Based Universal Verification Methodology(UVM)”, Rochester
Institute of Technology, Rochester, New York, December 2018.
[19] Yakovlev, Alexandre V., Albert M. Koelmans, and Luciano Lavagno. "High-level
modeling and design of asynchronous interface logic." IEEE Design & Test of Computers, Vol
12.1, pp 32-40, 1995.
[20] K.K. Yi, “The Design of a Self-Timed Low Power FIFO Using a Word- Slice Structure”,
M.Phil Thesis, University of Manchester, September 1998.
[21] Wang, Xin, Tapani Ahonen, and Jari Nurmi, "A synthesizable RTL design of
asynchronous FIFO”, System-on-Chip Proceedings, 2004 International Symposium on IEEE,
pp. 123-128, 2004.
[22] T., Nowick, S.M., “Low-latency asynchronous FIFO’s using token rings”, Advanced
Research in Asynchronous Circuits and Systems, Proceedings. Sixth International Symposium,
Vol 2-6, pp 210 – 220, April 2000.
[24] Doulos Ltd, “SystemVerilog Golden Reference Guide”, Vol II, pp. 1-11, 2003.
[26] Andreas Meyer, “Principles of Functional Verification”, Vol I, pp. 1-10, 2004.
[30] Chris Spear,”System Verilog for Verification”, Springer, Vol 1 pp. 241-242, 2005.
[32] Chris Spear,”System Verilog for Verification”, Springer, Vol 1 pp. 244-245, 2005.
[33] Vlsi.pro. Code Coverage Fundamentals – VLSI Pro [online] Available at:
https://vlsi.pro/code-coverage-fundamentals/
72
[34]Verificationguide.com. SystemVerilog Functional Coverage. [online] Available at:
https://www.verificationguide.com/p/systemverilog-functional-coverage.html
[35] Chris Spear,”System Verilog for Verification”, Springer, Vol 1 pp. 13-15, 2005.
[42] Ashok B. Mehta, “SystemVerilog Assertions and Functional Coverage”, (2nd ed.)
[Online]. Available: http://extras.springer.com
[43] Clifford Cummings,” SystemVerilog Assertions ‐ Bindfiles & Best known practices for
simple SVA usage”, Sunburst Design (SNUG), 2009.
[44] Cypress, “Understanding of Synchronous Dual Port RAMs”, Document No. 001-17358
Rev. *F
[45] Synopsys, “System Verilog Assertions Checker Library Quick Reference”, April, 2006.
[48] Design And Reuse. Using SystemVerilog Assertions in RTL Code, [online] Available at:
https://www.design-reuse.com/articles/10907/using-systemverilog-assertions-in-rtl-code.html
[50] Clifford Cummings,” SystemVerilog Assertions ‐ Bindfiles & Best known practices for
simple SVA usage”, Sunburst Design (SNUG), 2016.
73
This is to certify that M.Tech Thesis title Design and Verfication of FIFO Through
Layered Testbench Approach and Authored by Mohini Akhare has been examined
by us.
1. The work presented in original and own work of author. No ideas processes,
results or words of others have been presented as Authors own work.
2. No sentences equation diagram, table, paragraph or section has been copied
verbatim from previous work unless it is placed under quotation marks and
duly referenced.
3. There is no fabrication of data or results which have been compiled /analyzed.
4. There is no fabrication by manipulating research materials, equipment or
processes, or changing or omitting data or results such that the research is not
accurately represented in research report.
5. The thesis has been checked using Urkund (copy of originality report attached)
found within limits as per RCOEM Plagiarism Policy and instruction issued
from time to time.
Name and Sign. of the student (Author) Name and Sign. of the Supervisor
Mohini Akhare Dr. Nitin P. Narkhede
Department: Electronics Engineering Department: Electronics Engineering
Date:
Place: Nagpur
74
75