# Getting Error: syntax error : unexpected IDENTIFIER

**URL:** <https://verificationacademy.com/forums/t/getting-error-syntax-error-unexpected-identifier/28697>\
**Category:** OVM\
**Tags:** OVM\
**Created:** [July 10, 2013, 5:20am UTC](https://verificationacademy.com/forums/t/getting-error-syntax-error-unexpected-identifier/28697 "2013-07-10T05:20:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![San1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/779978/32.png) [@San1](https://verificationacademy.com/forums/u/San1)\
**Post date:** [July 10, 2013, 5:20am UTC](https://verificationacademy.com/forums/t/getting-error-syntax-error-unexpected-identifier/28697/1 "2013-07-10T05:20:45Z")

</div>

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](http://www.testbench.in/OT_02_OVM_TESTBENCH.html) (ovm\_phases.tar)

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

Appreciate a quick response

Regards,  
Sandhya

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [July 10, 2013, 10:11pm UTC](https://verificationacademy.com/forums/t/getting-error-syntax-error-unexpected-identifier/28697/2 "2013-07-10T22:11:51Z")

</div>

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

```auto
`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

> **[SystemVerilog Coding Guidelines: Package import versus \`include -...](https://blogs.sw.siemens.com/verificationhorizons/2010/07/13/package-import-versus-include/)**
>
> Another frequently asked question: Should I import my classes from a package or \`include them? To answer this properly, you need to know more about

> **[Verification Horizons - Siemens Software](https://blogs.sw.siemens.com/verificationhorizons/)**
>
> Siemens Software

---

<div class="post-metadata">

**Author:** ![San1](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/s/779978/32.png) [@San1](https://verificationacademy.com/forums/u/San1)\
**Post date:** [July 11, 2013, 4:50am UTC](https://verificationacademy.com/forums/t/getting-error-syntax-error-unexpected-identifier/28697/3 "2013-07-11T04:50:48Z")

</div>

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