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

In reply to dave_59:

Hi Dave,

Thanks for the suggestion.
I did some changes on the declaration and the warning has gone. However, there’s a new warning.
It says that “Disallowed virtual interface hierarchical reference object type” pointint to this code in
the scoreboard:


s_vif.spi_mode <= ADDRESSABLE_MODE;

The changes I did are below:


// spi_die_env_pkg
package spi_die_env_pkg;
  typedef enum {ADDRESSABLE_MODE, ROUND_ROBIN, DAISY_CHAIN} spi_mode_e;

  import spi_agent_pkg::*; // spi_if is here and it is using spi_mode_e
  import sw_data_agent_pkg::*; // sw_data_if is here and it is using spi_mode_e

  // 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;
  typedef enum {ADDRESSABLE_MODE, ROUND_ROBIN, DAISY_CHAIN} spi_mode_e;

  typedef virtual sw_data_if sw_data_vif;

  // sw_data_agent components included here
endpackage : sw_data_agent_pkg


// spi_if
interface spi_if();
  typedef enum {ADDRESSABLE_MODE, ROUND_ROBIN, DAISY_CHAIN} spi_mode_e;
  
  spi_mode_e spi_mode = ADDRESSABLE_MODE;
endinterface : spi_if


// sw_data_if
interface sw_data_if();
  typedef enum {ADDRESSABLE_MODE, ROUND_ROBIN, DAISY_CHAIN} spi_mode_e;
  
  spi_mode_e spi_mode = ADDRESSABLE_MODE;
endinterface : sw_data_if

If I remove the typedef in the spi_die_env_pkg, I’m having a compile error saying that the scoreboard can’t see spi_mode.
If I remove the typedef in the spi_agent_pkg, I’m having a compile error saying that the monitor can’t see spi_mode.
If I remove the typedef in the interface, I’m having a compile error saying that the interface can’t see spi_mode_e.