Agent code error

The link contains a code I started to write for a sequence detector, but I’m not able to figure out how to deal with the errors.

Thank You

In reply to Lucifer_morn:

The problem was happened because the file “seq_agent.sv” was compiled multiple times.
To avoid it, please use as following macro:


`ifndef _SEQ_AGENT__SV_
`define _SEQ_AGENT__SV_

class seq_agent extends uvm_agent;
...
endclass
`endif

In reply to chris90:

That is not the correct way to prevent this error. The correct way is to use SV Packages.


package agent_pkg;
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  `include "seq_item.sv"
  `include "seq_driver.sv"
  `include "seq_monitor.sv"
  `include "seq_agent.sv"
endpackage

Then you should import agent_pkg where required.

See this article for more information.

In reply to Lucifer_morn:

Update your package with the files mentioned
package seq_pkg;
import uvm_pkg::*;
include "uvm_macros.svh" include “seq_item.sv”
include "seq_sequence.sv" include “seq_driver.sv”
include "seq_sequencer.sv" include “seq_monitor.sv”
include "seq_agent.sv" include “seq_env.sv”
`include “seq_top.sv”
endpackage

Find the error free code - > UVM sequence detector(1) - EDA Playground