References:
Verification: making sure that C and RTL models are functionally correct.
This is the most serious, time-consuming challenge in digital hardware design.
The so-called formal verification techniques, which amount to efficient exhaustive simulation, have been gaining ground, but suffer from capacity problems.
Testing:
early 1980s, research on automatic verification
In early 2000s, a sort of renaissance occurred in verification languages.
CTL: specify both liveness properties and safety properties;
LTL: a subset of CTL, expresses only safety properties
but their traditional mathematical syntax is awkward for hardware designers.
Instead, a number of more traditional computer languages, which combine a more human-readable syntax for the bare logic with a lot of “syntactic sugar” for more naturally expressing common properties, were proposed for expressing properties in these logics.
Two industrial efforts from Intel (ForSpec) and IBM (Sugar) emerged as the most complete;
CBV from Motorola
Some EDA companies were producing languages designed for writing test benches and checking simulation coverage.
Vera and e are two most commercially successful;Vera: originally designed by System Science and since acquired by Synopsys;e: designed and sold by Cadence (formerly Verisity)==> These industrial languages were donated to the Accellera standards body and have been the basis for defining a new IEEE standard called PSL.
a[0:3] & b[0:3] and a(0 to 3) and b(0 to 3) represent the bitwise and of the four most significant bits of vectors a and b in the Verilog and VHDL flavors, respectively.always !(ena & enb) states that the signals ena and enb will never be true simultaneously in any clock cycle.
always operator, which states that a Boolean expression holds in every clock cycle, is one of the most basic.always(req -> next ack) states that in every cycle that the req signal is true, the ack signal is true in the next cycle.
next operator, one of the operators that specify delays.req -> next[2] ack means that ack must be true two cycles after each cycle in which req is true.
-> symbol denotes implication, that is, if the expression to the left is true, that on the right must also be true.always {req; ack; !cancel} is a syntactic sugar for always (req -> next (ack -> next !cancel)), means that ack must be true after any cycle in which req is true, and cancel must be false in the cycle after that.weak and strong property:
weak property can be checked in simulation; i.e., for safety properties;strong property: can only be checked formally; express liveness properties;!.always (req -> eventually! ack) states that after req is asserted, ack will always be asserted eventually.eventually! operator illustrates the meaning of strong operators.req but did not see ack, it would be incorrect to report that this property failed because running that particular simulation longer might have produced ack.always ((a && next[3] (b)) -> c), states that when a is true and b is true three clock cycles later, c is true in the first cycle when a is true.The following example declares a “verification unit” called ex1a, binds it to the instance named top_block_i1_i2 in the design under test, and declares (the assertion named A1) that the signals ena and enb in that instance are never true simultaneously.
vunit ex1a(top_block.i1.i2){
A1: assert never (ena && enb);
}use directives
assert,assume, assume a given property;assume_guarantee, both assumes and tests a particular property;restrict, constraints the tool to only consider inputs that have a given property;cover, asks the tool to check whether a certain property was ever observed;fairness, which instructs the tool to only consider paths in which the given property occurs infinitely often, for example, only when the system does not wait indefinitely.Modeling layer (fourth layer): allows Verilog, SystemVerilog, VHDL, or other code to be included inline in a PSL specification.
The intention here is to allow addition details about the system under test to be included in the PSL source file.
<' and '> symbols; otherwise it will be comments;% and !. % indicate when a field is to be driven on the device under test; ! indicates when a field is not randomly computed.
One of the SystemVerilog’s strengths remains its ability to represent test benches along with the model being tested;
The following example: a test bench for a simple multiplexier mux. It applies a sequence of inputs over time and prints a report of the observed behavior.
module testbench;
logic a, b, sel, f;
mux dut(f, a, b, sel);
initial begin
$display(“a,b,sel -> f”);
$monitor($time,,
“%b%b%b -> ”,
a, b, sel, f);
a = 0; b = 0; sel = 0;
#10 a = 1;
#10 sel = 1;
#10 b = 1;
#10 a = 0;
#10 sel = 0;
#10 b = 0;
end
endmodule
the output of the example:
a,b,sel -> f
0 000 -> 0
10 100 -> 1
20 101 -> 0
30 111 -> 1
40 011 -> 1
50 010 -> 0
60 000 -> 0
Random test generation taken from Vera language;
Coverage constructs;
Temporal assertions; allow a test engineer to specify both desirable and undesirable properties that take place over one, two, or more clock cycles;
Verilog Shortcommings:

The implementation in Figure 15.12a appears to be correct, but in fact may not behave as expected because the language says the simulator is free to execute the three always blocks in any order when they are triggered.
If the processes execute top to bottom, the module becomes a one-stage shift register, but if they execute bottom to top, the behavior is as intended.
The real danger here is that the simulation might work as desired but the synthesized circuit may behave differently, defeating the value of the simulation.
Figure 15.12b shows a correct implementation of the shift register that uses nonblocking assignments to avoid this problem. The semantics of these assignments are such that the value on the right-hand side of the assignment is captured when the statement runs, but the the actual assignment of values is only done at the “end” of each instant in time, that is, after all three blocks have finished executing. As a result, the order in which the three assignments are executed does not matter, and therefore the code always behaves like a three-stage shift register.
Non-blocking assignments. ???
Bit and BIT are equivalent;Assertions;
can be used to check temporal properties;
process begin
wait until clk'event and clk = '1' and request = '1';
wait until clk'event and clk = '1';
assert acknowledge = '1';
end process;support PSL constructs: assert always (request -> next acknowledge);
“The few commercial products that have provided hardware synthesis from SystemC have met with little commercial success”.
Much faster for higher-level models than Verilog/HDL;
On detailed models, the simulation speed of a good compiled-code Verilog or VHDL simulator may be better;
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?