This invention relates to event monitoring, and particularly to monitoring events in a hardware interface.
Event monitoring is a well-known technique used when testing a device.
As used herein, an “interface event” is an event occurring in an interface 16 in association with DUT 10. A “public event” is a notification by the monitor of an interface event. For example, a rising edge of a pulse signal in the bus interface might be an interface event which a public event (notification) might be invoked. A “public data structure” denotes a data structure from the monitor associated with an interface event. For example, a monitor monitoring messages on a read/write interface might identify whether the interface message is a read or a write message, its address and data. The public data structure describes the nature of the interface event. A “public method” is a predetermined procedure provided by a monitor for use by a reference model.
There are two principal approaches to monitoring DUT 10 and interface 16. In a first approach, the monitor 14 that is watching interface 16 creates a public event and a public data structure upon sensing an interface event being monitored. Each reference model 12 that has a pointer to monitor 14 responds to the public event (that an interface event has occurred) to create a mirror event that mirrors the interface event. When the reference model's mirror event occurs, the reference model copies the public data structure from the monitor to its own area and uses the public data structure to either predict or check the behavior of DUT 10.
The second approach is slightly different from the first. As in the first approach, each reference model 12 that has a pointer to the monitor 14 creates a mirror event that mirrors the interface event. When the interface event occurs, the mirror event in the reference model occurs and the reference model calls a public method in the monitor to retrieve the data structure associated with the event to predict or check the DUT's behavior.
There are several disadvantages to these prior approaches and there are also problems that these approaches do not solve well.
The first approach disregards data encapsulation which is a fundamental feature in Object Oriented Programming (OOP). In OOP, an object should not expose its internal data for other objects to directly access. Otherwise, there is a risk of data corruption. Instead, in OOP, methods should be provided to access the data without exposing internal data to other objects. Encapsulation maximizes reusability and eliminates possible erroneous modifications of an object's internal data structures.
Another problem with these approaches is that the reference model might inadvertently sample the monitor's data structure when it is not valid. The data structure is often valid only on the clock cycle (tick) during which the event occurs. However, prior monitoring techniques do not strictly enforce that condition.
In both of the prior approaches, multiple events during the same simulation tick could cause data structures to be overwritten before they are sampled, thereby causing a loss of data. Moreover, both approaches create an extra event which could lead to reduced performance in simulation. Also, both approaches have problems scaling if a reference model is listening to the same event from a list of monitors where the list is not a determinable size.
The present invention standardizes a manner in which interface monitors can notify a reference model that an interface event has occurred on a hardware interface, and is applicable to more general cases where any unit or struct (string of code) needs to be notified about events detected by another unit or struct.
In a first embodiment of the invention, data concerning an occurrence of an interface event affecting a device is interpreted by a reference model. The reference model is configured to like inherit at least a portion of the monitor. The monitor is operated to detect the occurrence of the interface event and supplies data to the reference model concerning the occurrence of the interface event. The supplied data has a structure defined by the monitor. The data is re-formatted for interpretation by the reference model.
In some embodiments, the reference model is registered with the monitor on request from the reference model. A listener interface is established by the monitor, and a listener is configured to like inherit from the listener interface. A pointer is entered to a list accessible to the monitor.
Preferably, each listener includes an event handler. On detection of an interface event, the monitor generates a data structure for all listeners, and the respective event handlers generate private data structures for the respective reference models.
A given monitor may notify each of a plurality of reference models of the occurrence of a given interface event through respective pointers and listeners. A given reference model may include a plurality of listeners associated with each of a plurality of monitors, each listener being of like inheritance to the respective listener interface.
In other embodiments, a computer readable program comprises computer readable code that is stored in the monitor and reference model to carry out the process.
Each listener entry 24 is associated with a respective listener 28 in a reference model 26 to provide a data structure to the respective reference model, the data structure being associated with an interface event monitored by the monitor. Monitor 22 monitors interface events on a respective bus interface 16 coupled to a device under test 10 (
When a reference model is registered with a monitor, its listener 28 is derived from the listener interface in transactor 18 (
Initially, the list of listener entries 24 in monitor 22 is empty. A public method in monitor 22 permits reference models 26 to register a respective listener 28 to the list 30 of listener entries 24. Another public method permits any registered reference model to de-register its listener 28 by removing the respective listener entry 24 from list 30. When a reference model 26 desires to register its listener 28 to the list of listener entries 24, the reference model uses the public methods in monitor 22 to cause monitor 22 to add a pointer to its listener to list 30 in monitor 22 as a new listener entry 24. Thus, the listener entry 24 is assigned exclusively to the respective reference model.
Upon assignment of a reference model to a listener entry, monitor 22 establishes a listener interface between the monitor and reference model. The reference model creates a listener 28 using like inheritance from the listener interface so that the communication characteristics of listener 28 are derived from the listener interface. Thus, listener 28 has “like inheritance” from the listener interface. Consequently, listener 28 uses the same data structure (fields) created by the monitor.
In a similar manner, when a reference model 26 desires to delete its listener 28 from the list of listener entry 24, it uses the public methods to delete its entry from the list.
One feature of the registration scheme of the present invention is that the number of reference models (listeners) registered with a monitor is limitless, yet the length of the list is determinable. Consequently, event monitoring is scalable.
The registration process is more fully illustrated in the flowchart of
In preferred embodiments, the present invention is carried out using a computer readable program having code in the monitor and the reference model that creates re-usable and scalable hardware verification environments.
The present invention thus provides a monitoring technique for notification of an interface event to a reference model for a device under test that maintains data encapsulation needed for object oriented programs. Because the listeners in the reference models like inherit the listener interface from the respective monitor, the units are fully and automatically compatible. Moreover, any chance that the reference model might inadvertently sample the monitor's data structure when it is not valid is precluded because the monitor supplies copies of the interpreted data structures to the reference models that are collected during an interface event.
A monitor might provide data structures concerning plural interface events being monitored by the monitor. Because the monitor initiates the process of supplying data structures to the reference models, the data structures are effectively protected from being overwritten due to multiple interface events occurring during the same simulation tick.
Although the present invention has been described with reference to preferred embodiments, workers skilled in the art will recognize that changes may be made in form and detail without departing from the spirit and scope of the invention.