*W, ENUMERR This assignment is a violation of SystemVerilog strong typing rules for enumeration datatypes

In reply to dave_59:

Hi Dave,

I changed my code again, this time I only put one typedef on a single package, and then imports
the spi_mode_e on the packages that will use it. But still, I’m having a compile error saying that spi_agent_pkg could not be bound and undeclared identifier to one of the members of enum.


// spi_die_env_pkg
package spi_die_env_pkg;

  import spi_agent_pkg::*; // Since spi_agent_pkg is imported, then typedef enum spi_mode_e is also under the scope of spi_die_env_pkg
  import sw_data_agent_pkg::*;

  // Environment components included here
endpackage : spi_die_env_pkg


`include "spi_if.sv" // Note that this interface is outside the package

package spi_agent_pkg;
  typedef enum {ADDRESSABLE_MODE, ROUND_ROBIN, DAISY_CHAIN} spi_mode_e;

  typedef virtual spi_if spi_vif;

  // spi_agent components included here
endpackage : spi_agent_pkg


`include "sw_data_if.sv" // Note that this interface is outside the package

package sw_data_agent_pkg;
  import spi_agent_pkg::spi_mode_e; // I imported it here to let the components of this agent to see this typedef enum

  typedef virtual sw_data_if sw_data_vif;

  // sw_data_agent components included here
endpackage : sw_data_agent_pkg


// spi_if
interface spi_if();
  import spi_agent_pkg::spi_mode_e;
  
  spi_mode_e spi_mode = ADDRESSABLE_MODE;
endinterface : spi_if


// sw_data_if
interface sw_data_if();
  import spi_agent_pkg::spi_mode_e;
  
  spi_mode_e spi_mode = ADDRESSABLE_MODE;
endinterface : sw_data_if

The compile errors are pointing to spi_if:
import spi_agent_pkg::spi_mode_e;

Error message: Package spi_agent_pkg could not be bound