simuhw.arbitrate.policy package

Module contents

class simuhw.arbitrate.policy.ArbitrationPolicy

Bases: object

The super class for all arbitration polices.

abstractmethod select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

class simuhw.arbitrate.policy.RoundRobinArbitrationPolicy(*, initial: int = 0)

Bases: ArbitrationPolicy

A round-robin arbitration policy.

__init__(*, initial: int = 0) None

Creates a round-robin arbitration policy.

Parameters:

initial – The initial index.

property next: int

The next index.

select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

class simuhw.arbitrate.policy.RandomArbitrationPolicy(*, rng: ~random.Random = <random.Random object>)

Bases: ArbitrationPolicy

A random arbitration policy.

__init__(*, rng: ~random.Random = <random.Random object>) None

Creates a random arbitration policy.

Parameters:

rng – The random number generator.

property rng: Random

The random number generator.

select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

class simuhw.arbitrate.policy.IndexOrderArbitrationPolicy(*, select_min: bool = True)

Bases: ArbitrationPolicy

An index order arbitration policy.

__init__(*, select_min: bool = True) None

Creates an index order arbitration policy.

Parameters:

select_minTrue if the target with the minimum index is to be selected. False if the target with the maximum index is to be selected.

select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

property select_min: bool

True if the target with the minimum index is to be selected.

class simuhw.arbitrate.policy.DataOrderArbitrationPolicy(*, select_min: bool = True, prioritize_none: bool = False, when_same: ~simuhw.arbitrate.policy._base.ArbitrationPolicy = <simuhw.arbitrate.policy._index_order.IndexOrderArbitrationPolicy object>)

Bases: ArbitrationPolicy

A data word order arbitration policy.

__init__(*, select_min: bool = True, prioritize_none: bool = False, when_same: ~simuhw.arbitrate.policy._base.ArbitrationPolicy = <simuhw.arbitrate.policy._index_order.IndexOrderArbitrationPolicy object>) None

Creates a data word order arbitration policy.

Parameters:
  • select_minTrue if the target with the minimum data word is to be selected. False if the target with the maximum data word is to be selected.

  • prioritize_noneTrue if the target with None data word is prioritized; False otherwise.

  • when_same – The arbitration policy applied when there are multiple targets with the same data word.

property prioritize_none: bool

True if the target with None data word is prioritized.

select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

property select_min: bool

True if the target with the minimum data word is to be selected.

property when_same: ArbitrationPolicy

The arbitration policy applied when there are multiple targets with the same data word.

class simuhw.arbitrate.policy.TimeOrderArbitrationPolicy(*, select_min: bool = True, when_same: ~simuhw.arbitrate.policy._base.ArbitrationPolicy = <simuhw.arbitrate.policy._index_order.IndexOrderArbitrationPolicy object>)

Bases: ArbitrationPolicy

A time order arbitration policy.

__init__(*, select_min: bool = True, when_same: ~simuhw.arbitrate.policy._base.ArbitrationPolicy = <simuhw.arbitrate.policy._index_order.IndexOrderArbitrationPolicy object>) None

Creates a time order arbitration policy.

Parameters:
  • select_minTrue if the target with the minimum time is to be selected. False if the target with the maximum time is to be selected.

  • when_same – The arbitration policy applied when there are multiple targets with the same time.

select(targets: Sequence[tuple[bytes | None, float]]) int

Selects one from the given inputs.

Parameters:

targets – The attributes of the targets to be selected. They are specified as (data word, time).

Returns:

The index of the selected target.

property select_min: bool

True if the target with the minimum time is to be selected.

property when_same: ArbitrationPolicy

The arbitration policy applied when there are multiple targets with the same time.