pub trait Router: Eventful + Quantifiable {
    // Required methods
    fn insert(
        &mut self,
        current_cycle: Time,
        phit: Rc<Phit>,
        port: usize,
        rng: &mut StdRng
    ) -> Vec<EventGeneration>;
    fn acknowledge(
        &mut self,
        current_cycle: Time,
        port: usize,
        ack_message: AcknowledgeMessage
    ) -> Vec<EventGeneration>;
    fn num_virtual_channels(&self) -> usize;
    fn virtual_port_size(&self, port: usize, virtual_channel: usize) -> usize;
    fn iter_phits(&self) -> Box<dyn Iterator<Item = Rc<Phit>>>;
    fn get_status_at_emisor(&self, port: usize) -> Option<&dyn StatusAtEmissor>;
    fn get_maximum_credits_towards(
        &self,
        port: usize,
        virtual_channel: usize
    ) -> Option<usize>;
    fn get_index(&self) -> Option<usize>;
    fn aggregate_statistics(
        &self,
        statistics: Option<ConfigurationValue>,
        router_index: usize,
        total_routers: usize,
        cycle: Time
    ) -> Option<ConfigurationValue>;
    fn reset_statistics(&mut self, next_cycle: Time);
    fn build_emissor_status(
        &self,
        port: usize,
        topology: &dyn Topology
    ) -> Box<dyn StatusAtEmissor + 'static>;
}
Expand description

The interface that a router type must follow.

Required Methods§

source

fn insert( &mut self, current_cycle: Time, phit: Rc<Phit>, port: usize, rng: &mut StdRng ) -> Vec<EventGeneration>

Introduces a phit into the router in the specified port. Should return a list of events to push into the event queue. This may include to schedule itself or a subcomponent.

source

fn acknowledge( &mut self, current_cycle: Time, port: usize, ack_message: AcknowledgeMessage ) -> Vec<EventGeneration>

Receive the acknowledge of a phit clear. Generally to increase the credit count. Should return a list of events to push into the event queue. This may include to schedule itself or a subcomponent.

source

fn num_virtual_channels(&self) -> usize

To get the number of virtual channels the router uses.

source

fn virtual_port_size(&self, port: usize, virtual_channel: usize) -> usize

Get the number of phits that fit inside the buffer of a port.

source

fn iter_phits(&self) -> Box<dyn Iterator<Item = Rc<Phit>>>

To iterate over the phits managed by the router. Required to account memory.

source

fn get_status_at_emisor(&self, port: usize) -> Option<&dyn StatusAtEmissor>

Get a virtual port if any. To be used in some policies, e.g., VirtualChannelPolicy::Shortest.

source

fn get_maximum_credits_towards( &self, port: usize, virtual_channel: usize ) -> Option<usize>

Get the maximum number of credits towards the neighbour. To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.

source

fn get_index(&self) -> Option<usize>

Get the index of the router in the topology. To be used in policies such as VirtualChannelPolicy::LowestSinghWeight.

source

fn aggregate_statistics( &self, statistics: Option<ConfigurationValue>, router_index: usize, total_routers: usize, cycle: Time ) -> Option<ConfigurationValue>

To optionally write router statistics into the simulation output. Each router receives the aggregate of the statistics of the previous routers. In the frist router we have statistics=None and router_index=0. In the last router we have router_index+1==total_routers==topology.routers.len(), that may be used for final normalizations.

source

fn reset_statistics(&mut self, next_cycle: Time)

Clears all collected statistics

source

fn build_emissor_status( &self, port: usize, topology: &dyn Topology ) -> Box<dyn StatusAtEmissor + 'static>

Build a status for an element that sends packets directly to the router ports. This is intended to build the status of the servers.

Implementors§