What coding constructs of Verilog can be used during the various stages o…
What coding constructs of Verilog can be used during the various stages of designing a regression environment for simulations?
Model answer
simulations? Verilog has the following constructs built-in, which help in the regressions: 1. $readmemh / $readmemb : These constructs help in loading memory data from a file. These constructs will be useful during microprocessor simulations, or in supplying vectors for a DUT, or simply customized commands encoded into the various fields of the line. Examples to illustrate the above have been discussed earlier in an earlier FAQ 3.5.1 in the Verification chapter. 2. Sometimes, a file parsing is required, to know the arguments from certain lines of a file. Instead of writing a PLI just for this purpose, the Verilog language provides the $fscanf system task inbuilt. This function scans the lines that it reads sequentially, until a carriage return is obtained, and assigns the values of the arguments to the destination variables. Each argument is typically separated by a white space within the input file. This is a very easy way to specify the tests to be run within a file, along with its associated arguments. For example, in the following code, the infile.txt is a file containing three fields. The arg1 is a decimal variable, arg2 is string, and arg3 is hexadecimal. The $fscanf task scans this file, all the way until the EOF is reached, and currently displays what it sees. It can be modified further into the different simulation launching sessions. Suppose the infile.txt file contained the following: The following would be the output of the above code: In the same way as illustrated above, the arg1,2,3 variables can actually be used internally for test launching and initialisation purposes. 3. Some environments use a "reference-file" based approach for the vector comparison for PASS/FAIL criteria of a release regression. This is typically useful for a multi-simulator product regression. This method is useful, since it is HDL independent output for comparison of the responses across the simulators of Verilog. The $fstrobe command can be used for this purpose. An example to illustrate this is as follows: The output of the above code produces the file out_vec_f ile, with contents as: The disadvantage of the vector-based approach is the fact that the vectors do not carry information of functional correctness. It is useful if the vectors have been inspected a priori by some other method, and declared to be "golden". Another disadvantage of this method is the following: If a design is changed during the course of its life-cycle (as for example, for bug-fixes or enhancements), then, depending on the nature of the changes, the originally captured golden vectors may no longer be valid. They would need to be re-captured, re-inspected and re-certified to be "golden". The vector doesn't carry information of functional correctness, except for clock cycle accurate reproduction of response, provided it has been verified once before. 4. When the same testbench is being used for multiple configurations of the DUT, that is, for running RTL simulations, Gate level simulations, or the behavioural model simulation, the instantiation of the DUT must be easily selectable from the command line itself. This can be achieved by the use of the command line argument of $value$plusarg . An example to illustrate this is as follows: During the simulation invocation command line, the following can be appended: % <simulation invocation> +define+RTL % <simulation invocation> +define+GATE Note that the Gate level simulations could be slow, due to the presence of system timing check commands, like $setup or $hold , built in within the simulation models of the cells of the technology library. If running the gate-level simulation is a requirement, some Verilog simulators have switches that will ignore these timing checks, and only the functional simulations are run, to make sure the logic is okay. The timing checks are now being done more through Static Timing Analysis (STA). This chapter discussed how the Verilog constructs could be used for the product simulation regression purposes. The different Verilog constructs that influence the simulation during invocation and runtime have been illustrated. The chapter also discussed how the simulation session can influence the log and the dump file generation. 1. IEEE Std 1364-2001, Language Reference Manual (LRM) 2. IEEE Std 1364.1-2002 Standard for Verilog Register Transfer Level 3. SystemVerilog 3.1a Language Reference Manual 4. SystemVerilog Synthesis User Guide : Version V2003-12 Dec 2003 from Synopsys Inc 5. The Verilog Hardware Description Language, Edition by Donald Thomas and Philip Moorby 6. Reuse Methodology Manual by Michael Keating and Pierre Bricaud, 7. Verilog 2001: A Guide to the New Features of the Verilog Hardware Description Language by Stuart Sutherland 8. Writing Testbenches: Functional Verification of HDL Models, Second Edition by Janick Bergeron 9. Verilog HDL Synthesis : A Practical Primer by J Bhasker