addressType

The Address Type

There are many choices for encoding address type. Perhaps the most appealing would be to use the "simulation address" of the destination slave (i.e. the address of the instance of the class). However, this approach is limited to systemC simulations, and/or requires extensive translation to and from the simulation address map.

A more simple approach, which is generally adopted, is to simply encode the address that would be send on the real bus.

For the time being, 64bit values are relatively efficiently represented on most platforms, and cover most busses. So, a 64 bit value has been chosen as the representation.

This represents the BYTE address of the access, (no least significant bits are dropped)

As a matter of convenience, and in order to prevent a large amount of run-time type checking that would be required if it was left to the convenience layer to implement, a number of access functions are provided to allow easy use of the address type in an 8, 16 and 32 bit bus simulation.

  1. struct AddrType {
  2.     public:
  3.     uint64 addr;
  4.     AddrType()         {}
  5.     AddrType(uint8  v)  {addr= static_cast<uint64>(v);}
  6.     AddrType(uint16 v)  {addr= static_cast<uint64>(v);}
  7.     AddrType(uint32 v)  {addr= static_cast<uint64>(v);}
  8.     AddrType(uint64 v)  {addr= static_cast<uint64>(v);}
  9.     AddrType(sc_unsigned v)  {addr= v.to_uint64();}
  10.  
  11.   };