The advanced verification features (concurrent assertions, classes) cannot be run in ModelSim so we will use EDA Playground instead, which is a web application that will let you use these features via more powerful commercial simulators.
Projects are called "Playgrounds." The following are general setup and usage tips.
$readmem), click the
$dumpfile; $dumpvars; at the beginning of your test
bench's test input initial block.
This also means that the displayed waveforms won't persist across
different sessions and enum values will be
displayed instead of names (e.g., 00
instead of S_idle).
req is "request" and gnt is "grant") and
update the assertion failure message to be more descriptive.
disable iff clause disables the
property trigger when its expression is true.
Add to the end of the existing test bench to
verify this disabling feature.
In your text file, indicate what period of simulation time
corresponds to your added verification and briefly how you designed
it.
reset, that checks that
req is never high for more than 3 consecutive clock
cycles (hint: implicitly this means req is eventually
de-asserted).
Give it an appropriate name and error message and add to the end of
the test bench to verify its behavior.
program is basically a module for
verification.
this to
differentiate between its argument and the class property, both
of which have the name size.
task is a more general function
that uses ports instead of arguments and a return value.
Tasks may also include timing statements.
return
keyword.
class is defined inside
of the program, it is within scope.
Run the code and you should see the expected output:
# Payload : b8 26 66 b6 c6 # Size of packet 5
$urandom_range().
This is because the default random seed is always 1.
new().
The program can no longer see the class definition!
`include "design.sv" (no
semi-colon) to the top of testbench.sv.
This will copy the text of the included file directly where you
place it.
Run the code and you should see the expected output.
include
line.
Wrap a package definition (e.g., package pack;)
around the class definition.
Run the code now and the scoping error should be back.
import pack::packet; to
import the class definition from your package.
Try placing this line in different parts of the code (e.g.,
inside or outside the program, above or below the
handle definition) to see what works and what doesn't.
packet_buf to represent a
circular buffer of 4-byte packet objects, whose
specifications follow.
It is recommended that you take liberal inspiration from the
packet class.
byte], and a read
pointer [byte].
next, which advances the
read pointer by one, read, which returns the
packet currently pointed to in the buffer, and
print_buf, which prints the indices and contents
of the entire buffer.
packet_buf of size 3, call print_buf, and
then use next and read to print out every
packet individually, including the first one twice (to verify
circular behavior).
program
that instantiates a PrimeDie4 object and sets its
random seed to 371.
Then, in a repeat (30) block, it should randomize the
object and call its display task (i.e., your
output should show 30 different sets of randomized die
faces).
randomize.
Upon failure, call $fatal with a first argument of
1 and appropriate message.
c_uniq that specifies that
none of the 4 sides can have the same value.
c_bad
conflicts with c_uniq.
One benefit to defining multiple constraint blocks is that you can
manually enable and disable them individually using the syntax
<handle>.<constraint_name>.constraint_mode(<0/1>);.
Leave the code for c_bad where it is, but disable it
in your test bench before your call to randomize.
prime_low[] and
prime_high[] to create additional constraints that
achieve the following behaviors:
s4 should be any of the values in
prime_high[] with equal probability.
s2 and s3 should be any of the
prime numbers in range with equal probability.
s1 being any of the numbers
in prime_low[] should be three times
higher than the probability of s1 being any of the
numbers in prime_high[].
roll that will randomly pick a number
between 1 and 4 and then return the value of the corresponding side
(s1-s4).
PrimeDie4, you roll that die 5 times
and output the result (e.g., "Rolled a 3").
Due by the end of the deadline day, submit your solutions (e.g., EDA Playground URLs, text) in the provided text file hw6.txt (files) to .
packet_buf implementation (part g)c_uniq,
c_bad, s1-s4
roll method implemented