Академический Документы
Профессиональный Документы
Культура Документы
https://verificationacademy.com/forums/systemverilog/help-executing-te...
Search form
Log In (/user/login?destination=forums/systemverilog/help-executing-testbenchin-example)
Topics
Courses
Forums
Cookbooks
Events
Register >
More
SystemVerilog
(/forums/all-topics)
Home (/) / Forums (/forums) / SystemVerilog (/forums/systemverilog) / Help with executing testbench.in example
1099 (/forums/systemverilog)
Hi mates,
MichiDresden
Forum Access
1 post
I study computer science and therefore I want to look at SystemVerilog with QuestaSim cause I know
VHDL/Verilog/SystemC very well.
My problem is I found a SV example on testbench.in (http://www.testbench.in
/TS_23_ONES_COUNTER_EXAMPLE.html (http://www.testbench.in
/TS_23_ONES_COUNTER_EXAMPLE.html)) with all *.sv-files but they don't compile without errors in
QuestaSim.
The toplevels 'monitor', 'driver' and 'environment' don't have access to the lower classes 'scoreboard' and
'stimulus'.
Error message: Invalid type 'xx'. Please check the type of the variable 'xx'.
Maybe you guys could help me, I would be very grateful :)
Answers
Order by:
dave_59
Forum
Moderator
1915 posts
may be problems with the way you are compiling the code because the example does not use packages.
(https://verificationacademy.com
/forums/systemverilog/helpexample#answer-40087)
1 of 2
There are a number of problems with this example. There are a few illegal constructs in the code, and there
executing-testbenchin-
Newest Last
The interface declaration declares clk twice. Once as a port, and a second time internal to the interface.
Verilog has two styles of port declarations: 1) an older style where you just list the names of ports in a list,
and then you declare the port direction inside the module/interface, and a third time inside to declare its type.
2) A newer stle (called ANSI) where you declare the port direction, type, and name inside the port list. You
cannot mix the two styles.
Another problem is that the the driver class is trying to make procedural assignments to the wires in the
interface. That is illegal, you can only make procedural assignments to variables. See http://go.mentor.com
/wire-vs-reg (http://go.mentor.com/wire-vs-reg) So the interface should look like
17-06-2015 PM 06:48
https://verificationacademy.com/forums/systemverilog/help-executing-te...
There is also a problem with the way the environment class is constructed in the test. The constructor
contains a fork/join_none block that spawns a thread and the constructor is called as part of a static
initialization declaration. That is illegal because you can only spawn threads from threads created by initial or
always blocks. So you need to remove the static initialization (a good rule to follow in any case because of
potential races between static initializations) and call the constructor inside the initial block.
Finally, SystemVerilog has the concept of compilation units (http://go.mentor.com/unit-vs-root). When you
compile a class in a separately from another class, is no data type visibility between the two compilations
unless you use a package. So you must compile this example as one concatenated file, or one file that
`includes all the other files. Some simulators treat all files on a single command line as if they were written as
a single file, but Questa does not do that by default.
- Dave Rich (http://go.mentor.com/drich)
2 of 2
17-06-2015 PM 06:48