FPGA Simulation Errata
To paraphrase Neil Stephenson in Cryptonomicon, getting the last typo out of a large technical book is like trying to get the last bit of water out of a discarded tire. Many people reviewed FPGA Simulation and yet, alert readers have found the following:
Page 96 refers to the wrong line of code
Line 27—The overflow signal becomes true…
Line 29—The overflow signal becomes true…
The Prime Number randomization example on page 296 will not return 2
Busted! This is true. I forgot about 2.
Table 3-2 is incorrect
Table 3-2 shows two identical transactions in the Cache2CPU: result(data,hitormiss).
There should only be one “result” transaction as is the case in the MEM2Cache channel.
There’s a little history to this error. I originally had designed this test plan with two different kinds of transactions:
Then I decided on one “result” transaction with two arguments. I did this because I looked ahead to using these transactions in a test bench and I realized that it would be easier to check an argument to a transaction than the type of the transaction.
I left two transactions in that column when I made the change.
Typo on Page 24
The last two words on page 24 should be “Test Planning” not “Code Coverage” It should read:
The fastest way to write the tests you need is to create a test plan, and that’s the subject of Step Two: Test Planning
Bug on page 95: Figure 8-3
Line 30 attempts to invert the reset signal to create an enable signal. But all it does is prove that the enable could have been set to a constant of 1. Line 30 should read:
enable <= '1' when (rst = '0') else '0';
Page 99 Refers to the wrong line of code
Line 37—This generic line passes our control record…
Line 38—This generic line passes our control record…
Page 158 Redundant File Close
Line 12 of Figure 13-4 says:
$fclose(filea); $fclose(fileb); $fclose(fileab);
Actually since we closed filea and fileb, we don’t need to close the MCD that points to both files.
There is a missing “=” in the syntax for defining coverage on transitions in a covergroup.
bins bin_name = ( <value1> => <value2> );
The first “=” is missing.
(Thanks to Tony Lanier at Harris Corp for the following two errata. )
There is an error on line 25 of 11-5. The comp function is supposed to check that A, B, and op match the same fields in the transaction. But there is a mistake in the line that checks this fact. It should read as follows:
function bit comp (alu_operation t);
return ((t.A == A) && (t.B == B) && (t.op == op));
The line in the book is missing the second ‘=’ sign in the op comparison. This is an error that makes VHDL-lovers chortle since this kind of error could not happen in VHDL. In SystemVerilog (and Verilog and C) this kind of error causes t.op to take on the value of op. It returns true as long as op is not zero. While a linter would catch this problem, the SystemVerilog syntax checker will not.
Throughout the Book
If you look at section 6.19.5 of the SystemVerilog LRM, you’ll see that enumerated types have several methods that can be run on them. If you look at section 188.8.131.52, you’ll see that enumerated types have a method called .name that returns a string that contains the value of the enumerated type in the variable.
The intention is that the following approach will return the name of the enumerated type in the variable op:
$sformat(str,"A: %2h B:%2h OP:%s", A,B,op.name);
However, throughout the book, I omitted the .name in these system calls and this worked in Questa. However, it does not work in Incisive. Incisive requires the .call to the name method..