Jump to content

In [uvm-systemc-1.0-beta5] the example code for UBUS does not work at all memory locations.


Recommended Posts

Scott Peimann and I were working with uvm-systemc-1.0-beta5 examples,(UBUS) and observed a possible issue.

The code only works if an address is within the slave[0] with slave[0-3] defined.

File:

uvm-systemc-1.0-beta5\examples\uvmsc\integrated\ubus\vip\ubus_bus_monitor.cpp

 

Area of concern:

void ubus_bus_monitor::check_which_slave()

 

Original Code:

  std::string slave_name;

  bool slave_found = false;

 

  slave_addr_map_it it = slave_addr_map.begin();

  slave_name = it->first;

  if(!slave_name.empty())

  {

    do

    {

      if ( (slave_addr_map[slave_name]->get_min_addr() <= trans_collected.addr)

          && (trans_collected.addr <= slave_addr_map[slave_name]->get_max_addr() ) )

      {

        trans_collected.slave = slave_name;

        slave_found = true;

      }

      if (slave_found) break;

      it++;

    }

    while (it != slave_addr_map.end());

    assert(slave_found);

  }

  else

  {

    std::ostringstream msg;

    msg << "Master attempted a transfer at illegal address 0x"

        << std::hex << trans_collected.addr.to_uint64();

    UVM_ERROR(get_type_name(), msg.str());

  }

 

Suggested Code:

  bool slave_found = false;

  auto trans_addr = trans_collected.addr;

 

  for  (auto const &[name, slave]: slave_addr_map)

  {

    if  ((slave->get_min_addr() <= trans_addr)  and

         (trans_addr <= slave->get_max_addr()))

    {

      slave_found = true;

      break;

    }

  }

 

  if  (not slave_found)

  {

    std::ostringstream msg;

    msg

      << "Master attempted a transfer at illegal address 0x"

      << std::hex << trans_collected.addr.to_uint64();

    UVM_ERROR(get_type_name(), msg.str());

  }

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...