Verification Academy

Search form

My Account Menu

  • Register
  • Log In
  • Topics
  • Courses
  • Forums
  • Patterns Library
  • Cookbooks
  • Events
  • More
  • All Topics
    The Verification Academy offers users multiple entry points to find the information they need. One of these entry points is through Topic collections. These topics are industry standards that all design and verification engineers should recognize. While we continue to add new topics, users are encourage to further refine collection information to meet their specific interests.
    • Languages & Standards

      • Portable Test and Stimulus
      • Functional Safety
      • Design & Verification Languages
    • Methodologies

      • UVM - Universal Verification Methodology
      • UVM Framework
      • UVM Connect
      • FPGA Verification
      • Coverage
    • Techniques & Tools

      • Verification IP
      • Simulation-Based Techniques
      • Planning, Measurement, and Analysis
      • Formal-Based Techniques
      • Debug
      • Clock-Domain Crossing
      • Acceleration
  • All Courses
    The Verification Academy is organized into a collection of free online courses, focusing on various key aspects of advanced functional verification. Each course consists of multiple sessions—allowing the participant to pick and choose specific topics of interest, as well as revisit any specific topics for future reference. After completing a specific course, the participant should be armed with enough knowledge to then understand the necessary steps required for maturing their own organization’s skills and infrastructure on the specific topic of interest. The Verification Academy will provide you with a unique opportunity to develop an understanding of how to mature your organization’s processes so that you can then reap the benefits that advanced functional verification offers.
    • Universal Verification Methodology (UVM)

      • Advanced UVM
      • Basic UVM
      • Introduction to UVM
      • UVM Connect
      • UVM Debug
      • UVMF - One Bite at a Time
    • Featured Courses

      • Introduction to ISO 26262
      • Introduction to DO-254
      • Clock-Domain Crossing Verification
      • Portable Stimulus Basics
      • Power Aware CDC Verification
      • Power Aware Verification
      • SystemVerilog OOP for UVM Verification
    • Additional Courses

      • Assertion-Based Verification
      • An Introduction to Unit Testing with SVUnit
      • Evolving FPGA Verification Capabilities
      • Metrics in SoC Verification
      • SystemVerilog Testbench Acceleration
      • Testbench Co-Emulation: SystemC & TLM-2.0
      • Verification Planning and Management
      • VHDL-2008 Why It Matters
    • Formal-Based Techniques

      • Formal Assertion-Based Verification
      • Formal-Based Technology: Automatic Formal Solutions
      • Formal Coverage
      • Getting Started with Formal-Based Technology
      • Handling Inconclusive Assertions in Formal Verification
      • Sequential Logic Equivalence Checking
    • Analog/Mixed Signal

      • AMS Design Configuration Schemes
      • Improve AMS Verification Performance
      • Improve AMS Verification Quality
  • All Forum Topics
    The Verification Community is eager to answer your UVM, SystemVerilog and Coverage related questions. We encourage you to take an active role in the Forums by answering and commenting to any questions that you are able to.
    • UVM Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • UVM Forum
    • SystemVerilog Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • SystemVerilog Forum
    • Coverage Forum

      • Active Questions
      • Solutions
      • Replies
      • No Replies
      • Search
      • Coverage Forum
    • Additional Forums

      • Announcements
      • Downloads
      • OVM Forum
  • Patterns Library
    The Verification Academy Patterns Library contains a collection of solutions to many of today's verification problems. The patterns contained in the library span across the entire domain of verification (i.e., from specification to methodology to implementation—and across multiple verification engines such as formal, simulation, and emulation).
    • Implementation Patterns

      • Environment Patterns
      • Stimulus Patterns
      • Analysis Patterns
      • All Implementation Patterns
    • Specification Patterns

      • Occurrence Property Patterns
      • Order Property Patterns
      • All Specification Patterns
    • Pattern Resources

      • Start Here - Patterns Library Overview
      • Whitepaper - Taking Reuse to the Next Level
      • Verification Horizons - The Verification Academy Patterns Library
      • Contribute a Pattern to the Library
  • All Cookbooks
    Find all the methodology you need in this comprehensive and vast collection. The UVM and Coverage Cookbooks contain dozens of informative, executable articles covering all aspects of UVM and Coverage.
    • UVM Cookbook

      • UVM Basics
      • Testbench Architecture
      • DUT-Testbench Connections
      • Configuring a Test Environment
      • Analysis Components & Techniques
      • End Of Test Mechanisms
      • Sequences
      • The UVM Messaging System
      • Other Stimulus Techniques
      • Register Abstraction Layer
      • Testbench Acceleration through Co-Emulation
      • Debug of SV and UVM
      • UVM Connect - SV-SystemC interoperability
      • UVM Versions and Compatibility
      • UVM Cookbook
    • Coding Guidelines & Deployment

      • Code Examples
      • UVM Verification Component
      • Package/Organization
      • Questa/Compiling UVM
      • SystemVerilog Guidelines
      • SystemVerilog Performance Guidelines
      • UVM Guidelines
      • UVM Performance Guidelines
    • Coverage Cookbook

      • Introduction
      • What is Coverage?
      • Kinds of Coverage
      • Specification to Testplan
      • Testplan to Functional Coverage
      • Bus Protocol Coverage
      • Block Level Coverage
      • Datapath Coverage
      • SoC Coverage Example
      • Requirements Writing Guidelines
      • Coverage Cookbook
  • All Events
    No one argues that the challenges of verification are growing exponentially. What is needed to meet these challenges are tools, methodologies and processes that can help you transform your verification environment. These recorded seminars from Verification Academy trainers and users provide examples for adoption of new technologies and how to evolve your verification process.
    • Upcoming & Featured Events

      • Low Power Verification - 4/29
      • Fault Campaign for Mixed-Signal - 5/4
      • User2User - 5/26
      • Webinar Calendar
    • On-Demand Webinars

      • CDC+RDC Analysis
      • Basic Abstraction Techniques
      • Safety Analysis Techniques
      • QVIP Workflow and Debug for PCIe
      • Writing a Proxy-driven Testbench
      • Achieving High Defect Coverage
      • Visualizer Features
      • All On-Demand Webinars
    • Recording Archive

      • Siemens EDA 2021 Functional Verification Webinar Series
      • Improving Your SystemVerilog & UVM Skills
      • Should I Kill My Formal Run?
      • Visualizer Debug Environment
      • Industry Data & Surveys
      • All Recordings
    • Conferences

      • DVCon 2021
      • DVCon 2020
      • DAC 2019
      • All Conferences
    • Mentor Learning Center

      • SystemVerilog Fundamentals
      • SystemVerilog UVM
      • View all Learning Paths
  • About Verification Academy
    The Verification Academy will provide you with a unique opportunity to develop an understanding of how to mature your organization's processes so that you can then reap the benefits that advanced functional verification offers.
    • Blog & News

      • Verification Horizons Blog
      • Academy News
      • Academy Newsletter
      • Technical Resources
    • Verification Horizons Publication

      • Verification Horizons - March 2021
      • Verification Horizons - November 2020
      • Verification Horizons - July 2020
      • Issue Archive
    • About Us

      • Verification Academy Overview
      • Subject Matter Experts
      • Contact Us
    • Training

      • Questa Basic
      • Questa Advanced
      • Mastering Questa
Ask a Question
UVM
  • Home
  • Forums
  • UVM
  • Error on sequencer - send_request failed to cast sequence item

Error on sequencer - send_request failed to cast sequence item

UVM 5685
#uvm 251 #sequence 22 uvm_fatal 3 casting 4
Jose_Iuri
Jose_Iuri
Full Access
9 posts
October 30, 2019 at 4:07 am

I build a uvm testbench using RAL to understand the concept of the abstraction layer, but when i run the simulation i have a UVM_FATAL at my sequencer.

Quote:
UVM_FATAL @ 10: uvm_test_top.m_env.m_agent.m_seqr [m_seqr] send_request failed to cast sequence item

I try to understand the error and i think is a failing cast operation between the sequence_item and the uvm_reg_bus_op, but i can't fix the error. Some of the code is below and the link to Github containing all code is UVM-APB_RAL

class reg2apb_adapter extends uvm_reg_adapter;
   `uvm_object_utils (reg2apb_adapter)
 
   function new (string name = "reg2apb_adapter");
      super.new (name);
   endfunction
 
   virtual function uvm_sequence_item reg2bus (const ref uvm_reg_bus_op rw);
      apb_tr tr = apb_tr::type_id::create ("tr");
      tr.write = (rw.kind == UVM_WRITE) ? 1: 0;
      tr.addr  = rw.addr;
      tr.data  = rw.data;
      `uvm_info ("adapter", $sformatf ("reg2bus addr=0x%0h data=0x%0h kind=%s", tr.addr, tr.data, rw.kind.name), UVM_DEBUG) 
      return tr; 
   endfunction
 
   virtual function void bus2reg (uvm_sequence_item bus_item, ref uvm_reg_bus_op rw);
      apb_tr tr;
      if (! $cast (tr, bus_item)) begin
         `uvm_fatal ("reg2apb_adapter", "Failed to cast bus_item to tr")
      end
 
      rw.kind = tr.write ? UVM_WRITE : UVM_READ;
      rw.addr = tr.addr;
      rw.data = tr.data;
      `uvm_info ("adapter", $sformatf("bus2reg : addr=0x%0h data=0x%0h kind=%s status=%s", rw.addr, rw.data, rw.kind.name(), rw.status.name()), UVM_DEBUG)
   endfunction
endclass

class traffic_env extends uvm_env;
   `uvm_component_utils (traffic_env)      
 
   ral_block_traffic_cfg          m_ral_model;         // Register Model
   uvm_reg_predictor #(apb_tr)    m_apb2reg_predictor; // Map APB tx to register in model
   apb_agent                      m_agent;             // Agent to drive/monitor transactions
   traffic_scoreboard             m_scoreboard;        // Scoreboard
 
   function new (string name = "traffic_env", uvm_component parent);
      super.new (name, parent);
   endfunction
 
   virtual function void build_phase (uvm_phase phase);
      super.build_phase (phase);
      m_agent = apb_agent::type_id::create ("m_agent", this);
 
      m_ral_model          = ral_block_traffic_cfg::type_id::create ("m_ral_model", this);
      m_ral_model.build();
      m_apb2reg_predictor  = uvm_reg_predictor #(apb_tr)::type_id::create("m_apb2reg_predictor", this);
 
      m_scoreboard = traffic_scoreboard::type_id::create("jb_fc_sub", this );
 
      uvm_config_db #(ral_block_traffic_cfg)::set (null, "uvm_test_top", "m_ral_model", m_ral_model);
 
      uvm_reg::include_coverage ("*", UVM_CVR_ALL);
   endfunction
 
   virtual function void connect_phase (uvm_phase phase);
      super.connect_phase (phase);
 
      m_agent.ag_ap.connect(m_scoreboard.apb_export);
 
      m_ral_model.reg_map.set_auto_predict(0);
      m_ral_model.reg_map.set_sequencer(m_agent.m_seqr, m_agent.reg2apb);
 
      m_apb2reg_predictor.map       = m_ral_model.reg_map;
      m_apb2reg_predictor.adapter   = m_agent.reg2apb;
      m_agent.ag_ap.connect(m_apb2reg_predictor.bus_in);
 
      m_scoreboard.m_ral_model = m_ral_model;
   endfunction
 
endclass

class my_sequence extends uvm_reg_sequence();
   `uvm_object_utils (my_sequence)
 
   function new (string name = "my_sequence");
      super.new (name);
   endfunction
 
   virtual task body ();
 
      ral_block_traffic_cfg    m_ral_model;  
 
      uvm_reg_data_t rdata;
      uvm_status_e   status;
      int            reg_idx = 1;
 
      $cast(m_ral_model, model);
 
      write_reg(m_ral_model.ctrl, status, 32'd3);
      write_reg(m_ral_model.timer[0], status, 32'b00000010000000000000100000000001);
      write_reg(m_ral_model.timer[1], status, 32'd0);
      read_reg(m_ral_model.timer[1], status, rdata );
 
   endtask
endclass

class apb_agent extends uvm_agent;
   `uvm_component_utils (apb_agent)
 
   uvm_analysis_port #(apb_tr) ag_ap;
 
   apb_driver                  m_drvr;
   apb_monitor                 m_mon;
   reg2apb_adapter             reg2apb;
   uvm_sequencer #(apb_tr)     m_seqr; 
 
   function new (string name="apb_agent", uvm_component parent);
      super.new (name, parent);
      ag_ap = new("ag_ap", this);
   endfunction
 
   virtual function void build_phase (uvm_phase phase);
      super.build_phase (phase);
      m_seqr = uvm_sequencer#(apb_tr)::type_id::create ("m_seqr", this);
      m_drvr = apb_driver::type_id::create ("m_drvr", this);
      m_mon = apb_monitor::type_id::create ("m_mon", this);
      reg2apb = reg2apb_adapter::type_id::create("reg2apb", this);
   endfunction
 
   virtual function void connect_phase (uvm_phase phase);
      super.connect_phase (phase);
      m_drvr.seq_item_port.connect(m_seqr.seq_item_export);
      m_mon.mon_ap.connect(ag_ap);
   endfunction
endclass

class base_test extends uvm_test;
   `uvm_component_utils (base_test)
 
   traffic_env             m_env;
   ral_block_traffic_cfg   m_ral_model;
 
   function new (string name = "base_test", uvm_component parent);
      super.new (name, parent);
   endfunction
 
   virtual function void build_phase (uvm_phase phase);
      super.build_phase (phase);
      m_env = traffic_env::type_id::create ("m_env", this);
 
      m_ral_model = ral_block_traffic_cfg::type_id::create("jb_reg_block");
      m_ral_model.build();
 
      m_env.m_ral_model = m_ral_model;
 
//      factory.set_type_override_by_type(ral_sample1::get_type(), my_sample::get_type()); 
//      factory.print();
   endfunction
 
   virtual task reset_phase (uvm_phase phase);
      super.reset_phase (phase);
      phase.raise_objection (this);
      phase.drop_objection (this);
   endtask
 
   virtual task main_phase (uvm_phase phase);
      phase.raise_objection (this);
      phase.drop_objection (this);
   endtask
endclass

Thanks.

Replies

Log In to Reply
chr_sue
chr_sue
Full Access
3327 posts
October 30, 2019 at 6:26 am

In reply to Jose_Iuri:

The interesting thing is your register adapter does not appear in the object browser. I did not investigate the whole code, but this is what I see when compiling your code after fixing a few weaknesses.

Jose_Iuri
Jose_Iuri
Full Access
9 posts
October 30, 2019 at 11:11 am

In reply to chr_sue:

Quote:
In reply to Jose_Iuri:

The interesting thing is your register adapter does not appear in the object browser. I did not investigate the whole code, but this is what I see when compiling your code after fixing a few weaknesses.

Thanks for looking. I double checked the adapter instantiation and connections and seems to me is all right. I can't find any errors. Thanks for your support.

chr_sue
chr_sue
Full Access
3327 posts
October 31, 2019 at 12:51 am

In reply to Jose_Iuri:

I had a deeper look to your code. You are constructing 2 objects of your RAL model, 1 in your env and the other one in your base test. You have to have only 1 object of your RAL model.

chr_sue
chr_sue
Full Access
3327 posts
October 31, 2019 at 5:16 am

In reply to chr_sue:

I was uploading to the github a running examplse. It has still a few weaknesses.

Jose_Iuri
Jose_Iuri
Full Access
9 posts
October 31, 2019 at 5:51 am

In reply to chr_sue:

Quote:
In reply to chr_sue:

I was uploading to the github a running examplse. It has still a few weaknesses.

Thanks a lot, i'll try to understand my mistake. If you can pull request your code i'll appreciate, thanks a lot for the help.

Solution

Solution

chr_sue
chr_sue
Full Access
3327 posts
October 31, 2019 at 7:33 am

In reply to Jose_Iuri:

I'm not so famliar with the github. If you cannot see my solution please respond on my email . Then I'll respond with a zip-file.

Jose_Iuri
Jose_Iuri
Full Access
9 posts
October 31, 2019 at 12:03 pm

In reply to chr_sue:

Quote:
In reply to Jose_Iuri:

I'm not so familiar with the GitHub. If you cannot see my solution please respond on my email . Then I'll respond with a zip-file.

Thanks for your support. I updated the code on Github and added your name as a contributor. I understand my mistake. I passed the handle of my model on the test class and created another on the env class and other minor mistakes.

Thanks a lot.

Siemens Digital Industries Software

Siemens Digital Industries Software

##TodayMeetsTomorrow

Solutions

  • Cloud
  • Mendix
  • Siemens EDA
  • MindSphere
  • Siemens PLM
  • View all portfolio

Explore

  • Digital Journeys
  • Community
  • Blog
  • Online Store

Siemens

  • About Us
  • Careers
  • Events
  • News and Press
  • Newsletter
  • Customer Stories

Contact Us

USA:

phone-office +1 800 547 3000

See our Worldwide Directory

  • Contact Us
  • Support Center
  • Give us Feedback
©2021 Siemens Digital Industries Software. All Rights Reserved.
Terms of Use Privacy Cookie Policy