non-intrusive tlm-2.0 transaction observation, [-.2em ... · a new pair (initiator, target) of...
TRANSCRIPT
I Non-intrusive TLM-2.0 Transaction Observation,Interception, and Augmentation
Philipp A. Hartmann, Maher A. Fakih,
Kim GrüttnerOFFIS Institute for Information TechnologyR&D Division Transportation
September 13th, 2011
24th European SystemC User’s Group MeetingOldenburg, Germany
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 1 Motivation
I Especially in case of immutable third-party TLM-2.0 IP components,wrappers are frequently needed in various scenariosI transaction tracing/recording (already supported by many EDA tools)I protocol and constraint observersI platform integration, non-intrusive feature augmentation
I Building TLM-2.0 wrapper components requires a lot of boiler-plate codeI two additional sockets, including their bindingI forwarding of all TLM-2.0 FW/BW interface calls, even if no functionality is added
I Proposed solution: TLM Observable Sockets
A new pair (initiator, target) of convenience sockets to simplify transaction
forwarding with support for user-defined introspection and manipulation.
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 1 Motivation
I Especially in case of immutable third-party TLM-2.0 IP components,wrappers are frequently needed in various scenariosI transaction tracing/recording (already supported by many EDA tools)I protocol and constraint observersI platform integration, non-intrusive feature augmentation
I Building TLM-2.0 wrapper components requires a lot of boiler-plate codeI two additional sockets, including their bindingI forwarding of all TLM-2.0 FW/BW interface calls, even if no functionality is added
I Proposed solution: TLM Observable Sockets
A new pair (initiator, target) of convenience sockets to simplify transaction
forwarding with support for user-defined introspection and manipulation.
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 2 Outline
1 TLM Observable Sockets
2 Example use cases
3 Limitations & Possible Extensions
4 Conclusion
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 3 OutlineTLM Observable Sockets
1 TLM Observable Sockets
Introduction
Observer infrastructure
Transaction forwarding & management
2 Example use cases
3 Limitations & Possible Extensions
4 Conclusion
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 4 TLM Observable SocketsIntroduction
I Manual implementation either based onI explicit initiator/target socket pair for
forwarding and internal observationI or single socket (mainly for BW path) and
forwarding/manipulation within wrapper
I Multiple sockets require bookkeeping,
multi-sockets complex to support
I Proposed solution
Wrapper
IP Component
Manual forwarding& Introspection
I Two new convenience socket typesI tlm_utils::tlm_observable_initiator_socket<BUSWIDTH>I tlm_utils::tlm_observable_target_socket<BUSWIDTH>
I Builtin support for base-protocol forwarding (LT/AT)
I Additional utility classes for transaction management, observer infrastructure
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 4 TLM Observable SocketsIntroduction
I Manual implementation either based onI explicit initiator/target socket pair for
forwarding and internal observationI or single socket (mainly for BW path) and
forwarding/manipulation within wrapper
I Multiple sockets require bookkeeping,
multi-sockets complex to support
I Proposed solution
Wrapper
IP ComponentBP
BP
BP
BP
TxnMgmnt
I Two new convenience socket typesI tlm_utils::tlm_observable_initiator_socket<BUSWIDTH>I tlm_utils::tlm_observable_target_socket<BUSWIDTH>
I Builtin support for base-protocol forwarding (LT/AT)
I Additional utility classes for transaction management, observer infrastructure
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 5 Basic class structureTLM Observable Sockets
I Observable sockets are derived
from standard TLM-2.0 sockets
(with configurable bitwidth)
I Transparent support for multi-sockets
→ individual bindings are forwarded,
internal infrastructure built on-demand
I Based on pair of initiator/target socket
pair, as in manual implementation
I GoF observer pattern for introspectionI attach(), detach()I notify()
tlm_target_socket tlm_initiator_socket
tlm_observable_initiator_socket
tlm_observable_target_socket
(template parameters omitted for clarity)
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 5 Basic class structureTLM Observable Sockets
I Observable sockets are derived
from standard TLM-2.0 sockets
(with configurable bitwidth)
I Transparent support for multi-sockets
→ individual bindings are forwarded,
internal infrastructure built on-demand
I Based on pair of initiator/target socket
pair, as in manual implementation
I GoF observer pattern for introspectionI attach(), detach()I notify()
tlm_target_socket tlm_initiator_socket
tlm_observable_initiator_socket
tlm_observable_target_socket
tlm_observable_if
attach()detach()
tlm_observable_socket
initiator_socket()target_socket()observed_socket()
(template parameters omitted for clarity)
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 6 Observer infrastructure(I)TLM Observable Sockets
I Observers provide a notify callback, invoked by the originating socket
upon a matching notification maskvirtual bool // continue notification/forwarding?notify( tlm_observable_socket& from // source of notification
, tlm_notify_mask m // triggering timing point, tlm_transaction_info & txn ); // extended transaction info
I Notification bitmask tlm_notify_mask enables filtering of
different TLM-2.0 base-protocol timing pointsenum tlm_notify_mask { TLM_NOTIFY_NONE, TLM_NOTIFY_ALL,TLM_NOTIFY_BEGIN, // phase selectorsTLM_NOTIFY_COMPLETED, TLM_NOTIFY_BEGIN_REQ, TLM_NOTIFY_END_REQ,TLM_NOTIFY_AROUND, TLM_NOTIFY_BEGIN_RESP, TLM_NOTIFY_END_RESP,
TLM_NOTIFY_EXTENDED, TLM_NOTIFY_BLOCKING,TLM_NOTIFY_CALL,TLM_NOTIFY_RETURN, TLM_NOTIFY_DMI };
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 6 Observer infrastructure(I)TLM Observable Sockets
I Observers provide a notify callback, invoked by the originating socket
upon a matching notification maskvirtual bool // continue notification/forwarding?notify( tlm_observable_socket& from // source of notification
, tlm_notify_mask m // triggering timing point, tlm_transaction_info & txn ); // extended transaction info
I Notification bitmask tlm_notify_mask enables filtering of
different TLM-2.0 base-protocol timing pointsenum tlm_notify_mask { TLM_NOTIFY_NONE, TLM_NOTIFY_ALL,TLM_NOTIFY_BEGIN, // phase selectorsTLM_NOTIFY_COMPLETED, TLM_NOTIFY_BEGIN_REQ, TLM_NOTIFY_END_REQ,TLM_NOTIFY_AROUND, TLM_NOTIFY_BEGIN_RESP, TLM_NOTIFY_END_RESP,
TLM_NOTIFY_EXTENDED, TLM_NOTIFY_BLOCKING,TLM_NOTIFY_CALL,TLM_NOTIFY_RETURN, TLM_NOTIFY_DMI };
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 7 Observer infrastructure(II)TLM Observable Sockets
I Observers (inheriting from tlm_transaction_observer) can be
attached and detached during run-timebool attach( tlm_transaction_observer& ); // TLM_NOTIFY_AROUND
virtual bool attach( tlm_notify_mask, tlm_transaction_observer& );
bool detach( tlm_transaction_observer& ); // TLM_NOTIFY_ALLvirtual bool detach( tlm_notify_mask, tlm_transaction_observer& );
I For arbitrary observer types/functions, template versions for
callback (de)registration are providedtypedef bool tlm_notify_callback // callback signature( tlm_observable_socket&, tlm_notify_mask, tlm_transaction_info & );
template< typename T>bool attach( tlm_notify_mask, T&, tlm_notify_callback (T::*cb) );
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 7 Observer infrastructure(II)TLM Observable Sockets
I Observers (inheriting from tlm_transaction_observer) can be
attached and detached during run-timebool attach( tlm_transaction_observer& ); // TLM_NOTIFY_AROUND
virtual bool attach( tlm_notify_mask, tlm_transaction_observer& );
bool detach( tlm_transaction_observer& ); // TLM_NOTIFY_ALLvirtual bool detach( tlm_notify_mask, tlm_transaction_observer& );
I For arbitrary observer types/functions, template versions for
callback (de)registration are providedtypedef bool tlm_notify_callback // callback signature( tlm_observable_socket&, tlm_notify_mask, tlm_transaction_info & );
template< typename T>bool attach( tlm_notify_mask, T&, tlm_notify_callback (T::*cb) );
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 8 Transaction forwarding & managementTLM Observable Sockets
I Automatic relay of all forward and backward calls along the transaction path
I Observer hooks before and after the relayed call1 store transaction in local pool of active transactions2 prepare notification mask and send notifications to observers3 relay call to destination socket (and update info afterwards)
4 iff transaction is intercepted by an observer,skip remaining notifications and relay
5 send notifications to observers in reverse order6 cleanup transaction info, iff transaction has completed
I tlm_transaction_info holds (local) information aboutI source and/or destination socketI payload, phase, and delay (can be updated)I automatically managed and pooled
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 8 Transaction forwarding & managementTLM Observable Sockets
I Automatic relay of all forward and backward calls along the transaction path
I Observer hooks before and after the relayed call1 store transaction in local pool of active transactions2 prepare notification mask and send notifications to observers3 relay call to destination socket (and update info afterwards)4 iff transaction is intercepted by an observer,
skip remaining notifications and relay5 send notifications to observers in reverse order6 cleanup transaction info, iff transaction has completed
I tlm_transaction_info holds (local) information aboutI source and/or destination socketI payload, phase, and delay (can be updated)I automatically managed and pooled
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 8 Transaction forwarding & managementTLM Observable Sockets
I Automatic relay of all forward and backward calls along the transaction path
I Observer hooks before and after the relayed call1 store transaction in local pool of active transactions2 prepare notification mask and send notifications to observers3 relay call to destination socket (and update info afterwards)4 iff transaction is intercepted by an observer,
skip remaining notifications and relay5 send notifications to observers in reverse order6 cleanup transaction info, iff transaction has completed
I tlm_transaction_info holds (local) information aboutI source and/or destination socketI payload, phase, and delay (can be updated)I automatically managed and pooled
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 9 OutlineExample use cases
1 TLM Observable Sockets
2 Example use cases
Direct-Memory Access & Endianness
Timing observation
Power management: power/clock gating
3 Limitations & Possible Extensions
4 Conclusion
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 10 Disabling Direct-Memory AccessExample use cases
I Cancel all DMI requests on am observed target socketvirtual boolnotify( tlm_observable_socket&, tlm_notify_mask m, tlm_transaction_info & txn ) {
if( m & TLM_NOTIFY_DMI ) { // within get_direct_mem_ptrtlm_dmi& dmi = *txn.dmi();dmi.set_start_address(0); dmi.set_end_address(~0ULL);return false; // abort request
}txn.payload().set_dmi_allowed( false ); // within a transport callreturn true; // continue transaction
}
I Since this is a frequent requirement, especially when augmenting a component’s
behaviour, this is already supported by tlm_observable_socket
void inhibit_dmi( bool yesno ); // default − false
I When activated, builtin functionality invalidates DMI pointers as well
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 10 Disabling Direct-Memory AccessExample use cases
I Cancel all DMI requests on am observed target socketvirtual boolnotify( tlm_observable_socket&, tlm_notify_mask m, tlm_transaction_info & txn ) {
if( m & TLM_NOTIFY_DMI ) { // within get_direct_mem_ptrtlm_dmi& dmi = *txn.dmi();dmi.set_start_address(0); dmi.set_end_address(~0ULL);return false; // abort request
}txn.payload().set_dmi_allowed( false ); // within a transport callreturn true; // continue transaction
}
I Since this is a frequent requirement, especially when augmenting a component’s
behaviour, this is already supported by tlm_observable_socket
void inhibit_dmi( bool yesno ); // default − false
I When activated, builtin functionality invalidates DMI pointers as well
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 11 Adding Endianness ConversionExample use cases
I Assuming an initiator with internal endianness different from the host’s
endianness, but without support for endianness conversion
I Adding (word-only) endianness conversion1 byvirtual boolnotify( tlm_observable_socket& s, tlm_notify_mask m, tlm_transaction_info & txn ) {
if( m & TLM_NOTIFY_BEGIN ) { // start of transactiontlm_to_hostendian_generic<unsigned> ( txn.payload(), s.buswidth() );
} else { // end of transactiontlm_from_hostendian_generic<unsigned>( txn.payload(), s.buswidth() );
}return true; // continue transaction
}
I Attach observer with default notification mask
TLM_NOTIFY_AROUND == TLM_NOTIFY_BEGIN | TLM_NOTIFY_COMPLETED
1shorter datatypes not covered here!
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 12 Timing observationExample use cases
I A multi-core architecture for real-time applications needs to provide a predictable
on-chip interconnect infrastructure with guaranteed maximum latencies
I A simple arbitration delay observer can be attached to an AT interconnectinitiator.attach( TLM_NOTIFY_BEGIN_REQ, *this );
I Checking the forwarded transaction on the outgoing initiator socket is sufficient,
due to the automatic local transaction managementvirtual boolnotify( tlm_observable_socket&, tlm_notify_mask, tlm_transaction_info & txn ) {
if( txn.last_update() > max_arbitration_delay )SC_REPORT_ERROR( ... );
return true;}
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 13 Power management: power/clock gatingExample use cases
I Externally adding support for clock/power gating to a component requires correct
use (rather non-use) of switched-off parts
I Different approaches possible, depending on the applicationvirtual boolnotify( /∗ ... ∗/ ) {
if( is_disabled( txn.start() ) ) { // component is still disabledif( wakeup_time() == sc_max_time() ) {
// report an errortxn.set_response_status( TLM_COMMAND_ERROR_RESPONSE );txn.complete();return false;
}// add delay to transactiontxn.delay( wakeup_time()-txn.start() );
}return true;
}
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 14 OutlineLimitations & Possible Extensions
1 TLM Observable Sockets
2 Example use cases
3 Limitations & Possible Extensions
Hierarchical binding
Support for custom protocols
4 Conclusion
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 15 Limitations & Possible Extensions
I Hierarchical binding of multi-sockets not yet supportedI multi-sockets use dedicated overloads for hierarchical bindI transparent socket binding is not explicitly multi-socket awareI required overloads could be added for TLM-2.0 convenience multi-sockets
(multi_passthrough_target/initiator_socket)I user-defined sockets based on a similar technique still a problem
I Support for custom phases and protocol types possible?I current approach limited to tlm_generic_payload and TLM-2.0 base-protocolI limited support for extended phases (TLM_NOTIFY_EXTENDED)I forwarding and management code largely independent of protocolI refactoring of the different parts of the implementation→ using policy-based design to separate concerns
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 15 Limitations & Possible Extensions
I Hierarchical binding of multi-sockets not yet supportedI multi-sockets use dedicated overloads for hierarchical bindI transparent socket binding is not explicitly multi-socket awareI required overloads could be added for TLM-2.0 convenience multi-sockets
(multi_passthrough_target/initiator_socket)I user-defined sockets based on a similar technique still a problem
I Support for custom phases and protocol types possible?I current approach limited to tlm_generic_payload and TLM-2.0 base-protocolI limited support for extended phases (TLM_NOTIFY_EXTENDED)I forwarding and management code largely independent of protocolI refactoring of the different parts of the implementation→ using policy-based design to separate concerns
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 16 OutlineConclusion
1 TLM Observable Sockets
2 Example use cases
3 Limitations & Possible Extensions
4 Conclusion
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 17 Conclusion
I New convenience sockets for TLM-2.0 transactionobservation, interception and augmentationI support for tlm_generic_payload and TLM-2.0 base-protocolI automatic/transparent base-protocol implementation,
transaction forwarding, and memory management
I Observation infrastructure, based on LT/AT base-protocol timing pointsI attaching/detaching observers during simulationI modification of payload and timing supported
I Open-source proof-of-concept implementation soon
to be available at http://complex.offis.de
I Submission to OSCI TLM Working Group intended later this year,once IEEE 1666-2011 is releasedI Feedback and discussion welcome!
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 17 Conclusion
I New convenience sockets for TLM-2.0 transactionobservation, interception and augmentationI support for tlm_generic_payload and TLM-2.0 base-protocolI automatic/transparent base-protocol implementation,
transaction forwarding, and memory management
I Observation infrastructure, based on LT/AT base-protocol timing pointsI attaching/detaching observers during simulationI modification of payload and timing supported
I Open-source proof-of-concept implementation soon
to be available at http://complex.offis.de
I Submission to OSCI TLM Working Group intended later this year,once IEEE 1666-2011 is releasedI Feedback and discussion welcome!
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011
I 18
Thanks for your attention!
Questions?
Philipp A. Hartmann TLM-2.0 Transaction Observation, Augmentation, Interception September 13th, 2011