Specman- How can I implement a sequential coverage? - specman

I have an event named tx_intrpt_e.
I want to create the following coverage:
On tx_intrpt_e wait few cycles cross uarttx_dma_sreq==1.
Where uarttx_dma_sreq is a port of the interface.

You can define a new event that emitted "few cycles" after the original one, and the define the cover on the new event:
event tx_intrpt_e;
event tx_intrpt_e_delay is {#tx_intrpt_e;[3]}#clk;
cover tx_intrpt_e_delay is {
item uarttx_dma_sreq using ignore uarttx_dma_sreq==0;
}

Related

Intercepting filter/sort/column "model" changes / transactions

I would like to control the grid's sorting, filtering, and column states with an external store. Ideally I want to intercept the filterChanged and sortChanged events, emit them to the store, and let the store update the grid programmatically using the grid API.
readonly GRID_CONFIG: GridOptions = {
onSortChanged: (event: SortChangedEvent) => {
// Tell store that the sort changed
this.sortChanged.emit(this.grid.api.getSortModel());
},
onFilterChanged: (event: FilterChangedEvent) => {
// Tell store that the filter changed
this.filterChanged.emit(this.grid.api.getFilterModel());
},
onFilterModified: (event: FilterModifiedEvent) => {
// This isn't useful because it only relates to the floating filters pre-apply...
}
}
Unfortunately, once the onFilterChanged and onSortChanged events are called, the grid has already been updated, so the updates from the store are redundant.
The closest thing to what I want is isApplyServerSideTransaction, as this callback allows cancelling the transaction.
isApplyServerSideTransaction: (params: IsApplyServerSideTransactionParams) => {
// Emit model changes to the store so that the store can update the grid
this.sortChanged.emit(this.grid.api.getSortModel());
this.filterChanged.emit(this.grid.api.getFilterModel());
// Do not update the grid (redundant)
return false;
}
However, this is only supported for Server Side Row Model Full mode. This callback is never fired in my case, since I am using partial mode.
Are there any other tricks for hooking into the model changes before they're applied, or is this just not supported?
Update: I'm specifically trying to intercept the UI-triggered changes to the sort/filter model. I know this can be achieved with custom filters (and maybe custom headers?) but I'd much rather leverage Ag-Grid's built-in UI than build a whole custom copy, just to intercept one event.
Since you are using Server-side Row Model, the getRows callback is fired whenever the Grid is requesting data, i.e. whenever you filter/sort/group etc. So if you want to intercept what is being returned to the Grid, you should do it inside the getRows callback.

How do I choose both exact quanitity wait for and quanitity available in the same pick-up block?

So I have a vehicle which is going to pick up exact quantity (Wait for) the first 50 minutes in the simulation. After those 50 minutes have gone by, I want the same vehicle to pick up quantity (if available). How do I go about this?
Alternative approach (avoiding complex Java coding) is to use 2 Pickup blocks, each with a different setup. Put a SelectOutput block before them and route agents into the respective block using time()>50*minute() in the SelectOutput condition
Set it up for the first setup by default.
Create an event to trigger after 50 mins and make it execute this code:
myPickupObject.set_pickupType(PickupType.QUANTITY);
Here is a way to allow container entity to wait in a Pickup for some time t and then leave with whatever entities have been picked up. The example model looks like this:
There are two key components:
ReleaseOnTimeout Dynamic event which has a parameter called '_agent' of type Agent and following code:
for (Object o : pickup.getEmbeddedObjects()) {
// find the Delay object inside Pickup
if (Delay.class == o.getClass().getSuperclass()) {
// remove the container from the Delay
Agent a = ((Delay)o).remove(_agent);
if (a != null) {
// send the removed container into Enter
enter.take(a);
}
}
}
In pickup on enter action contains following code: `create_ReleaseOnTimeout(10, container);
How this works:
pickup is configured to have Exact quantity (wait for) behaviour
a container object enters Pickup block pickup
on entry a dynamic event ReleaseOnTimeout is scheduled in 10 units to check up on container
if sufficient number of entities were available then container picks them up and leaves
alternatively to (4), if by the time 10 units elapsed the container is still stuck in pickup then it will be removed and put into enter

Activiti, how to add listener for timer endding?

img
Hello, I have encounterred a problem about adding a listener to the end event of a timer. I used an intermediate catch event timer to wait a certain period(5 min). After 5 min, the flow goes to task2.
I want to update data in another table(some code in java), so I need a listener that listens the end event of the timer. However, the methods that I tried failed. Would you mind showing me a feasible and easily acomplishable way to do that?
Thanks!
Why not simply add a Task Listener to the complete event of your timer step?
https://www.activiti.org/javadocs/org/activiti/engine/delegate/tasklistener

RxJava2 action not executed if user leaves screen

I do a remove action through RxJava2 that causes a refresh on my local cache like this:
override fun removeExperience(experienceId: String, placeId: String): Completable {
return from(placesApi.deleteExperience(experienceId, placeId))
.andThen(from(refreshPlace(placeId))
.flatMapCompletable { Completable.complete() }
)
}
so whenever the remove action is done (Completable is complete), a refresh is triggered. The problem is, sometimes this remove action takes long enough for users to just leave the screen, and then the andThen action is never executed cause there is no subscribers anymore, and thus the information on the screen is not up to date anymore.
Is there a way to enforce this action to take place?
Does this logic continue working when user open the same screen again? If so, then you only need to finish subscription from(placesApi.deleteExperience(experienceId, placeId)) on lifecycle events. The easiest way is to add the whole subscription removeExperience() to Disposable or CompositeDisposable and then trigger its .dispose() or .clear() on view stop or destroy events.
.dispose() - doesn't allow to use the same subscription stored.
.clear() - allows re-subscription without creating the new
subscription instance

Is there any way to inter communicate with modules in boilerplatejs?

Regarding the BoilerplateJs example, how should we adjust those modules to be intercommunicate in such a way once the user done any change to one module, the other related modules should be updated with that change done.
For example, if there is a module to retrieve inputs from user as name and sales and another module to update those retrieved data in a table or a graph, can you explain with some example ,how those inter connection occurs considering event handling?
Thanks!!
In BoilerplateJS, each of your module will have it's own moduleContext object. This module context object contains two methods 'listen' and 'notify'. Have a look at the context class at '/src/core/context.js' for more details.
The component that need to 'listen' to the event, should register for the event by specifying the name of the event and callback handler. Component that raise the event should use 'notify' method to let others know something interesting happened (optionally passing a parameter).
Get an update of the latest BoilerplateJS code from GitHub. I just committed changes with making clickCounter a composite component where 'clickme component' raising an event and 'lottery component' listening to the event to respond.
Code for notifying the Event:
moduleContext.notify('LOTTERY_ACTIVITY', this.numberOfClicks());
Code for listening to the Event:
moduleContext.listen("LOTTERY_ACTIVITY", function(activityNumber) {
var randomNum = Math.floor(Math.random() * 3) + 1;
self.hasWon(randomNum === activityNumber);
});
I would look at using a Publish-Subscribe library, such as Amplify. Using this technique it is easy for one module to act as a publisher of events and others to register as subscribers, listening and responding to these events in a highly decoupled manner.
As you are already using Knockout you might be interested in first trying Ryan Niemeyer's knockout-postbox plugin first. More background on this library is available here including a demo fiddle. You can always switch to Amplify later if you require.