Updated 9/13/21
|
SystemVerilog Errata
SystemVerilog for Verification, Third Edition, Errata
Thank you to everyone who has sent me the mistakes they found in my
book, SystemVerilog for Verification, third edition. Like a hardware
project, the book has "bugs". Both hardware and books should be
verified by someone other than the person who created it. Now if I can
only figure out how to perform constrained random testing of text...
This page will show any functional mistakes in the THIRD
EDITION of the book. Code that
does not work, explanations that are incorrect, etc. Simple typos and
bad English are not included.
Chapter 1 Verification Guidelines
-
Page 9 section 1.7, second line
These values are the easiest to create - just call $random().
Chapter 2 Data Types
-
Page 33
These dimensions can be specified in the [msb:lsb]
format, or [size].
-
Page 36
Sample 2.21, the last comment is incorrect and should be:
// Initialize the elements. d[3][1] = 31;
-
Page 37 (shortened last sentence)
As a shortcut, a $, as in [1:$], stands for the maximum
value, [1:2], in first line of the initial block of Sample 2.23.
-
Page 43, Sample 2.32: must cast the width of the boolean expressions.
count = d.sum(x) with (32'(x > 7)); // 2=sum{1,0,1,0,0,0}
count = d.sum(x) with ((x > 7) * x); // 17=sum{9,0,8,0,0,0}
count = d.sum(x) with (32'(x < 8)); // 4=sum{0,1,0,1,1,1}
count = d.sum(x) with (x < 8 ? x : 0); // 12=sum{0,1,0,3,4,4}
count = d.sum(x) with (32'(x == 4)); // 2=sum{0,0,0,0,1,1}
-
Page 47, section 2.7.4
SystemVerilog can not sort associative arrays.
-
Page 54, Sample 2.49, 8th line
$display("Timeout - %s", message);
-
Page 60, Sample 2.60, 3rd from last line
c2 = color_e'(c); // No type checking
-
Page 64, Exercise 2.g
g. my_logic = my_logicmem[my_logicmem[4]];
Chapter 3 Procedural Statements and Routines
-
Page 74
The ^= compound statement in Sample 3.11 ...
-
Page 75, Sample 3.12, 9th line
@(posedge bus_enable) data = bus_data;
-
Page 79, above Sample 3-22
The alternative is to pass the array by reference.
Chapter 4 Connecting the Testbench and Design
-
Page 90, Sample 4.3, add a declaration for rst:
logic rst;
-
Page 92, Sample 4.6, change compare operator here and throughout the chapter:
if (arbif.grant !== 2'b01)
-
Page 116, Sample 4.37, change compare operator:
if (arbif.cb.grant !== 2'b01)
Chapter 5 Basic Object Oriented Programming
-
Page 153, after Sample 5.25, all references to handle "t" should be
"tr"
However, if transmit tries to modify the handle, the result won't be
seen in the initial block, as the tr argument was not
declared as ref.
As shown above, transmit can modify data[0] in the object without
changing the value of tr.
Chapter 6 Randomization
-
Page 172, Section 6.2.6, last paragraph, remove extra "and hold"
Your constrained random testbench should not purposefully setup and hold requirements.
-
Page 180, Sample 6.12 should be
f inside {vals};
-
Page 180, Sample 6.14 should be
!(notf inside {vals});
-
Page 181, Sample 6.17 should be
constraint cday {choice inside {choices});
-
Page 184, Sample 6.22 is missing endclass
-
Page 185, Sample 6.24 and 6.25 are missing endclass
-
Page 186, Sample 6.26 is missing endclass
-
Page 188, Table 6-5 shows the wrong probablities. All should
be 1/5, not 1/2.
-
Page 189, Sample 6.31 is easier to read with parentheses
(x==0) -> (y==0) ;
-
Page 194, last line.
See Sample 6.65 for another example of post_randomize.
-
Page 199-200, samples 6.41 and 6.42.
See Sample 6.65 for another example of post_randomize.
-
Page 204, Sample 6.49, line 3.
constraint c_set_four { strobe.sum() with (int'(item)) == 4; }
Chapter 7 Threads and Interprocess Communication
-
Page 243, Sample 7.19, add the following comment
// Task must be in a class or an automatic program or module
Chapter 8 Advanced Object Oriented Programming and Testbench
Guidelines
-
Page 276, Sample 8.2 is missing endclass.
-
Page 293, last paragraph. The 2012 LRM states that in an extended
class, teh return type of a virtual function shall be either a
matching type or the the derived class type. So the BadTr::copy()
method could return a BadTr handle. In reality, few people and no
methodologies use this language feature.
-
Page 304, Sample 8.34
class Generator #(type T=BaseTr);
mailbox #(T) gen2drv;
T blueprint; // Blueprint object
function new(input mailbox #(T) gen2drv);
-
Page 310, Sample 8.44, starting at line 17
config_db#(Tiny)::set("Null", null); // Test null handles
config_db#(int)::get("i", k); // Fetch an int
$display("fetched value (%0d) of i (%0d) ", k, i);
-
Page 315, Sample 8.51, remove the second line with m_children
as it is not needed.
-
Page 315, Sample 8.52, line 3, add default argument value
pure virtual function svm_object create_object(string name="");
Chapter 9 Functional Coverage
-
Page 337, Sample 9.8, need to construct the coverage object.
CovDst8 covdst;
function new();
covdst = new();
endfunction
-
Page 339, Section 9.7.2
You can also explicitly define bins as shown in Section
9.7.5.
-
Page 339, Section 9.7.3, second paragraph
... explicitly define bins as shown in Section
9.7.5.
-
Page 346, Section 9.7.11, first paragraph
... explicitly define bins that you want to cover as shown in Section
9.7.5.
-
Page 346, Section 9.7.11, last line
bins, which is 6 in this case.
Chapter 10 Advanced Interfaces
-
Page 368, Sample 10.7, first line
typedef virtual Tx_if.TB vTx_t;
-
Page 369, Sample 10.7, second line
while (Tx.cb.en !== 0) // Wait for enable deassert
Chapter 11 A Complete SystemVerilog Testbench
-
Page 413, Sample 11.27, method pre_tx argument list is wrong
virtual task pre_tx(input Driver drv,
input UNI_cell cell,
inout bit drop);
Chapter 12 Interfacing with C
-
Page 419, second paragraph
The LRM limits imported functions results to "small
values".
-
Page 419, Sample 12.6
initial $display("fabs(-1.0)=%f", fabs(-1.0));
-
Page 434, Sample 12.22, first line
import "DPI-C" function void fib_oa(inout bit [31:0] data[]);
-
Page 434, Sample 12.22, eighth line, remove the second argument
fib_oa(data);
-
Page 434, Sample 12.23, first line
void fib_oa(const svOpenArrayHandle data_oa,
const int size) {
-
Page 450
Use the routine svGetScope to get a handle to the current scope, and then use that handle in a call to svSetScope to make the C code think it is inside another context.
-
Page 451, Sample 12.50
C: c_display called from scope top.b1
C: calling top.b1.sv_display
SV: In top.b1.sv_display
C: c_display called from scope top
C: calling top.b1.sv_display
SV: In top.b1.sv_display
-
Page 453:
> simv +script="perl hello.pl"
Index
-
Page 460
Find_index method, 43-45, 300
Credits
Thanks to Yan Chen, Toshio Fujisawa, Yue Guo, Amirtha Kasturi, Andres
Mancera, Dan Notestein, Yugandhar Patil, David Quintana, Farhad
Rafraf, K Ramakrishna, Abdul G Shaikh, Reddy Bing Xiao and Antonio
Martinez Zambrana for their help.
Home
SystemVerilog
OpenVera
PLI
Verilog
Verification
PMC
Emacs
Bicycling
Personal
Viewlogic
|