Error near "cfg": syntax error, unexpected IDENTIFIER, expecting ')'. Class or package 'mgc_axi4_v1_0_pkg' not found

Hello, I am compiling thhe UVM testbench and I am getting the following error:

** Error: …/config_policies/top_params_pkg.sv(13): (vlog-13006) Could not find the package (mgc_axi4_v1_0_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.

** Error: (vlog-13069) ** while parsing file included at …/config_policies/top_params_pkg.sv(16)

** at …/config_policies/axi4_master_0_config_policy.svh(10): near “cfg”: syntax error, unexpected IDENTIFIER, expecting ‘)’.

** Error: ** while parsing file included at …/config_policies/top_params_pkg.sv(16)

** at …/config_policies/axi4_master_0_config_policy.svh(18): (vlog-2164) Class or package ‘mgc_axi4_v1_0_pkg’ not found.

** Error: ** while parsing file included at …/config_policies/top_params_pkg.sv(16)

** at …/config_policies/axi4_master_0_config_policy.svh(20): (vlog-2164) Class or package ‘mgc_axi4_v1_0_pkg’ not found.

** Error: (vlog-13069) ** while parsing file included at …/config_policies/top_params_pkg.sv(17)

** at …/config_policies/utmi_utm_device_0_config_policy.svh(10): near “cfg”: syntax error, unexpected IDENTIFIER, expecting ‘)’.

** Error: …/config_policies/top_params_pkg.sv(36): Syntax error: ‘axi4_vip_config’ is not a type.

– Compiling package top_pkg

** Error: top_pkg.sv(11): (vlog-13006) Could not find the package (mgc_axi4_v1_0_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.

** Error: ** while parsing file included at top_pkg.sv(18)

** at top_env_config.svh(12): Invalid type ‘utmi_utm_device_0_cfg_t’. Please check the type of the variable ‘utmi_utm_device_0_cfg’.

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(18)

** at top_env_config.svh(35): near “[”: syntax error, unexpected ‘[’, expecting ‘(’.

** Error: ** while parsing file included at top_pkg.sv(18)

** at top_env_config.svh(36): (vlog-2730) Undefined variable: ‘TESTREGHS_map_entries’.

** Error: ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(14): Invalid type ‘utmi_utm_device_0_agent_t’. Please check the type of the variable ‘utmi_utm_device_0’.

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(41): near “::”: syntax error, unexpected ::, expecting ‘;’.

** Error: ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(44): (vlog-2730) Undefined variable: ‘utmi_utm_device_0’.

** Error: ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(44): (vlog-2164) Class or package ‘utmi_utm_device_0_agent_t’ not found.

** Error: ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(44): (vlog-2730) Undefined variable: ‘utmi_utm_device_0_agent_t’.

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(19)

** at top_env.svh(44): near “::”: syntax error, unexpected ::, expecting ‘;’.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(12): Invalid type ‘utmi_utm_device_0_cfg_t’. Please check the type of the variable ‘utmi_utm_device_0_cfg’.

** Error: ** while parsing file included at top_pkg.sv(21)

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(142): near “::”: syntax error, unexpected ::, expecting ‘;’.

** Error: ** while parsing file included at top_pkg.sv(21)

** Error: ** while parsing file included at top_pkg.sv(21)

** Error: ** while parsing file included at top_pkg.sv(21)

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(147): near “::”: syntax error, unexpected ::.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(149): (vlog-2730) Undefined variable: ‘utmi_utm_device_0_cfg’.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(149): (vlog-2164) Class or package ‘utmi_utm_device_0_cfg_t’ not found.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(149): (vlog-2730) Undefined variable: ‘utmi_utm_device_0_cfg_t’.

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(149): near “::”: syntax error, unexpected ::, expecting ‘;’.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(150): (vlog-2730) Undefined variable: ‘utmi_utm_device_0_bfm_t’.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(154): (vlog-2164) Class or package ‘utmi_utm_device_0_config_policy’ not found.

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(154): Identifier ‘utmi_utm_device_0_config_policy’ is not directly visible.

Found multiple Declaration of ‘utmi_utm_device_0_config_policy’ through wildcard imports from these packages : top_params_pkg, top_params_pkg

** Error: ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(154): Illegal to use typedef “utmi_utm_device_0_config_policy” as a variable.

** Error: (vlog-13069) ** while parsing file included at top_pkg.sv(21)

** at top_test_base.svh(154): near “::”: syntax error, unexpected ::.

** Error: (vlog-13069) …/config_policies/top_params_pkg.sv(36): near “(”: syntax error, unexpected ‘(’, expecting class.

– Compiling module hvl_top

** Error: ** while parsing file included at hvl_top.sv(10)

** at test_packages.svh(8): (vlog-13006) Could not find the package (top_pkg). Design read will continue, but expect a cascade of errors after this failure. Furthermore if you experience a vopt-7 error immediately before this error then please check the package names or the library search paths on the command line.

I have checked the file but I did not find any mistake. Am I missing something? Could you please give me any suggestion??

Thank you

In reply to Sangeetha N:

As the first error message states, work on correcting the first error before looking at anything else.

In reply to dave_59:

The first error message indicates of “not finding the package (mgc_axi4_v1_0_pkg).”

  1. I tried including the correct path name for this file. It did not work out though.
  2. I tried copying this package from source file to project file (where I am simulating the code).

The error got fixed while I did the 2nd method. Thanks, Dave sir!

In reply to Sangeetha N:

What you have might be a workaround, but it is never a solution. If the package mgc_axi4_v1_0_pkg is in a different file you have to compile this file. Then the package is available in your compiled library.

In reply to dave_59:

I fixed a few errors and now I am getting this:

** at …/config_policies/axi4_master_0_config_policy.svh(11): near “class”: syntax error, unexpected class.

** Error: ** while parsing file included at …/config_policies/top_params_pkg.sv(19)

** at …/config_policies/axi4_master_0_config_policy.svh(28): (vlog-2164) Class or package ‘mgc_axi4_v1_0_pkg’ not found.

** at …/config_policies/axi4_master_0_config_policy.svh(163): near “endclass”: syntax error, unexpected endclass, expecting class.

** at top_env_config.svh(12): Invalid type ‘utmi_utm_device_0_cfg_t’. Please check the type of the variable ‘utmi_utm_device_0_cfg’.

** at top_env.svh(44): near “::”: syntax error, unexpected ::, expecting ‘;’.

** at top_test_base.svh(12): Invalid type ‘utmi_utm_device_0_cfg_t’. Please check the type of the variable ‘utmi_utm_device_0_cfg’.

** at …/config_policies/axi4_master_0_config_policy.svh(163): near “:”: syntax error, unexpected ‘:’, expecting class.

/edatools/Questasim_2019.2/questasim/linux_x86_64/vlog failed.

Can you suggest what can be done?