Getting Error: syntax error : unexpected IDENTIFIER

Hi,

This is the first time I am running an OVM test case using questasim. I see the below error when running the vlog command :

qvlog +incdir+$OVM_HOME/src+incdir+.$OVM_HOME/src/ovm_pkg.sv -f filelist +OVM_TESTNAME=test1

###############
rning: /tools/apps/mentor/questasim_10.2a/questasim/verilog_src/ovm-2.1.2/src/base/ovm_component.sv(1397): (vlog-2283) Extra semicolon in $unit (global) scope.
** Warning: /tools/apps/mentor/questasim_10.2a/questasim/verilog_src/ovm-2.1.2/src/methodology/sequences/ovm_sequencer.svh(600): (vlog-2283) Extra semicolon in $unit (global) scope.
** Warning: /tools/apps/mentor/questasim_10.2a/questasim/verilog_src/ovm-2.1.2/src/methodology/sequences/ovm_sequence.svh(150): (vlog-2283) Extra semicolon in $unit (global) scope.
– Compiling package top_sv_unit
– Importing package ovm_pkg (ovm-2.1.2 Built-in)
– Compiling module top
** Error: driver.sv(10): near “ovm_driver”: syntax error, unexpected IDENTIFIER
** Error: driver.sv(10): Error in class extension specification.
** Error: monitor.sv(19): near “ovm_monitor”: syntax error, unexpected IDENTIFIER
** Error: monitor.sv(19): Error in class extension specification.
** Error: agent.sv(28): near “ovm_agent”: syntax error, unexpected IDENTIFIER
** Error: agent.sv(28): Error in class extension specification.
** Error: env.sv(38): near “ovm_env”: syntax error, unexpected IDENTIFIER
** Error: env.sv(38): Error in class extension specification.
** Error: test.sv(47): near “ovm_test”: syntax error, unexpected IDENTIFIER
** Error: test.sv(47): Error in class extension specification.
##################################

The test case I am running is obtained from:

WWW.TESTBENCH.IN - OVM Tutorial (ovm_phases.tar)

Could you please guide me on how to get around these errors.

Appreciate a quick response

Regards,
Sandhya

There are a number of problems with the compilation setup of this example

  1. top.sv should not `include “ovm.svh” ovm.svh is the contents of the ovm_package without the package declaration. No one should ever compile that file directly unless they are in a situation that does not allow package, which is for all practical purposes - never.
  2. ovm_pkg.sv is the file that has the package declaration and it includes "ovm.svh". There is no need to include this file or put it on the command line because most simulators provide a pre-built package for you. You only need to do this if you modify the OVM base class library, or need to use a version that is not supplied.
  3. You do need to include "ovm_macros.svh" when using OVM macros such as ovm_component_utils. Macros do not belong to any scope, such as package. The are put through a preprocessor before compilation of the SV source.
  4. All of the class declarations should be in a package like
`include "ovm_macros.svh"
package mytest;
import ovm_pkg::*;
`include "driver.svh"
`include "monitor.svh"
...
endpackage

Then module top should import the package mytest
When you don’t use packages, every file on the Questa command line is a separate compilation unit and the classes and macros defined in one unit are not visible in another compilation unit.

You may want to see the following links

Dave,
Thanks a ton for the detailed explanation!! Now I am able to run this test.
-San