WELCOME IC FANS' HOME!
--ASIC/IC Design,Logical Design,STA,Digital IC Design,Synthesis, and so on.
2007-12-31
Systemverilog Tutorial(Ch1-intorduction)
Today is the first day of 2008!
Happy New Year For Everyone!
Now Let us make a closed study on the systemverilog.
Several days ago, I came acrossed a book called "Systemverilog Assertion". The preface of the book intrigues my interest on Systemverilog that may be the next generation hardware description language. It is reported that the systemverilog has fixed its roots steadily in EDA field such as system design and verifications of ASIC/IC design.
So it is necessary for us to make a acquaintance with it. Now I have googled many resources about it and sort them as follows step by step! Just follow me! Be patient and systemverilog world is coming.
The following chapter is about the introductions of systemverilog.
Introduction
Verilog 1995 version has been in market for a very long time. IEEE extended the features of Verilog 1995 and released it as Verilog 2001. But this was no good for verification engineers, so verifcation engineers had to use languages like "e", VERA, Testbuider. It was rather painfull to have two language, one for design and other for verification. SystemVerilog combines the Verification capabilties of HVL (Hardware Verification Language) with ease of Verilog to provide a single platform for both design and verification.
Some of the new features in SystemVerilog are as listed below.
C type data types like int, typedef, struct, union, enum.
Dynamic data types : struct, classes, dynamic queues, dynamic arrays.
New operators and built in methods.
Enhanced flow control like, foreach, return, break, continue.
Semaphores, mailboxes, event extensions.
classes for object oriented programming.
Assertions.
Coverage.
VPI extensions.
Now IEEE has accepted the SystemVerilog, and it is called 1800-2005 standard.
Anyone with background of C++, or OO programming language will feel at home with SystemVerilog. But on other hand if you have been thinking C or C++ is not required, then you may be shocked to know that SystemVerilog is very much like C++.
This article assuming you are an Architect and What all questions will come to your thought process before Architecting and making the Chip as a first-pass success. Chip Design is an Integration Challenge.
What is the targetted market for this Chip.
What are the competitor's to this Chip and Market Requirement and ROI
What is the Fabrication Unit the Chip is targetted for?
What is the Success rate and Yield numbers achieved in the Fabrication Unit
What is the technology Process targetted for
What is the correlation of the library models w.r.t. Silicon
What are the various Protocols the Chip is going to address
Hardware & Software Parti-tioning.
What is the processor/micro-controller suitable for this application.
Is Power Management Unit a requirement in the chip to reduce Dynamic power
What are the mechanisms followed to reduce the leakage power
Is Module enables/clock-gating a part of the Methodology
Is resets going to synchronous or asynchronous
What are the various Synchronous Mechanisms for data-transfer's
How many clock-domains required for the Chip
How many PLL's are required or single PLL sufficient for all the clocks required
What is the thought process behind PAD's Is LVTTL/SSTL pads
Is the package going to wire-bond or Flip-chip
Methodology for Optimal Power-grid design
What are the noise reducing Mechanism's in case of analog integration
Is there any requirement of speed monitor's or process checking blocks
What is the type of fuses used laser fuse or efuses
Is there any requirement of Fib Cells in the Design
What are the mechanism's used to handle ESD
what is the reliability target of the Chip and how it is addressed
What are the Mechanisms used for Yield improvement
Is the chip tested at at-speed test
How much Memory-map is allocated for the IP's
What is the metric for spare-gates in the Chip for ECO's
Is repairable memories required
What is the tester targetted and the requirement to the Chip in terms of Scan-chain
Is test-vector compression mechanism's a requirement
What is the PLL performance in terms of Jitter
What is the Interrupt handling mechanism with in the Chip.
What is the ROM-Code for the Chip.
What is the Chip utilization targets
Will the chip be routable or any requirement for special libraries with different routing tracks.
What is the Methodology for tools and versions
What is the Version control mechanism planned for data handling across multi Geographical Environments.
What is the signoff criteria for the Chip
What is the frequency targets for the Chip.
Is there room for further revisions of the Chip.
If the Chip has DDR/SDR interface is there any requirement for DLL.
What are the limitations of the Tools interms of Complexity/run-times/turn-around times/Computation Power requirements.
What is the Mechanisms/Steps taken for the various Variabilities in the Chip IR drop/Power ground noise/inductance effects/EMI noise/Package noise/Crosstalk noise/Simultaneous Switching noise/Channel length variation/On chip Variation/Inter die variations/Intra die Process variations.
Once upon a time there was a golden songbird that lived in a beautiful garden. It spent all its days singing the loveliest songs to the honor of its maker and the delight of all the people who heard it.
But the keeper of the garden, who was a foolish and greedy man, coveted the little songster, and one day he made a cunning net in which he snared it. The little bird begged the man to release him and promised to tell him three great secrets if only he would let him go. Now the gardener really was a very greedy man and rubbing his hands together, he eagerly released the bird.
Then the songbird told him it’s three great secrets: Never believe all that you hear. Never regret what you have never lost. Never throw away that which you have in your keeping.
The gardener was furious when he heard this and said he had known these so-called ‘secrets’ since he was a little child and shouted that the bird had tricked him. But the songbird quietly replied that if the man had really known these three secrets, or only the last of them, he would never have let him go.
Then the bird added: “I have a most precious jewel weighing over three ounces hidden inside me and whoever possesses that marvellous stone will have every wish granted.”
On hearing this, the keeper roared like a lion and cursed himself for setting the songster free. But the little bird only added fuel to his rage by explaining that since he weighed no more than half an ounce at most, as anyone with eyes could plainly see, how was it possible that a gem weighing more than three ounces could be hidden within it’s tiny body?
At that the man tore his hair and lunged at the bird in a towering rage, but the little songbird flew to a nearby branch and added sweetly: “Since you never had the jewel in your hands you are already regretting what you never lost, and believing what I told you, you threw it away by setting me free.” Then the little songbird told the man to study well these three great secrets and so become as wise as the bird himself!
Yesterday evening, my roommate Wang told me a philosophical story. So I write it down to share with you, may you enjoy it.
once upon a time, a billionaire made a bet on money with a poor intellectual. The billionaire would give the one billion dollars if the intellectual could do nothing except for reading books, eating and sleeping in ten years. The intellectual gave his words to the billionaire. And then, the poor intellectual was locked in a small house full of a great variety of books including literatures, philosophies, physics, medics and so forth. The sole occupation of the intellectual is reading the books day after day, however, he didn't take that as a tedium thing but find a lot of things which fascinated him very much.
With time flies, it was only a month before the deadline of the ten years. However, on account of failures of investment and business, the billionaire was bankrupt. He had no money to pay the intellectual. So the billionaire had a guy to murder the poor intellectual. When the murder got to the house which the intellectual lived during the these ten years, he found that the intellectual had escaped via breaking through the window, and left a letter on the desk. As a matter of fact, the intellectual had heard the billionaire's bankruptcy and predicted that the billionaire would had him died, so he escaped without reclaiming his money. The letter reads: ”Dear Sir, Hi, a long time on see. I am so sorry to hear your bankruptcy. It is unnecessary for you to kill me, because I have decided to give up the money of the bet. Because I don't need your money any more, at present, I can earn lots of money by myself through the knowledges I have acquired by reading these years. Thank you for your bet and books. To a certain extent, you have paid me and the money will not run out forever. ”
A Good Verilog Coding Style is a prime requirement in every Design, for predictable results, and reusing the codes for various applications.
Indent the code so that the code is readable.
Ensure the code is generic across all technologies and not specified to a single technology.
Ensure the consistent signal names across the hierarchy.
Ensure that each RTL file contains file headers as comment comprising of { Name of the RTL, Version tag, Authors involved and their email-id's , information about the paramets used in the constructs, last edited, Bug-fixes history, Brief about what the code is performing}.
Ensure only one verilog statement per line.
Ensure that speed-critical logics are in seperate module.
Maximize the usage of gated-clocks, as this saves power.
Prefer clock-generating circuitry in separate module files.
Ensure one port declaration on one line, followed by comments about the port.
Preserve port order.
Declare the internal nets in the design.
Limitation on the line length {for example:not more than 75}.
Avoid the usage of 'include construct.
Ensure that the power-downed signals are in a known state.
Ensure that the coding style does not contain combinational feedback loops.
Never assign "x" value to the signals.
Maximize the usage of parameters instead of text-macros.
Use parameters for state-encoders.
Ensure that the design coding does not generate tri-state logic.
Use the concept of base+offset for coding address busses.
Tie the un-used bits to a known value.
Connect based on port-names while instantiating.
Ensure that no access of nets and variables outside the module context.
Avoid using ports of type "inout" in the design.
Ensure that the latches are transparent during scan-phase.
Ensure that the PLL bypass is present to verify with out PLL's.
Minimize top-level glue logic coding style.
Ensure only one module is defined in a file.
Ensure that the active low signals are suffixed with '_b' and clocks named with domain names for example clock_a, clock_b, "_z" for high impedance signals, "_o" for output signals, "_i" for input signals, "_ns" for state-machine next states, "_se" for scan-enable signals.
Prefer using case statements, instead of using long if and else statements.
Ensure that default statement is used in the case statements.
While designing FSM behaviours , prefer three always blocks(1. register definitions. 2. Defining next-logic. 3. Defining outputs).
Ensure that the unused module inputs are driven and not floating.
Ensure that the design has enough amount of spare-logic to incorporate the last minute design bug-fixes.
Ensure that the same test-benches are used for RTL and gate level simulations.
Ensure that the design does not contain initial blocks and delay elements.
Ensure that the whole design is resetable to a known state. No internal logic generated asynchronous resets.
Ensure the reset is not a late arriving signal w.r.t clocks due to dense reset trees.
In case if the desired reset is an asynchronous signal, ensure that it is part of the sensitivity list as according to the verilog if the reset signal is not part of the sensitivity list then it is inferred as a synchronous reset.
As in the case of an synchronous reset design, assist the synopsys synthesis tool with the comment //synopsys sync_set_reset_n "rst_n" , As for the synthesis tool reset is also treated as any other signal in case of synchronous-resets. In case of synchronous reset designs, in order to maintain the pulse-width of the signal, a small counter type of circuit is required.
Extra care is required while designing with synchronous resets and also designs having clock-gating logic. Poor coding styles can make the design non-resetable as it may be blocking the clocks reaching .
Ensure that a situation doesn't trigger an asynchronous set and asynchronous resets for the same flip-flop.
Ensure that the de-assertion of the asynchronous resets is not close to the clock-edge so that the flip-flop could be prevented from being entering in to meta-stable state.
Ensure that a recovery and removal timing checks are performed for resets to ensure the optimal behaviour.
Even though the design is working with asynchronous reset style, Ensure that the resets are synchronized passing through synchronizers. Ensure that these synchronizer flops are not part of the scan-chain stitching in the design.
Ensure that the resets are not used as data or clock signals in the design.
Ensure that the reset is priority over any other signal in the case of an if-else construct.
Ensure that the signals which cross the clock-domains are synchronized.
Ensure that the design does not contain while statements.
Understanding the signals & functionalities based on the signal names (like For Clock definitions naming the signal with "clk", naming resets with "res", and to know the whether the signal is active-high or active low triggerred( For example : resets which are active-low are named with res_n).
Ensure that clock-dividers are by-passed during scan stitching.
Coding style which is generic and re-usuable.
Avoid using verilog UDP in the design.
Coding style which will not have simulation and synthesis mis-match results.
Coding style friendly to Synthesis and not having constructs which synthesis tool cannot understand.
Coding style which ensures the correct digital logic will be generated after performing synthesis. The basic digital mismatches could be inferred (For example : Latch for a Flip-flop requirement, Priority Encoder for a Mux Design requirement).
Coding Style which are DFT(Design for Test) friendly.
Usage of Blocking(=) & Non-blocking(<=) statements and Steps to prevent Race-conditions .
Race conditions are situations, where the order of execution isn't always guaranteed within verilog.
Use blocking statements for coding combinational logic
Use non-blocking statements for coding sequential logic
Never mix blocking and non-blocking in a same procedural block
Never assign a value to the same variable multiple times in different always blocks. Even though it is a non-blocking statements the design is prone to race-condition
To get to know more depth in to the concept Refer the paper:
Be Sensitive about the Sensitivity list
Synthesis tools assumes to generate combinational logic from an always block, if it does not contain statements like "posedge" or "negedge".
Ensure that a complete list of signals present in the sensitivity list in an always block, thereby the simulation results for a pre-synthesis versus the post-synthesis match.
Ensure only one clock per sensitivity list.
Synopsys Full-case and parallel case directives
Synopsys full_case directive :
When the Synthesis tool(Synopsys Design Compiler), comes across with the comment
(//synopsys full_case, before case statements), the tool is guided stating that though all the cases are not mentioned , these are the possible cases design can honour so the tool for the rest of the non-listed cases the synthesis tool assumes that the outputs are don't cares.
(synopsys parallel_case, before case statements), the tool is guided stating that it optimizes the logic, assuming that the case statements would match only one case , prevents the synthesize tool from optimizing the un-necessary logic.
Various ways of Coding the same logic (for example :Mux)
// first example with continuous assignment
wire z;
assign z = sel ? x : y;
// second example with if and else
reg output;
always @ (x or y or sel)
if (sel)
output = x;
else
output = y;
Unsupported Verilog Language Constructs
Synthesis tool does not support the following Verilog Constructs:
Unsupported definitions and declarations
Primitive definition
time declaration
Ranges and arrays for integer declarations.
event declarations
triand, trior, tri1, tri0 and trireg net type
Ranges and arrays for integers.
Statements not supported by synthesis tool
defparam statement
initial statement
repeat statement
delay control statement
event control
wait statement
fork statement
deassign statement
force statement
release statement
Unsupported operators
Case equality and inequality operators (=== and !==)
Division and modulus operators for variables
Unsupported gate-level constructs
nmos,cmos, pmos, rnmos, rpmos, rcmos
pullup, pulldown, tranif0, tranif1, rtran, rtainf0, and rtainf1 gate type signals
Miscellaneous constructs, such as hierarchical names within a module
25. What is latchup in CMOS design and ways to prevent it?
To best understand the concept behind the latchup, we need to understand the concept behind SCR(Silicon Controlled Rectifiers), and how to model the basic transistor in an SCR structure and on what conditions SCR structures are created in the CMOS design process and its effects and what are the ways used to prevent it in the design-phase.An SCR is an acronym for Silicon Controlled Rectifier. It works similar to a typical diode, but is controlled similar to a bipolar transistor as far as connections go. Connection points are Anode [A], Cathode [K], and Gate [G]. The SCR is made up of two "P-N" junctions with a "Gate" attachment between them. The gate is connected between the two P-N junctions with a current waiting in the forward bias direction [+ to -] and the voltage is above 1-volt. A momentary pulse to the gate will cause the SCR to conduct and current will flow across the device until the value changes.
25. What are the various design changes you do to meet design power targets?
Design with Multi-VDD designs, Areas which requires high performance, goes with high VDD and areas which needs low-performance are working with low Vdd's, by creating Voltage-islands and making sure that appropriate level-shifters are placed in the cross-voltage domains
Designing with Multi-Vt's(threshold voltages), areas which require high performance, goes with low Vt, but takes lot of leakage current, and areas which require low performance with high Vt cells, which has low leakage numbers, by incorporating this design process, we can reduce the leakage power.
As in the design , clocks consume more amount of power, placing optimal clock-gating cells, in the design and controlling them by the module enable's gives a lot of power-savings.
As clock-tree's always switch making sure that most number of clock-buffers are after the clock-gating cells, this reduces the switching there by power-reduction.
Incorporating Dynamic Voltage & Frequency scaling (DVFS) concepts based on the application , there by reducing the systems voltage and frequency numbers when the application does not require to meet the performance targets.
Ensure the design with IR-Drop analysis and ground-bounce analysis, is with-in the design specification requirement.
Place power-switches, so that the leakage power can be reduced. related information.
It is an interesting Architectural decision, what should be our FIFO depth?
What is the Transmitter data rate?
What is the reciever data rate?
when there is a requirement for FIFO? when the Transmitter data rate and the recieve data rate are not in sync rather they dont match.The read is slower than the write, so there is always a chance the data will be lost, so FIFO will be an intermediate logic where the data would be buffered or stored . Smaller FIFO depth can cause overflow scenario and cause a data loss
Possible scenarioes:
Scenario 1:
Write is in maximum condition & Read is in minimum condition , means Write process is writing the data faster and read is reading or accessing the data slowest.
Scenario 2:
Whether the design supports only single writes or burst writes also. It becomes more complex when burst writes are present.
Scenario 3:
Write with no idle cycles and read with idle cycles.
Scenario 4:
Is the design's requirement is of Synchronous FIFO or an asynchronous FIFO?
Synchronous FIFO: A First In First Out memory, where in the has a control logic mechanism, has read and write pointers, generates Status signals and places handshake signals across. Sync FIFO has a same clock frequency for both read and write operation. The control/status signals could be Read Error, Write Error signals generated. Read Error generated when the FIFO is empty and Write Error is generated when the FIFO is full, writing may cause a data loss.Based on these signals can generate interrrupt signals to act upon. Handshake signals could be Read Enable or a Write Enable, Write Acknowledge and read acknowledge.
Asynchronous FIFO: The operation of Write and Read of a FIFO is purely asynchronous.
Scenario 5:
The Data width of an Tx and Rx are different.
Watermarks as Threshold setters
Set an low watermark and high watermark
Details about depth of FIFO
One of the most common questions in interviews is how to calculate the depth of a FIFO. Fifo is used as buffering element or queueing element in the system, which is by common sense is required only when you slow at reading than the write operation. So size of the FIFO basically implies the amount of data required to buffer, which depends upon data rate at which data is written and the data rate at which data is read. Statistically, Data rate varies in the system mainly depending upon the load in the system. So to obtain safer FIFO size we need to consider the worst case scenario for the data transfer across the FIFO under consideration.
For worst case scenario, Difference between the data rate between write and read should be maximum. Hence, for write operationmaximum data rate should be considered and for read operationminimum data rate should be considered.
So in the question itself, data rate of read operation is specified by the number of idle cycles and for write operation, maximum data rate should be considered with no idle cycle.
So for write operation, we need to know Data rate = Number of data * rate of clock. Writing side is the source and reading side becomes sink, data rate of reading side depends upon the writing side data rate and its own reading rate which is Frd/Idle_cycle_rd.
In order to know the data rate of write operation, we need to know Number of data in a Burst which we have assumed to be B.
So following up with the equation as explained below:
Fifo size = Size to be buffered = B - B * Frd / (Fwr* Idle_cycle _rd ).
Here we have not considered the synchronizing latency if Write and Read clocks are Asynchronous. Greater the Synchronizing latency, higher the FIFO size requirement to buffer more additional data written.
Example : FIFO Depth Calculation
Assume that we have to design a FIFO with following requirements and We want to calculate minumum FIFO depth,
A synchronized fifo
Writing clock 30MHz - F1
Reading clock 40MHz - F2
Writing Burst Size - B
Case 1 : There is 1 idle clock cycle for reading side - I
Case 2 : There is 10 idle clock cycle for reading side – I
FIFO depth calculation = B - B *F2/(F1*I)
If we have alternate reading cycles, i.e. between two reading cycle there is IDLE cycle.
FIFO depth calculation = B - B * F2/(F1*2)
In our present problem FIFO depth = B - B *40/(30*2)= B(1-2/3)= B/3
That means if our Burst amount of data is 10, FIFO DEPTH = 10/3 = 3.333 = 4 (approximately)
If B = 20, and then FIFO depth = 20/3 = 6.6 = 7 or 8 (clocks are asynchronous)
If B = 30 FIFO depth = 30/3 = 10 or 11 (clocks are asynchronous)
Hvt cells are MOS devices with less leakage due to high Vt but they have higher delay than low VT, where as the low Vt cells are devices which have less delay but leakage is high. The thereshold(t) vloltage dictates the transistor switching speed , it matters how much minimum threshold voltage applied can make the transistor switching to active state which results to how fast we can switch the trasistor. disadvantage is it needs to maintain the transistor in a minimum subthreshold voltage level to make ir switch fast so it leads to leakage of current inturn loss of power.
8. What is LEF mean?
LEF is an ASCII data format from Cadence Design inc, to describe a standard cell library. It includes the design rules for routing and the Abstract layout of the cells. LEF file contains the following,
DEF is an ASCII data format from Cadence Design inc., to describe Design related information.
10. Steps involved in designing an optimal padring
1. Make sure you have corner-pads, across all the corners of the padring, This is mainly to have the power-continuity as well as the resistance is less .
2. Ensure that the Padring ful-fills the ESD requirement, Identifyh the power-domains, split the domains, Ensure common ground across all the domains.
3. Ensure the padring has ful-filled the SSN(Simultaneous Switching Noise) requirement.
4. Placing Transfer-cell Pads in the cross power-domains, for different height pads, to have rail connectivity.
5. Ensure that the design has sufficient core power-pads.
6. Choose the Drive-strenght of the pads based on the current requirements, timing.
7. Ensure that there is seperate analog ground and power pads.
8. A No-Connection Pad is used to fill out the pad-frame if there is no requirement for I/O's.Extra VDD/GND pads also could be used. Ensure that no Input/output pads are used with un-connected inputs, as they consume power if the inputs float.
9. Ensure that oscillator-pads are used for clock inputs.
10. In-case if the design requirement for source synchronous circuits, make sure that the clock and data pads are of same drive-strength.
11. Breaker-pads are used to break the power-ring, and to isolate the power-structure across the pads.
12. Ensure that the metal-wire connected to the pin can carry sufficient amount of the current, check if more than one metal-layer is necessary to carry the maximum current provided at the pin.
13. In case if required , place pads with capacitance.
11. What is metastability and steps to prevent it.
Metastability is an unknown state it is neither Zero nor One.Metastability happens for the design systems violating setup or hole time requirements. Setup time is a requirement , that the data has to be stable before the clock-edge and hold time is a requirement , that the data has to be stable after the clock-edge. The potential violation of the setup and hold violation can happen when the data is purely asynchronous and clocked synchronously.
Steps to prevent Metastability.
1. Using proper synchronizers(two-stage or three stage), as soon as the data is coming from the asynchronous domain. Using Synchronizers, recovers from the metastable event.
2. Use synchronizers between cross-clocking domains to reduce the possibility from metastability.
3. Using Faster flip-flops (which has narrower Metastable Window).
12. what is local-skew, global-skew,useful-skew mean?
Local skew : The difference between the clock reaching at the launching flop vs the clock reaching the destination flip-flop of a timing-path.
Global skew : The difference between the earliest reaching flip-flop and latest reaching flip-flop for a same clock-domain.
Useful skew: Useful skew is a concept of delaying the capturing flip-flop clock path, this approach helps in meeting setup requirement with in the launch and capture timing path. But the hold-requirement has to be met for the design.
13. What are the various timing-paths which i should take care in my STA runs?
1. Timing path starting from an input-port and ending at the output port(purely combinational path).
2. Timing path starting from an input-port and ending at the register.
3. Timing path starting from an Register and ending at the output-port.
4. Timing path starting from an register and ending at the register.
14. What are the various components of Leakage-power?